-
Notifications
You must be signed in to change notification settings - Fork 4
Add stripe marketplace app #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
brozek95
wants to merge
5
commits into
main
Choose a base branch
from
add-stripe-marketplace-app
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| <div class="alert alert-info"> | ||
| <div> | ||
| Please follow | ||
| <%= external_link_to 'how to configure Stripe payment method in Spree Commerce guide', 'https://spreecommerce.org/docs/integrations/payments/stripe', class: 'alert-link' %>. | ||
| </div> | ||
| </div> | ||
|
|
||
| <% if @payment_method.preferred_secret_key.present? && !@payment_method.restricted_api_key? %> | ||
| <div class="alert alert-info" role="alert"> | ||
| <%= Spree.t('stripe.configuration_guide.rak_migration_tip') %> | ||
| </div> | ||
| <% end %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
|
||
| # dependencies | ||
| /node_modules | ||
|
|
||
| # testing | ||
| /coverage | ||
|
|
||
| # production | ||
| /.build | ||
|
|
||
| # misc | ||
| .DS_Store | ||
| .env.local | ||
| .env.development.local | ||
| .env.test.local | ||
| .env.production.local | ||
|
|
||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
| install-deps.log |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # Spree Commerce — Stripe App | ||
|
|
||
| This directory contains the Stripe App for Spree Commerce. The app generates a Restricted API Key (RAK) with scoped permissions that users paste into Spree Admin, replacing the need for full secret keys. | ||
|
|
||
| ## Setup | ||
|
|
||
| Installation guide: https://docs.stripe.com/stripe-apps/plugins/rak | ||
|
|
||
| ## Permissions | ||
|
|
||
| The app requests the following permissions (configured in `stripe-app.json`): | ||
|
|
||
| - `payment_intent_write` / `payment_intent_read` — payment processing | ||
| - `payment_method_write` / `payment_method_read` — saved payment sources | ||
| - `customer_write` / `customer_read` — Stripe customer profiles | ||
| - `charge_write` / `charge_read` — refunds and charge details | ||
| - `setup_intent_write` — saving payment methods to customer profiles | ||
| - `payment_method_domain_write` — registering domains for Apple Pay and wallet payments | ||
| - `tax_calculations_and_transactions_write` / `tax_calculations_and_transactions_read` — Stripe Tax | ||
| - `webhook_write` / `webhook_read` — managing webhook endpoints | ||
| - `connected_account_read` — multi-vendor support | ||
|
|
||
| ## Settings Page | ||
|
|
||
| The settings UI is in `src/views/AppSettings.tsx`. It links to the Spree Stripe setup guide: | ||
|
|
||
| [Spree Stripe setup guide](https://spreecommerce.org/docs/integrations/payments/stripe) | ||
|
|
||
| ## Preview and Publish | ||
|
|
||
| - Preview locally: `stripe apps start` | ||
| - Upload for review: `stripe apps upload`, then submit in Stripe Dashboard |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| /* eslint-env node */ | ||
| /* eslint-disable @typescript-eslint/no-var-requires */ | ||
| const UIExtensionsConfig = require("@stripe/ui-extension-tools/jest.config.ui-extension"); | ||
|
|
||
| module.exports = { | ||
| ...UIExtensionsConfig, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| { | ||
| "name": "com.spreecommerce.spree-commerce", | ||
| "version": "0.0.2", | ||
| "description": "Spree Commerce", | ||
| "license": "BSD-3-Clause", | ||
| "dependencies": { | ||
| "@stripe/ui-extension-sdk": "^9.0.0", | ||
| "stripe": "^13.4.0" | ||
|
brozek95 marked this conversation as resolved.
|
||
| }, | ||
| "engines": { | ||
| "node": ">=18" | ||
| }, | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| "eslintConfig": { | ||
| "extends": [ | ||
| "./node_modules/@stripe/ui-extension-tools/eslintrc.ui-extension.js" | ||
| ] | ||
| }, | ||
| "scripts": { | ||
| "lint": "eslint --ext ts,tsx src", | ||
| "test": "jest" | ||
| }, | ||
| "resolutions": { | ||
| "@types/react": "^17.0.2" | ||
| }, | ||
| "devDependencies": { | ||
| "@stripe/ui-extension-tools": "^0.0.1" | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| import { | ||
| Box, | ||
| Button, | ||
| Divider, | ||
| Icon, | ||
| SettingsView | ||
| } from "@stripe/ui-extension-sdk/ui"; | ||
|
|
||
| const AppSettings = () => { | ||
| return ( | ||
| <SettingsView> | ||
| <Box | ||
| css={{ | ||
| padding: "large", | ||
| borderRadius: "medium", | ||
| width: "fit" | ||
| }} | ||
| > | ||
| <Box | ||
| css={{ | ||
| font: "heading", | ||
| stack: "x", | ||
| alignY: "center", | ||
| gap: "small", | ||
| marginBottom: "small", | ||
| }} | ||
| > | ||
| <Icon name="sparkle" /> | ||
| Spree Commerce | ||
| </Box> | ||
| <Box> | ||
| Install this app to generate a restricted API key for your Spree Commerce store. | ||
| Copy the key into your Spree Admin panel under Payments > Stripe to complete setup. | ||
| </Box> | ||
| <Box | ||
| css={{ | ||
| stack: "x", | ||
| gap: "small", | ||
| marginTop: "medium", | ||
| }} | ||
| > | ||
| <Button type="primary" target="_blank" href="https://spreecommerce.org/docs/integrations/payments/stripe"> | ||
| View setup instructions | ||
| <Icon name="external" /> | ||
| </Button> | ||
| <Button target="_blank" href="https://spreecommerce.org"> | ||
| Learn more | ||
| <Icon name="external" /> | ||
| </Button> | ||
| </Box> | ||
| </Box> | ||
| <Box css={{ marginTop: "large" }}> | ||
| <Box css={{ font: "heading", marginBottom: "small" }}> | ||
| Permissions | ||
| </Box> | ||
| <Divider /> | ||
| <Box css={{ font: "body", marginTop: "medium" }}> | ||
| This app requests access to manage payments, customers, refunds, | ||
| and tax calculations on behalf of your Spree store. | ||
| </Box> | ||
| </Box> | ||
| </SettingsView> | ||
| ); | ||
| }; | ||
|
|
||
| export default AppSettings; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| { | ||
| "$schema": "https://stripe.com/stripe-app.schema.json", | ||
| "id": "com.spreecommerce.spree-commerce", | ||
| "name": "Spree Commerce", | ||
| "version": "0.0.2", | ||
| "icon": "./icon.png", | ||
| "ui_extension": { | ||
| "views": [ | ||
| { | ||
| "viewport": "settings", | ||
| "component": "AppSettings" | ||
| } | ||
| ], | ||
| "content_security_policy": { | ||
| "purpose": "" | ||
| } | ||
| }, | ||
| "extensions": null, | ||
| "permissions": [ | ||
| { | ||
| "permission": "payment_intent_write", | ||
| "purpose": "Create, update, confirm, capture, and cancel payment intents for order processing" | ||
| }, | ||
| { | ||
| "permission": "payment_intent_read", | ||
| "purpose": "Retrieve payment intent details and status" | ||
| }, | ||
| { | ||
| "permission": "payment_method_write", | ||
| "purpose": "Attach payment methods to customers for saved payment sources" | ||
| }, | ||
| { | ||
| "permission": "payment_method_read", | ||
| "purpose": "Retrieve payment method details for display and processing" | ||
| }, | ||
| { | ||
| "permission": "customer_write", | ||
| "purpose": "Create and update Stripe customer profiles linked to Spree users" | ||
| }, | ||
| { | ||
| "permission": "customer_read", | ||
| "purpose": "Retrieve customer details for payment processing" | ||
| }, | ||
| { | ||
| "permission": "charge_write", | ||
| "purpose": "Process refunds for canceled or returned orders" | ||
| }, | ||
| { | ||
| "permission": "charge_read", | ||
| "purpose": "Retrieve charge and refund details from completed payment intents" | ||
| }, | ||
| { | ||
| "permission": "tax_calculations_and_transactions_write", | ||
| "purpose": "Calculate and record tax for orders using Stripe Tax" | ||
| }, | ||
| { | ||
| "permission": "tax_calculations_and_transactions_read", | ||
| "purpose": "Retrieve tax calculation details" | ||
| }, | ||
| { | ||
| "permission": "setup_intent_write", | ||
| "purpose": "Create setup intents for saving payment methods to customer profiles" | ||
| }, | ||
| { | ||
| "permission": "payment_method_domain_write", | ||
| "purpose": "Register store domains for Apple Pay and other wallet payment methods" | ||
| }, | ||
| { | ||
| "permission": "webhook_write", | ||
| "purpose": "Create webhook endpoints automatically when setting up Stripe payment method for receiving Stripe event notifications" | ||
| }, | ||
| { | ||
| "permission": "webhook_read", | ||
| "purpose": "List existing webhook endpoints to avoid duplicates" | ||
| }, | ||
| { | ||
| "permission": "connected_account_read", | ||
| "purpose": "Read connected account information for multi-vendor support" | ||
| } | ||
| ], | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| "distribution_type": "public", | ||
| "stripe_api_access_type": "restricted_api_key", | ||
| "sandbox_install_compatible": true | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "extends": "@stripe/ui-extension-tools/tsconfig.ui-extension" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| /// <reference types="@stripe/ui-extension-tools" /> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.