# Connect を導入する # Connect プラットフォームにアカウントを登録する 連結アカウントを作成し、そこから情報を収集して支払いを有効にします。組み込みが大幅に変更されるため、サンプルアプリをダウンロードする前にプロパティを選択することをお勧めします。 const stripe = require("stripe")( // This is a placeholder - it should be replaced with your secret API key. // Sign in to see your own test API key embedded in code samples. // Don’t submit any personally identifiable information in requests made with this key. 'sk_INSERT_YOUR_SECRET_KEY' ); const stripe = require("stripe")( // This is a placeholder - it should be replaced with your secret API key. // Sign in to see your own test API key embedded in code samples. // Don’t submit any personally identifiable information in requests made with this key. 'sk_INSERT_YOUR_SECRET_KEY' ); app.post("/account/:account", async (req, res) => { try { const connectedAccountId = req.params.account; const account = await stripe.accounts.update( connectedAccountId, { business_type: 'individual', }, ); res.json({ account: account.id, }); } catch (error) { console.error( "An error occurred when calling the Stripe API to update an account", error ); res.status(500); res.send({ error: error.message }); } }); app.post("/account/:account", async (req, res) => { try { const connectedAccountId = req.params.account; const account = await stripe.v2.core.accounts.update( connectedAccountId, { identity: { entity_type: 'individual', }, include: ['identity'], }, ); res.json({ account: account.id, }); } catch (error) { console.error( "An error occurred when calling the Stripe API to update an account", error ); res.status(500); res.send({ error: error.message }); } }); app.post("/account_link", async (req, res) => { try { const { account } = req.body; const accountLink = await stripe.accountLinks.create({ account: account, return_url: `${req.headers.origin}/return/${account}`, refresh_url: `${req.headers.origin}/refresh/${account}`, type: "account_onboarding", }); res.json(accountLink); } catch (error) { console.error( "An error occurred when calling the Stripe API to create an account link:", error ); res.status(500); res.send({ error: error.message }); } }); app.post("/account_link", async (req, res) => { try { const { account } = req.body; const accountLink = await stripe.v2.core.accountLinks.create({ account: account, use_case: { type: 'account_onboarding', account_onboarding: { configurations: ['recipient'], configurations: ['merchant'], return_url: `${req.headers.origin}/return/${account}`, refresh_url: `${req.headers.origin}/refresh/${account}`, } } }); res.json(accountLink); } catch (error) { console.error( "An error occurred when calling the Stripe API to create an account link:", error ); res.status(500); res.send({ error: error.message }); } }); app.post("/account_session", async (req, res) => { try { const { account } = req.body; const accountSession = await stripe.accountSessions.create({ account: account, components: { account_onboarding: { enabled: true }, account_management: {enabled: true}, notification_banner: {enabled: true}, }, }); res.json({ client_secret: accountSession.client_secret, }); } catch (error) { console.error( "An error occurred when calling the Stripe API to create an account session", error ); res.status(500); res.send({ error: error.message }); } }); app.post("/account", async (req, res) => { try { const account = await stripe.accounts.create({}); const account = await stripe.accounts.create({ controller: { stripe_dashboard: { type: "none", }, stripe_dashboard: { type: "express", }, fees: { payer: "application" }, losses: { payments: "application" }, requirement_collection: "application", losses: { payments: "application" }, }, capabilities: { card_payments: {requested: true}, transfers: {requested: true} }, capabilities: { transfers: {requested: true} }, country: "US", }); res.json({ account: account.id, }); } catch (error) { console.error( "An error occurred when calling the Stripe API to create an account", error ); res.status(500); res.send({ error: error.message }); } }); app.post("/account", async (req, res) => { try { const account = await stripe.v2.core.accounts.create({ dashboard: 'none', dashboard: 'express', dashboard: 'full', contact_email: 'person@example.com', defaults: { responsibilities: { fees_collector: 'application', fees_collector: 'stripe', losses_collector: 'application', losses_collector: 'stripe', }, }, configuration: { merchant: { capabilities: { card_payments: { requested: true, }, }, }, recipient: { capabilities: { stripe_balance: { stripe_transfers: { requested: true, }, }, }, }, }, identity: { country: 'US', }, include: [ 'configuration.merchant', 'configuration.recipient', 'identity', 'defaults', ], }); res.json({ account: account.id, }); } catch (error) { console.error( "An error occurred when calling the Stripe API to create an account", error ); res.status(500); res.send({ error: error.message }); } }); require 'stripe' \# This is a placeholder - it should be replaced with your secret API key. # Sign in to see your own test API key embedded in code samples. # Don’t submit any personally identifiable information in requests made with this key. api_key = 'sk_INSERT_YOUR_SECRET_KEY' $CLIENT = Stripe::StripeClient.new(api_key) post '/account/:account' do content_type 'application/json' begin connected_account_id = params[:account] account = $CLIENT.v1.accounts.update( connected_account_id, { business_type: 'individual', } ) { account: account[:id] }.to_json rescue => error puts "An error occurred when calling the Stripe API to update an account: #{error.message}"; return [500, { error: error.message }.to_json] end end post '/account/:account' do content_type 'application/json' begin connected_account_id = params[:account] account = $CLIENT.v2.core.accounts.update( connected_account_id, { identity: { entity_type: 'individual', }, include: ['identity'], }, ) { account: account[:id] }.to_json rescue => error puts "An error occurred when calling the Stripe API to update an account: #{error.message}"; return [500, { error: error.message }.to_json] end end post '/account_link' do content_type 'application/json' body = JSON.parse(request.body.read) connected_account_id = body["account"] begin account_link = $CLIENT.v1.account_links.create({ account: connected_account_id, return_url: "http://localhost:4242/return/#{connected_account_id}", refresh_url: "http://localhost:4242/refresh/#{connected_account_id}", type: "account_onboarding", }) { url: account_link.url }.to_json rescue => error puts "An error occurred when calling the Stripe API to create an account link: #{error.message}"; return [500, { error: error.message }.to_json] end end post '/account_link' do content_type 'application/json' body = JSON.parse(request.body.read) connected_account_id = body["account"] begin account_link = $CLIENT.v2.core.account_links.create({ account: connected_account_id, use_case: { type: "account_onboarding", account_onboarding: { configurations: ['recipient'], configurations: ['merchant'], return_url: "http://localhost:4242/return/#{connected_account_id}", refresh_url: "http://localhost:4242/refresh/#{connected_account_id}", } } }) { url: account_link.url }.to_json rescue => error puts "An error occurred when calling the Stripe API to create an account link: #{error.message}"; return [500, { error: error.message }.to_json] end end post '/account_session' do content_type 'application/json' body = JSON.parse(request.body.read) connected_account_id = body["account"] begin account_session = $CLIENT.v1.account_sessions.create({ account: connected_account_id, components: { account_onboarding: {enabled: true}, } }) { client_secret: account_session[:client_secret] }.to_json rescue => error puts "An error occurred when calling the Stripe API to create an account session: #{error.message}"; return [500, { error: error.message }.to_json] end end post '/account_session' do content_type 'application/json' body = JSON.parse(request.body.read) connected_account_id = body["account"] begin account_session = $CLIENT.v1.account_sessions.create({ account: connected_account_id, components: { account_onboarding: {enabled: true}, } }) { client_secret: account_session[:client_secret] }.to_json rescue => error puts "An error occurred when calling the Stripe API to create an account session: #{error.message}"; return [500, { error: error.message }.to_json] end end post '/account' do content_type 'application/json' begin account = $CLIENT.v1.accounts.create account = $CLIENT.v1.accounts.create({ controller: { stripe_dashboard: { type: "none", }, stripe_dashboard: { type: "express", }, fees: { payer: "application" }, losses: { payments: "application" }, requirement_collection: "application", losses: { payments: "application" }, }, capabilities: { card_payments: {requested: true}, transfers: {requested: true} }, capabilities: { transfers: {requested: true} }, country: "US", }) { account: account[:id] }.to_json rescue => error puts "An error occurred when calling the Stripe API to create an account: #{error.message}"; return [500, { error: error.message }.to_json] end end post '/account' do content_type 'application/json' begin account = $CLIENT.v2.core.accounts.create({ dashboard: 'none', dashboard: 'express', dashboard: 'full', contact_email: 'person@example.com', defaults: { responsibilities: { fees_collector: 'application', fees_collector: 'stripe', losses_collector: 'application' losses_collector: 'stripe' }, }, configuration: { merchant: { capabilities: { card_payments: {requested: true}, } }, recipient: { capabilities: { stripe_balance: { stripe_transfers: {requested: true}, }, } }, }, identity: { country: "US", }, include: [ 'configuration.merchant', 'configuration.recipient', 'identity', 'defaults', ], }) { account: account[:id] }.to_json rescue => error puts "An error occurred when calling the Stripe API to create an account: #{error.message}"; return [500, { error: error.message }.to_json] end end "fmt" "context" "github.com/stripe/stripe-go/v84" "github.com/stripe/stripe-go/v84/accountsession" // This is a placeholder - it should be replaced with your secret API key. // Sign in to see your own test API key embedded in code samples. // Don’t submit any personally identifiable information in requests made with this key. // Don't put any keys in code. See https://docs.stripe.com/keys-best-practices. var client = stripe.NewClient("<>") r.HandleFunc("/account", CreateAccount) r.HandleFunc("/account_session", CreateAccountSession) r.HandleFunc("/account_link", CreateAccountLink); r.HandleFunc("/account/{account}", UpdateAccount); func CreateAccountSession(w http.ResponseWriter, r *http.Request) { if r.Method != "POST" { http.Error(w, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed) return } var requestBody RequestBody err := json.NewDecoder(r.Body).Decode(&requestBody) if err != nil { http.Error(w, err.Error(), http.StatusBadRequest) return } params := &stripe.AccountSessionCreateParams{ Account: stripe.String(requestBody.Account), Components: &stripe.AccountSessionCreateComponentsParams{ AccountOnboarding: &stripe.AccountSessionCreateComponentsAccountOnboardingParams{ Enabled: stripe.Bool(true), }, }, } accountSession, err := client.V1AccountSessions.Create(context.TODO(), params) if err != nil { log.Printf("An error occurred when calling the Stripe API to create an account session: %v", err) handleError(w, err) return } writeJSON(w, struct { ClientSecret string `json:"client_secret"` }{ ClientSecret: accountSession.ClientSecret, }) } func CreateAccountSession(w http.ResponseWriter, r *http.Request) { if r.Method != "POST" { http.Error(w, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed) return } var requestBody RequestBody err := json.NewDecoder(r.Body).Decode(&requestBody) if err != nil { http.Error(w, err.Error(), http.StatusBadRequest) return } params := &stripe.AccountSessionCreateParams{ Account: stripe.String(requestBody.Account), Components: &stripe.AccountSessionCreateComponentsParams{ AccountOnboarding: &stripe.AccountSessionCreateComponentsAccountOnboardingParams{ Enabled: stripe.Bool(true), }, }, } accountSession, err := client.V1AccountSessions.Create(context.TODO(), params) if err != nil { log.Printf("An error occurred when calling the Stripe API to create an account session: %v", err) handleError(w, err) return } writeJSON(w, struct { ClientSecret string `json:"client_secret"` }{ ClientSecret: accountSession.ClientSecret, }) } func UpdateAccount(w http.ResponseWriter, r *http.Request) { if r.Method != "POST" { http.Error(w, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed) return } connectedAccountId := mux.Vars(r)["account"] params := &stripe.AccountUpdateParams{ BusinessType: stripe.String("individual"), } account, err := client.V1Accounts.Update(context.TODO(), connectedAccountId, params) if err != nil { log.Printf("An error occurred when calling the Stripe API to update an account: %v", err) handleError(w, err) return } writeJSON(w, struct { Account string `json:"account"` }{ Account: account.ID, }) } func UpdateAccount(w http.ResponseWriter, r *http.Request) { if r.Method != "POST" { http.Error(w, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed) return } connectedAccountId := mux.Vars(r)["account"] params := &stripe.V2CoreAccountUpdateParams{ Identity: &stripe.V2CoreAccountUpdateIdentityParams{ EntityType: stripe.String("individual"), }, Include: []*string{stripe.String("identity")}, } account, err := client.V2CoreAccounts.Update(context.TODO(), connectedAccountId, params) if err != nil { log.Printf("An error occurred when calling the Stripe API to update an account: %v", err) handleError(w, err) return } writeJSON(w, struct { Account string `json:"account"` }{ Account: account.ID, }) } func CreateAccountLink(w http.ResponseWriter, r *http.Request) { if r.Method != "POST" { http.Error(w, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed) return } var requestBody RequestBody err := json.NewDecoder(r.Body).Decode(&requestBody) if err != nil { http.Error(w, err.Error(), http.StatusBadRequest) return } accountLink, err := client.V1AccountLinks.Create(context.TODO(), &stripe.AccountLinkCreateParams{ Account: stripe.String(requestBody.Account), ReturnURL: stripe.String(fmt.Sprintf("http://localhost:4242/return/%s", requestBody.Account)), RefreshURL: stripe.String(fmt.Sprintf("http://localhost:4242/refresh/%s", requestBody.Account)), Type: stripe.String("account_onboarding"), }) if err != nil { log.Printf("An error occurred when calling the Stripe API to create an account link: %v", err) handleError(w, err) return } writeJSON(w, struct { URL string `json:"url"` }{ URL: accountLink.URL, }) } func CreateAccountLink(w http.ResponseWriter, r *http.Request) { if r.Method != "POST" { http.Error(w, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed) return } var requestBody RequestBody err := json.NewDecoder(r.Body).Decode(&requestBody) if err != nil { http.Error(w, err.Error(), http.StatusBadRequest) return } accountLink, err := client.V2CoreAccountLinks.Create(context.TODO(), &stripe.V2CoreAccountLinkCreateParams{ Account: stripe.String(requestBody.Account), UseCase: &stripe.V2CoreAccountLinkCreateUseCaseParams{ Type: stripe.String("account_onboarding"), AccountOnboarding: &stripe.V2CoreAccountLinkCreateUseCaseAccountOnboardingParams{ Configurations: []*string{stripe.String("recipient")}, Configurations: []*string{stripe.String("merchant")}, ReturnURL: stripe.String(fmt.Sprintf("http://localhost:4242/return/%s", requestBody.Account)), RefreshURL: stripe.String(fmt.Sprintf("http://localhost:4242/refresh/%s", requestBody.Account)), }, }, }) if err != nil { log.Printf("An error occurred when calling the Stripe API to create an account link: %v", err) handleError(w, err) return } writeJSON(w, struct { URL string `json:"url"` }{ URL: accountLink.URL, }) } account, err := client.V1Accounts.Create(context.TODO(), &stripe.AccountCreateParams{}) account, err := client.V1Accounts.Create(context.TODO(), &stripe.AccountCreateParams{ Controller: &stripe.AccountCreateControllerParams{ StripeDashboard: &stripe.AccountCreateControllerStripeDashboardParams{ Type: stripe.String("none"), }, StripeDashboard: &stripe.AccountCreateControllerStripeDashboardParams{ Type: stripe.String("express"), }, Fees: &stripe.AccountCreateControllerFeesParams{ Payer: stripe.String("application"), }, Losses: &stripe.AccountCreateControllerLossesParams{ Payments: stripe.String("application"), }, RequirementCollection: stripe.String("application"), Losses: &stripe.AccountCreateControllerLossesParams{ Payments: stripe.String("application"), }, }, Capabilities: &stripe.AccountCreateCapabilitiesParams{ CardPayments: &stripe.AccountCreateCapabilitiesCardPaymentsParams{ Requested: stripe.Bool(true), }, Transfers: &stripe.AccountCreateCapabilitiesTransfersParams{ Requested: stripe.Bool(true), }, }, Capabilities: &stripe.AccountCreateCapabilitiesParams{ Transfers: &stripe.AccountCreateCapabilitiesTransfersParams{ Requested: stripe.Bool(true), }, }, Country: stripe.String("US"), }) account, err := client.V2CoreAccounts.Create(context.TODO(), &stripe.V2CoreAccountCreateParams{ Dashboard: stripe.String("none"), Dashboard: stripe.String("express"), Dashboard: stripe.String("full"), ContactEmail: stripe.String("person@example.com"), Defaults: &stripe.V2CoreAccountCreateDefaultsParams{ Responsibilities: &stripe.V2CoreAccountCreateDefaultsResponsibilitiesParams{ FeesCollector: stripe.String("application"), FeesCollector: stripe.String("stripe"), LossesCollector: stripe.String("application"), LossesCollector: stripe.String("stripe"), }, }, Configuration: &stripe.V2CoreAccountCreateConfigurationParams{ Merchant: &stripe.V2CoreAccountCreateConfigurationMerchantParams{ Capabilities: &stripe.V2CoreAccountCreateConfigurationMerchantCapabilitiesParams{ CardPayments: &stripe.V2CoreAccountCreateConfigurationMerchantCapabilitiesCardPaymentsParams{ Requested: stripe.Bool(true), }, }, }, Recipient: &stripe.V2CoreAccountCreateConfigurationRecipientParams{ Capabilities: &stripe.V2CoreAccountCreateConfigurationRecipientCapabilitiesParams{ StripeBalance: &stripe.V2CoreAccountCreateConfigurationRecipientCapabilitiesStripeBalanceParams{ StripeTransfers: &stripe.V2CoreAccountCreateConfigurationRecipientCapabilitiesStripeBalanceStripeTransfersParams{ Requested: stripe.Bool(true), }, }, }, }, }, Identity: &stripe.V2CoreAccountCreateIdentityParams{ Country: stripe.String("US"), }, Include: []*string{ stripe.String("configuration.merchant"), stripe.String("configuration.recipient"), stripe.String("identity"), stripe.String("defaults"), }, }) import java.util.HashMap; import java.util.Map; import com.stripe.StripeClient; import com.stripe.model.Account; import com.stripe.param.AccountCreateParams; import com.stripe.model.AccountLink; import com.stripe.param.AccountLinkCreateParams; import com.stripe.model.AccountSession; import com.stripe.param.AccountSessionCreateParams; import com.stripe.param.AccountUpdateParams; import com.stripe.StripeClient; import com.stripe.model.v2.core.Account; import com.stripe.param.v2.core.AccountCreateParams; import com.stripe.model.v2.core.AccountLink; import com.stripe.param.v2.core.AccountLinkCreateParams; import com.stripe.model.AccountSession; import com.stripe.param.AccountSessionCreateParams; import com.stripe.param.v2.core.AccountUpdateParams; // This is a public sample test API key. // Don’t submit any personally identifiable information in requests made with this key. // Sign in to see your own test API key embedded in code samples. // Don't put any keys in code. See https://docs.stripe.com/keys-best-practices. private static StripeClient client = new StripeClient("<>"); post("/account", Server::createAccount); post("/account_session", Server::createAccountSession); post("/account_link", Server::createAccountLink); post("/account/:account", Server::updateAccount); private static class UpdateAccountResponse { public UpdateAccountResponse() {} } private static String updateAccount(Request request, Response response) { response.type("application/json"); try { String connectedAccountId = request.params("account"); client.v1().accounts().update(connectedAccountId, AccountUpdateParams.builder() .setBusinessType(AccountUpdateParams.BusinessType.INDIVIDUAL) .build() ); UpdateAccountResponse accountUpdateResponse = new UpdateAccountResponse(); return gson.toJson(accountUpdateResponse); } catch (Exception e) { System.out .println("An error occurred when calling the Stripe API to update an account: " + e.getMessage()); response.status(500); return gson.toJson(new ErrorResponse(e.getMessage())); } } private static class UpdateAccountResponse { public UpdateAccountResponse() {} } private static String updateAccount(Request request, Response response) { response.type("application/json"); try { String connectedAccountId = request.params("account"); Account connectedAccount = client.v2().core().accounts().update(connectedAccountId, AccountUpdateParams.builder() .setIdentity( AccountUpdateParams.Identity.builder(). .setEntityType(AccountUpdateParams.Identity.EntityType.INDIVIDUAL) ).build() .setBusinessType(AccountUpdateParams.Identity.EntityType.INDIVIDUAL) .build() ); UpdateAccountResponse accountUpdateResponse = new UpdateAccountResponse(); return gson.toJson(accountUpdateResponse); } catch (Exception e) { System.out .println("An error occurred when calling the Stripe API to update an account: " + e.getMessage()); response.status(500); return gson.toJson(new ErrorResponse(e.getMessage())); } } private static class CreateAccountSessionResponse { private String client_secret; public CreateAccountSessionResponse(String clientSecret) { this.client_secret = clientSecret; } } private static String createAccountSession(Request request, Response response) { response.type("application/json"); try { String connectedAccountId = gson.fromJson(request.body(), RequestBody.class).getAccount(); AccountSession accountSession = client.v1().accountSessions().create( AccountSessionCreateParams.builder() .setAccount(connectedAccountId) .setComponents( AccountSessionCreateParams.Components.builder() .setAccountOnboarding( AccountSessionCreateParams.Components.AccountOnboarding.builder() .setEnabled(true) .build() ) .build() ) .build() ); AccountSession accountSession = client.v1().accountSessions().create( AccountSessionCreateParams.builder() .setAccount(connectedAccountId) .setComponents( AccountSessionCreateParams.Components.builder() .setAccountOnboarding( AccountSessionCreateParams.Components.AccountOnboarding.builder() .setEnabled(true) .build() ) .build() ) .build() ); CreateAccountSessionResponse accountSessionResponse = new CreateAccountSessionResponse( accountSession.getClientSecret() ); return gson.toJson(accountSessionResponse); } catch (Exception e) { System.out .println("An error occurred when calling the Stripe API to create an account session: " + e.getMessage()); response.status(500); return gson.toJson(new ErrorResponse(e.getMessage())); } } private static class CreateAccountLinkResponse { private String url; public CreateAccountLinkResponse(String url) { this.url = url; } } private static String createAccountLink(Request request, Response response) { response.type("application/json"); try { String connectedAccountId = gson.fromJson(request.body(), RequestBody.class).getAccount(); AccountLink accountLink = client.v1().accountLinks().create( AccountLinkCreateParams.builder() .setAccount(connectedAccountId) .setReturnUrl("http://localhost:4242/return/" + connectedAccountId) .setRefreshUrl("http://localhost:4242/refresh/" + connectedAccountId) .setType(AccountLinkCreateParams.Type.ACCOUNT_ONBOARDING) .build() ); AccountLink accountLink = client.v2().core().accountLinks().create( AccountLinkCreateParams.builder() .setAccount(connectedAccountId) .setUseCase( AccountLinkCreateParams.UseCase.builder() .setType(AccountLinkCreateParams.UseCase.Type.ACCOUNT_ONBOARDING) .setAccountOnboarding( AccountLinkCreateParams.UseCase.AccountOnboarding.builder() .addConfiguration( AccountLinkCreateParams.UseCase.AccountOnboarding.Configuration.RECIPIENT ) .addConfiguration( AccountLinkCreateParams.UseCase.AccountOnboarding.Configuration.MERCHANT ) .setReturnUrl("http://localhost:4242/return/" + connectedAccountId) .setRefreshUrl("http://localhost:4242/refresh/" + connectedAccountId) .build() ) .build() ) .build() ); CreateAccountLinkResponse accountLinkResponse = new CreateAccountLinkResponse(accountLink.getUrl()); return gson.toJson(accountLinkResponse); } catch (Exception e) { System.out.println("An error occurred when calling the Stripe API to create an account link: " + e.getMessage()); response.status(500); return gson.toJson(new ErrorResponse(e.getMessage())); } } Account account = client.v1().accounts().create(AccountCreateParams.builder().build()); Account account = client.v1().accounts().create( AccountCreateParams.builder() .setController(AccountCreateParams.Controller.builder() .setStripeDashboard( AccountCreateParams.Controller.StripeDashboard.builder() .setType(AccountCreateParams.Controller.StripeDashboard.Type.NONE) .build() ) .setStripeDashboard( AccountCreateParams.Controller.StripeDashboard.builder() .setType(AccountCreateParams.Controller.StripeDashboard.Type.EXPRESS) .build() ) .setFees( AccountCreateParams.Controller.Fees.builder() .setPayer(AccountCreateParams.Controller.Fees.Payer.APPLICATION) .build() ) .setLosses( AccountCreateParams.Controller.Losses.builder() .setPayments(AccountCreateParams.Controller.Losses.Payments.APPLICATION) .build() ) .setRequirementCollection(AccountCreateParams.Controller.RequirementCollection.APPLICATION) .setLosses( AccountCreateParams.Controller.Losses.builder() .setPayments(AccountCreateParams.Controller.Losses.Payments.APPLICATION) .build() ) .build() ) .setCapabilities( AccountCreateParams.Capabilities.builder() .setCardPayments( AccountCreateParams.Capabilities.CardPayments.builder() .setRequested(true) .build() ) .setTransfers( AccountCreateParams.Capabilities.Transfers.builder() .setRequested(true) .build() ).build() ) .setCapabilities( AccountCreateParams.Capabilities.builder() .setTransfers( AccountCreateParams.Capabilities.Transfers.builder() .setRequested(true) .build() ).build() ) .setCountry("US") .build() ); Account account = client.v2().core().accounts().create( AccountCreateParams.builder() .setDashboard(AccountCreateParams.Dashboard.NONE) .setDashboard(AccountCreateParams.Dashboard.EXPRESS) .setDashboard(AccountCreateParams.Dashboard.FULL) .setContactEmail("person@example.com") .setDefaults( AccountCreateParams.Defaults.builder() .setResponsibilities( AccountCreateParams.Defaults.Responsibilities.builder() .setFeesCollector( AccountCreateParams.Defaults.Responsibilities.FeesCollector.APPLICATION ) .setFeesCollector( AccountCreateParams.Defaults.Responsibilities.FeesCollector.STRIPE ) .setLossesCollector( AccountCreateParams.Defaults.Responsibilities.LossesCollector.APPLICATION ) .setLossesCollector( AccountCreateParams.Defaults.Responsibilities.LossesCollector.STRIPE ) .build() ) .build() ) .setConfiguration( AccountCreateParams.Configuration.builder() .setMerchant( AccountCreateParams.Configuration.Merchant.builder() .setCapabilities( AccountCreateParams.Configuration.Merchant.Capabilities.builder() .setCardPayments( AccountCreateParams.Configuration.Merchant.Capabilities.CardPayments.builder() .setRequested(true) .build() ) .build() ) .build() ) .setRecipient( AccountCreateParams.Configuration.Recipient.builder() .setCapabilities( AccountCreateParams.Configuration.Recipient.Capabilities.builder() .setStripeBalance( AccountCreateParams.Configuration.Recipient.Capabilities.StripeBalance.builder() .setStripeTransfers( AccountCreateParams.Configuration.Recipient.Capabilities.StripeBalance.StripeTransfers.builder() .setRequested(true) .build() ) .build() ) .build() ) .build() ) .build() ) .setIdentity( AccountCreateParams.Identity.builder() .setCountry("US") .build() ) .addInclude(AccountCreateParams.Include.CONFIGURATION__MERCHANT) .addInclude(AccountCreateParams.Include.CONFIGURATION__RECIPIENT) .addInclude(AccountCreateParams.Include.IDENTITY) .addInclude(AccountCreateParams.Include.DEFAULTS) .build() ); import stripe \# This is a placeholder - it should be replaced with your secret API key. # Sign in to see your own test API key embedded in code samples. # Don’t submit any personally identifiable information in requests made with this key. client = stripe.StripeClient('sk_INSERT_YOUR_SECRET_KEY') \# This is a placeholder - it should be replaced with your secret API key. # Sign in to see your own test API key embedded in code samples. # Don’t submit any personally identifiable information in requests made with this key. api_key = 'sk_INSERT_YOUR_SECRET_KEY' client = stripe.StripeClient(api_key) @app.route('/account/', methods=['POST']) def update_account(account): try: connected_account = client.v1.accounts.update( account, params={ 'business_type': 'individual', }, ) return jsonify({ 'account': connected_account.id, }) except Exception as e: print('An error occurred when calling the Stripe API to update an account: ', e) return jsonify(error=str(e)), 500 @app.route('/account/', methods=['POST']) def update_account(account): try: connected_account = client.v2.core.accounts.update( account, { "identity": { "entity_type": "individual", }, } ) return jsonify({ 'account': connected_account.id, }) except Exception as e: print('An error occurred when calling the Stripe API to update an account: ', e) return jsonify(error=str(e)), 500 @app.route('/account_link', methods=['POST']) def create_account_link(): try: connected_account_id = request.get_json().get('account') account_link = client.v1.account_links.create(params={ 'account': connected_account_id, 'return_url': f"http://localhost:4242/return/{connected_account_id}", 'refresh_url': f"http://localhost:4242/refresh/{connected_account_id}", 'type': 'account_onboarding', }) return jsonify({ 'url': account_link.url, }) except Exception as e: print('An error occurred when calling the Stripe API to create an account link: ', e) return jsonify(error=str(e)), 500 @app.route('/account_link', methods=['POST']) def create_account_link(): try: connected_account_id = request.get_json().get('account') account_link = client.v2.core.account_links.create({ "account": connected_account_id, "use_case": { "type": "account_onboarding", "account_onboarding": { "configurations": ["recipient"], "configurations": ["merchant"], "return_url": f"http://localhost:4242/return/{connected_account_id}", "refresh_url": f"http://localhost:4242/refresh/{connected_account_id}", }, }, }) return jsonify({ 'url': account_link.url, }) except Exception as e: print('An error occurred when calling the Stripe API to create an account link: ', e) return jsonify(error=str(e)), 500 @app.route('/account_session', methods=['POST']) def create_account_session(): try: connected_account_id = request.get_json().get('account') account_session = client.v1.account_sessions.create(params={ 'account': connected_account_id, 'components': { "account_onboarding": {"enabled": True}, }, }) return jsonify({ 'client_secret': account_session.client_secret, }) except Exception as e: print('An error occurred when calling the Stripe API to create an account session: ', e) return jsonify(error=str(e)), 500 @app.route('/account_session', methods=['POST']) def create_account_session(): try: connected_account_id = request.get_json().get('account') account_session = client.v1.account_sessions.create({ "account": connected_account_id, "components": { "account_onboarding": {"enabled": True}, }, }) return jsonify({ 'client_secret': account_session.client_secret, }) except Exception as e: print('An error occurred when calling the Stripe API to create an account session: ', e) return jsonify(error=str(e)), 500 @app.route('/account', methods=['POST']) def create_account(): try: account = client.v1.accounts.create() account = client.v1.accounts.create(params={ 'controller': { "stripe_dashboard": { "type": "none", }, "stripe_dashboard": { "type": "express", }, "fees": { "payer": "application" }, "losses": { "payments": "application" }, "requirement_collection": "application", "losses": { "payments": "application" }, }, 'capabilities': { "card_payments": {"requested": True}, "transfers": {"requested": True} }, 'capabilities': { "transfers": {"requested": True} }, 'country': "US", }) return jsonify({ 'account': account.id, }) except Exception as e: print('An error occurred when calling the Stripe API to create an account: ', e) return jsonify(error=str(e)), 500 @app.route('/account', methods=['POST']) def create_account(): try: account = client.v2.core.accounts.create({ "dashboard": "none", "dashboard": "express", "dashboard": "full", "contact_email": "person@example.com", "defaults": { "responsibilities": { "fees_collector": "application", "fees_collector": "stripe", "losses_collector": "application", "losses_collector": "stripe", }, }, "configuration": { "merchant": { "capabilities": { "card_payments": { "requested": True }, } }, "recipient": { "capabilities": { "stripe_balance": { "stripe_transfers": { "requested": True }, } } }, }, "identity": { "country": "US", }, "include": [ "configuration.merchant", "configuration.recipient", "identity", "defaults", ] }) return jsonify({ 'account': account.id, }) except Exception as e: print('An error occurred when calling the Stripe API to create an account: ', e) return jsonify(error=str(e)), 500 $stripeSecretKey, ]); try { $account = $stripe->accounts->create(); $account = $stripe->accounts->create([ 'controller' => [ 'stripe_dashboard' => [ 'type' => 'none', ], 'stripe_dashboard' => [ 'type' => 'express', ], 'fees' => [ 'payer' => 'application' ], 'losses' => [ 'payments' => 'application' ], 'requirement_collection' => 'application', 'losses' => [ 'payments' => 'application' ], ], 'capabilities' => [ 'card_payments' => ['requested' => true], 'transfers' => ['requested' => true], ], 'capabilities' => [ 'transfers' => ['requested' => true], ], 'country' => "US", ]); echo json_encode(array( 'account' => $account->id )); } catch (Exception $e) { error_log("An error occurred when calling the Stripe API to create an account: {$e->getMessage()}"); http_response_code(500); echo json_encode(['error' => $e->getMessage()]); } ?> v2->core->accounts->create([ 'dashboard' => 'none', 'dashboard' => 'express', 'dashboard' => 'full', 'contact_email' => 'person@example.com', 'defaults' => [ 'responsibilities' => [ 'fees_collector' => 'application', 'fees_collector' => 'stripe', 'losses_collector' => 'application', 'losses_collector' => 'stripe', ], ], 'configuration' => [ 'merchant' => ['capabilities' => ['card_payments' => ['requested' => true]]], 'recipient' => [ 'capabilities' => ['stripe_balance' => ['stripe_transfers' => ['requested' => true]]], ], ], 'identity' => [ 'country' => "US", ], 'include' => [ 'configuration.merchant', 'configuration.recipient', 'identity', 'defaults', ], ]); echo json_encode(array( 'account' => $account->id )); } catch (Exception $e) { error_log("An error occurred when calling the Stripe API to create an account: {$e->getMessage()}"); http_response_code(500); echo json_encode(['error' => $e->getMessage()]); } ?> $stripeSecretKey, ]); $json = file_get_contents('php://input'); $data = json_decode($json); if ($data && $data->account) { try { $account = $stripe->accounts->update( $data->account, ['business_type' => 'individual'], ); echo json_encode(array( 'account' => $account->id )); return; } catch (Exception $e) { error_log("An error occurred when calling the Stripe API to update an account: {$e->getMessage()}"); http_response_code(500); echo json_encode(['error' => $e->getMessage()]); } } else { try { $account = $stripe->accounts->create(); $account = $stripe->accounts->create([ 'controller' => [ 'stripe_dashboard' => [ 'type' => 'none', ], 'stripe_dashboard' => [ 'type' => 'express', ], 'fees' => [ 'payer' => 'application' ], 'losses' => [ 'payments' => 'application' ], 'requirement_collection' => 'application', 'losses' => [ 'payments' => 'application' ], ], 'capabilities' => [ 'card_payments' => ['requested' => true], 'transfers' => ['requested' => true], ], 'capabilities' => [ 'transfers' => ['requested' => true], ], 'country' => "US", ]); echo json_encode(array( 'account' => $account->id )); } catch (Exception $e) { error_log("An error occurred when calling the Stripe API to create an account: {$e->getMessage()}"); http_response_code(500); echo json_encode(['error' => $e->getMessage()]); } } ?> account) { try { $account = $stripe->v2->core->accounts->update( $data->account, [ 'identity' => [ 'entity_type' => 'individual' ] ] ); echo json_encode(array( 'account' => $account->id )); return; } catch (Exception $e) { error_log("An error occurred when calling the Stripe API to update an account: {$e->getMessage()}"); http_response_code(500); echo json_encode(['error' => $e->getMessage()]); } } else { try { $account = $stripe->v2->core->accounts->create([ 'dashboard' => 'none', 'dashboard' => 'express', 'dashboard' => 'full', 'contact_email' => 'person@example.com', 'defaults' => [ 'responsibilities' => [ 'fees_collector' => 'application', 'fees_collector' => 'stripe', 'losses_collector' => 'application', 'losses_collector' => 'stripe', ], ], 'configuration' => [ 'merchant' => ['capabilities' => ['card_payments' => ['requested' => true]]], 'recipient' => [ 'capabilities' => ['stripe_balance' => ['stripe_transfers' => ['requested' => true]]], ], ], 'identity' => [ 'country' => "US", ], 'include' => [ 'configuration.merchant', 'configuration.recipient', 'identity', 'defaults', ], ]); echo json_encode(array( 'account' => $account->id )); } catch (Exception $e) { error_log("An error occurred when calling the Stripe API to create an account: {$e->getMessage()}"); http_response_code(500); echo json_encode(['error' => $e->getMessage()]); } } ?> $stripeSecretKey, ]); try { $json = file_get_contents('php://input'); $data = json_decode($json); $account_session = $stripe->accountSessions->create([ 'account' => $data->account, 'components' => [ 'account_onboarding' => [ 'enabled' => true, ], ], ]); echo json_encode(array( 'client_secret' => $account_session->client_secret )); } catch (Exception $e) { error_log("An error occurred when calling the Stripe API to create an account session: {$e->getMessage()}"); http_response_code(500); echo json_encode(['error' => $e->getMessage()]); } ?> accountSessions->create([ 'account' => $data->account, 'components' => [ 'account_onboarding' => [ 'enabled' => true, ], ], ]); echo json_encode(array( 'client_secret' => $account_session->client_secret )); } catch (Exception $e) { error_log("An error occurred when calling the Stripe API to create an account session: {$e->getMessage()}"); http_response_code(500); echo json_encode(['error' => $e->getMessage()]); } ?> $stripeSecretKey, ]); try { $json = file_get_contents('php://input'); $data = json_decode($json); $connectedAccountId = $data->account; $account_link = $stripe->accountLinks->create([ 'account' => $connectedAccountId, 'return_url' => sprintf("http://localhost:4242/return/%s", $connectedAccountId), 'refresh_url' => sprintf("http://localhost:4242/refresh/%s", $connectedAccountId), 'type' => 'account_onboarding', ]); echo json_encode(array( 'url' => $account_link->url )); } catch (Exception $e) { error_log("An error occurred when calling the Stripe API to create an account link: {$e->getMessage()}"); http_response_code(500); echo json_encode(['error' => $e->getMessage()]); } ?> account; $account_link = $stripe->v2->core->accountLinks->create([ 'account' => $connectedAccountId, 'use_case' => [ 'type' => 'account_onboarding', 'account_onboarding' => [ 'configurations' => ['recipient'], 'configurations' => ['merchant'], 'return_url' => sprintf("http://localhost:4242/return/%s", $connectedAccountId), 'refresh_url' => sprintf("http://localhost:4242/refresh/%s", $connectedAccountId), ], ], ]); echo json_encode(array( 'url' => $account_link->url )); } catch (Exception $e) { error_log("An error occurred when calling the Stripe API to create an account link: {$e->getMessage()}"); http_response_code(500); echo json_encode(['error' => $e->getMessage()]); } ?> // This is a placeholder - it should be replaced with your secret API key. // Sign in to see your own test API key embedded in code samples. // Don’t submit any personally identifiable information in requests made with this key. $stripeSecretKey = 'sk_INSERT_YOUR_SECRET_KEY'; using Stripe; // This is a public sample test API key. // Don’t submit any personally identifiable information in requests made with this key. // Sign in to see your own test API key embedded in code samples. // Don't put any keys in code. See https://docs.stripe.com/keys-best-practices. services.AddSingleton(new StripeClient("<>")); [HttpPost("{connectedAccountId}")] public ActionResult Update(string connectedAccountId) { try { Account account = _client.V1.Accounts.Update( connectedAccountId, new AccountUpdateOptions { BusinessType = "individual", } ); return Json(new { account = account.Id }); } catch(Exception ex) { Console.Write("An error occurred when calling the Stripe API to update an account: " + ex.Message); Response.StatusCode = 500; return Json(new { error = ex.Message }); } } [HttpPost("{connectedAccountId}")] public ActionResult Update(string connectedAccountId) { try { var options = new Stripe.V2.Core.AccountUpdateOptions { Identity = new Stripe.V2.Core.AccountUpdateIdentityOptions { EntityType = "individual", }, Include = new List { "identity" }, }; var service = _client.V2.Core.Accounts; Stripe.V2.Core.Account account = service.Update(connectedAccountId, options); return Json(new { account = account.Id }); } catch(Exception ex) { Console.Write("An error occurred when calling the Stripe API to update an account: " + ex.Message); Response.StatusCode = 500; return Json(new { error = ex.Message }); } } [HttpPost] public ActionResult Create() { try { var options = new AccountCreateOptions(); var options = new AccountCreateOptions { Controller = new AccountControllerOptions { StripeDashboard = new AccountControllerStripeDashboardOptions { Type = "none" }, StripeDashboard = new AccountControllerStripeDashboardOptions { Type = "express" }, Fees = new AccountControllerFeesOptions { Payer = "application" }, Losses = new AccountControllerLossesOptions { Payments = "application" }, RequirementCollection = "application", Losses = new AccountControllerLossesOptions { Payments = "application" }, }, Capabilities = new AccountCapabilitiesOptions { CardPayments = new AccountCapabilitiesCardPaymentsOptions { Requested = true, }, Transfers = new AccountCapabilitiesTransfersOptions { Requested = true, }, }, Capabilities = new AccountCapabilitiesOptions { Transfers = new AccountCapabilitiesTransfersOptions { Requested = true, }, }, Country = "US", }; Account account = _client.V1.Accounts.Create(options); return Json(new { account = account.Id }); } catch(Exception ex) { Console.Write("An error occurred when calling the Stripe API to create an account: " + ex.Message); Response.StatusCode = 500; return Json(new { error = ex.Message }); } } [HttpPost] public ActionResult Create() { try { var options = new Stripe.V2.Core.AccountCreateOptions { Dashboard = "none", Dashboard = "express", Dashboard = "full", ContactEmail = "person@example.com", Defaults = new Stripe.V2.Core.AccountCreateDefaultsOptions { Responsibilities = new Stripe.V2.Core.AccountCreateDefaultsResponsibilitiesOptions { FeesCollector = "application", FeesCollector = "stripe", LossesCollector = "application", LossesCollector = "stripe", }, }, Configuration = new Stripe.V2.Core.AccountCreateConfigurationOptions { Merchant = new Stripe.V2.Core.AccountCreateConfigurationMerchantOptions { Capabilities = new Stripe.V2.Core.AccountCreateConfigurationMerchantCapabilitiesOptions { CardPayments = new Stripe.V2.Core.AccountCreateConfigurationMerchantCapabilitiesCardPaymentsOptions { Requested = true, }, }, }, Recipient = new Stripe.V2.Core.AccountCreateConfigurationRecipientOptions { Capabilities = new Stripe.V2.Core.AccountCreateConfigurationRecipientCapabilitiesOptions { StripeBalance = new Stripe.V2.Core.AccountCreateConfigurationRecipientCapabilitiesStripeBalanceOptions { StripeTransfers = new Stripe.V2.Core.AccountCreateConfigurationRecipientCapabilitiesStripeBalanceStripeTransfersOptions { Requested = true, } }, }, }, }, Identity = new Stripe.V2.Core.AccountCreateIdentityOptions { Country = "US", }, Include = new List { "configuration.merchant", "configuration.recipient", "identity", "defaults", }, }; var service = _client.V2.Core.Accounts; Stripe.V2.Core.Account account = service.Create(options); return Json(new { account = account.Id }); } catch(Exception ex) { Console.Write("An error occurred when calling the Stripe API to create an account: " + ex.Message); Response.StatusCode = 500; return Json(new { error = ex.Message }); } } public class AccountSessionPostBody { public string Account { get; set; } } [Route("account_session")] [ApiController] public class AccountSessionApiController : Controller { private readonly StripeClient _client; public AccountSessionApiController(StripeClient client) { _client = client; } [HttpPost] public ActionResult Create([FromBody] AccountSessionPostBody accountSessionPostBody) { try { var connectedAccountId = accountSessionPostBody.Account; AccountSession accountSession = _client.V1.AccountSessions.Create( new AccountSessionCreateOptions { Account = connectedAccountId, Components = new AccountSessionComponentsOptions { AccountOnboarding = new AccountSessionComponentsAccountOnboardingOptions { Enabled = true }, } } ); return Json(new { client_secret = accountSession.ClientSecret }); } catch(Exception ex) { Console.Write("An error occurred when calling the Stripe API to create an account session: " + ex.Message); Response.StatusCode = 500; return Json(new { error = ex.Message }); } } } [Route("account_session")] [ApiController] public class AccountSessionApiController : Controller { private StripeClient _client; public AccountSessionApiController(StripeClient client) { _client = client; } [HttpPost] public ActionResult Create([FromBody] AccountSessionPostBody accountSessionPostBody) { try { var connectedAccountId = accountSessionPostBody.Account; var service = _client.V1.AccountSessions; AccountSession accountSession = service.Create( new AccountSessionCreateOptions { Account = connectedAccountId, Components = new AccountSessionComponentsOptions { AccountOnboarding = new AccountSessionComponentsAccountOnboardingOptions { Enabled = true }, } } ); return Json(new { client_secret = accountSession.ClientSecret }); } catch(Exception ex) { Console.Write("An error occurred when calling the Stripe API to create an account session: " + ex.Message); Response.StatusCode = 500; return Json(new { error = ex.Message }); } } } public class AccountLinkPostBody { public string Account { get; set; } } [Route("account_link")] [ApiController] public class AccountLinkApiController : Controller { private readonly StripeClient _client; public AccountLinkApiController(StripeClient client) { _client = client; } [HttpPost] public ActionResult Create([FromBody] AccountLinkPostBody accountLinkPostBody) { try { var connectedAccountId = accountLinkPostBody.Account; AccountLink accountLink = _client.V1.AccountLinks.Create( new AccountLinkCreateOptions { Account = connectedAccountId, ReturnUrl = $"http://localhost/return/{connectedAccountId}", RefreshUrl = $"http://localhost/refresh/{connectedAccountId}", Type = "account_onboarding", } ); return Json(new { url = accountLink.Url }); } catch(Exception ex) { Console.Write("An error occurred when calling the Stripe API to create an account link: " + ex.Message); Response.StatusCode = 500; return Json(new { error = ex.Message }); } } } [Route("account_link")] [ApiController] public class AccountLinkApiController : Controller { private StripeClient _client; public AccountLinkApiController(StripeClient client) { _client = client; } [HttpPost] public ActionResult Create([FromBody] AccountLinkPostBody accountLinkPostBody) { try { var connectedAccountId = accountLinkPostBody.Account; var options = new Stripe.V2.Core.AccountLinkCreateOptions { Account = connectedAccountId, UseCase = new Stripe.V2.Core.AccountLinkCreateUseCaseOptions { Type = "account_onboarding", AccountOnboarding = new Stripe.V2.Core.AccountLinkCreateUseCaseAccountOnboardingOptions { Configurations = new List { "recipient" }, Configurations = new List { "merchant" }, ReturnUrl = $"http://localhost/return/{connectedAccountId}", RefreshUrl = $"http://localhost/refresh/{connectedAccountId}", }, }, }; var service = _client.V2.Core.AccountLinks; Stripe.V2.Core.AccountLink accountLink = service.Create(options); return Json(new { url = accountLink.Url }); } catch(Exception ex) { Console.Write("An error occurred when calling the Stripe API to create an account link: " + ex.Message); Response.StatusCode = 500; return Json(new { error = ex.Message }); } } } certifi==2026.1.4 chardet==5.2.0 click==8.3.1 Flask==3.1.2 idna==3.11 itsdangerous==2.2.0 Jinja2==3.1.6 MarkupSafe==3.0.3 requests==2.32.5 stripe==15.0.0 toml==0.10.2 Werkzeug==3.1.5

Rocket Rides

Rocket Rides is the world's leading air travel platform: join our team of pilots to help people travel faster.

Rocket Rides

Rocket Rides is the world's leading air travel platform: join our team of pilots to help people travel faster.

Rocket Rides

Rocket Rides is the world's leading air travel platform: join our team of pilots to help people travel faster.

fetch("/account.php", { fetch("/account", { method: "POST", }) .then((response) => response.json()) .then((json) => { const {account, error} = json; if (error) { document.getElementById("error").classList.remove("hidden"); document.getElementById("sign-up-button").classList.remove("hidden"); document.getElementById("creating-connected-account").classList.add("hidden"); document.getElementById("dev-callout").classList.add("hidden"); return; } connectedAccountId = account; const connectedAccountIdElement = document.getElementById("connected-account-id"); connectedAccountIdElement.innerHTML = `Your connected account ID is: ${connectedAccountId}`; connectedAccountIdElement.classList.remove("hidden"); document.getElementById("add-information-button").classList.remove("hidden"); document.getElementById("creating-connected-account").classList.add("hidden"); document.getElementById("title").classList.add("hidden"); document.getElementById("subtitle").classList.add("hidden"); document.getElementById("add-information-title").classList.remove("hidden"); document.getElementById("add-information-subtitle").classList.remove("hidden"); }); fetch("/account.php", { fetch(`/account/${connectedAccountId}`, { method: "POST", }) .then((response) => response.json()) .then((json) => { const {error} = json; if (error) { document.getElementById("error").classList.remove("hidden"); document.getElementById("adding-onboarding-information").classList.add("hidden"); document.getElementById("add-information-button").classList.remove("hidden"); return; } document.getElementById("example-form").classList.remove("hidden"); document.getElementById("onboarding-has-begun").classList.remove("hidden"); document.getElementById("adding-onboarding-information").classList.add("hidden"); }); import { loadConnectAndInitialize } from "@stripe/connect-js"; const response = await fetch('/account_session.php', { const response = await fetch('/account_session', { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ account: connectedAccountId, }), }); fetch("/account.php", { fetch("/account", { method: "POST", }) .then((response) => response.json()) .then((json) => { const {account, error} = json; if (error) { document.getElementById("error").classList.remove("hidden"); document.getElementById("sign-up-button").classList.remove("hidden"); document.getElementById("creating-connected-account").classList.add("hidden"); document.getElementById("dev-callout").classList.add("hidden"); return; } connectedAccountId = account; const connectedAccountIdElement = document.getElementById("connected-account-id"); connectedAccountIdElement.innerHTML = `Your connected account ID is: ${connectedAccountId}`; connectedAccountIdElement.classList.remove("hidden"); document.getElementById("creating-connected-account").classList.add("hidden"); document.getElementById("title").classList.add("hidden"); document.getElementById("subtitle").classList.add("hidden"); const stripeConnectInstance = loadConnectAndInitialize({ // Replace this with your publishable API key from https://dashboard.stripe.com/test/apikeys publishableKey: "pk_INSERT_YOUR_PUBLISHABLE_KEY", fetchClientSecret: fetchClientSecret, appearance: { overlays: 'dialog', variables: { colorPrimary: "#635BFF", }, }, }); const container = document.getElementById("embedded-onboarding-container"); const embeddedOnboardingComponent = stripeConnectInstance.create("account-onboarding"); embeddedOnboardingComponent.setOnExit(() => { console.log('User exited the onboarding flow'); }); container.appendChild(embeddedOnboardingComponent); }); fetch("/account.php", { fetch("/account", { method: "POST", }) .then((response) => response.json()) .then((json) => { const {account, error} = json; if (error) { document.getElementById("error").classList.remove("hidden"); document.getElementById("sign-up-button").classList.remove("hidden"); document.getElementById("creating-connected-account").classList.add("hidden"); document.getElementById("dev-callout").classList.add("hidden"); return; } connectedAccountId = account; const connectedAccountIdElement = document.getElementById("connected-account-id"); connectedAccountIdElement.innerHTML = `Your connected account ID is: ${connectedAccountId}`; connectedAccountIdElement.classList.remove("hidden"); document.getElementById("add-information-button").classList.remove("hidden"); document.getElementById("creating-connected-account").classList.add("hidden"); document.getElementById("title").classList.add("hidden"); document.getElementById("subtitle").classList.add("hidden"); document.getElementById("add-information-title").classList.remove("hidden"); document.getElementById("add-information-subtitle").classList.remove("hidden"); }); fetch("/account_link.php", { fetch("/account_link", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ account: connectedAccountId, }), }) .then((response) => response.json()) .then((json) => { const {url, error} = json; if (error) { document.getElementById("error").classList.remove("hidden"); document.getElementById("add-information-button").classList.remove("hidden"); return; } document.getElementById("adding-onboarding-information").classList.add("hidden"); window.location.href = url; }); document.getElementById("title").classList.add("hidden"); document.getElementById("subtitle").classList.add("hidden"); document.getElementById("sign-up-button").classList.add("hidden"); document.getElementById("details-submitted-title").classList.remove("hidden"); document.getElementById("details-submitted-subtitle").classList.remove("hidden"); connectedAccountId = parts[2]; createAccountLinkAndRedirect(connectedAccountId); margin-top: 0; margin-bottom: 80px; margin: 0; background-color: #635BFF; color: #ffffff; .example-form { height: 400px; width: 420px; display: flex; flex-direction: column; justify-content: center; align-items: center; border: 1px dashed black; padding: 0; } background-color: #635BFF; color: #ffffff; { "name": "stripe-sample-code", "version": "1.0.0", "description": "Build a full, working Connect integration. Here are some basic scripts you can use to build and run the application.", "scripts": { "start": "parcel watch", "build": "parcel build" }, "author": "", "license": "ISC", "devDependencies": { "parcel": "^2.8.3" }, "source": "public/index.html", "dependencies": { "@stripe/connect-js": "3.3.5" } } { "name": "stripe-sample-code", "version": "1.0.0", "description": "Build a full, working Connect integration. Here are some basic scripts you can use to build and run the application.", "scripts": { "start-client": "parcel watch", "start-server": "node server.js", "start": "concurrently \"yarn start-client\" \"yarn start-server\"", "build": "parcel build" }, "author": "", "license": "ISC", "devDependencies": { "concurrently": "4.1.2", "parcel": "^2.8.3" }, "source": "public/index.html", "dependencies": { "express": "^4.17.1", "stripe": "20.1.0", "@stripe/connect-js": "3.3.5" } } { "name": "stripe-sample", "version": "0.1.0", "dependencies": { "@stripe/connect-js": "3.3.5", "@stripe/react-connect-js": "3.3.7", "express": "^4.17.1", "react": "^18.2.0", "react-dom": "^18.2.0", "react-router-dom": "^6.4.0", "react-scripts": "^3.4.0", "stripe": "20.1.0" }, "devDependencies": { "concurrently": "4.1.2", "parcel": "^2.8.3" }, "homepage": "http://localhost:3000", "proxy": "http://localhost:4242", "source": "public/index.html", "scripts": { "start-client": "parcel watch", "start-server": "node server.js", "build": "parcel build", "test": "react-scripts test", "eject": "react-scripts eject", "start": "concurrently \"yarn start-client\" \"yarn start-server\"" }, "eslintConfig": { "extends": "react-app" }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] } } { "name": "client", "version": "0.1.0", "private": true, "dependencies": { "react": "^18.2.0", "react-dom": "^18.2.0", "react-router-dom": "^6.4.0", "react-scripts": "^3.4.0", "@stripe/connect-js": "3.3.5", "@stripe/react-connect-js": "3.3.7" }, "homepage": "http://localhost:3000", "proxy": "http://localhost:4242", "scripts": { "start": "parcel watch", "build": "parcel build" }, "source": "public/index.html", "eslintConfig": { "extends": "react-app" }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] }, "devDependencies": { "parcel": "^2.8.3" } } import Refresh from "./Refresh"; import Return from "./Return"; { path: "/refresh/:connectedAccountId", element: , }, { path: "/return/:connectedAccountId", element: , }, export default function App() { return (
); } margin-top: 0; margin-bottom: 80px; margin: 0; background-color: #635BFF; color: #ffffff; .example-form { height: 400px; width: 420px; display: flex; flex-direction: column; justify-content: center; align-items: center; border: 1px dashed black; padding: 0; } background-color: #635BFF; color: #ffffff; \# Replace this placeholder with your publishable key from https://dashboard.stripe.com/test/apikeys REACT_APP_STRIPE_PUBLISHABLE_KEY=pk_INSERT_YOUR_PUBLISHABLE_KEY export default function Refresh() { const {connectedAccountId} = useParams(); const [accountLinkCreatePending, setAccountLinkCreatePending] = useState(false); const [error, setError] = useState(false); React.useEffect(() => { if (connectedAccountId) { setAccountLinkCreatePending(true); fetch("/account_link.php", { fetch("/account_link", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ account: connectedAccountId, }), }) .then((response) => response.json()) .then((json) => { setAccountLinkCreatePending(false); const { url, error } = json; if (url) { window.location.href = url; } if (error) { setError(true); } }); } }, [connectedAccountId]) return (

Rocket Rides

Add information to start accepting money

Rocket Rides is the world's leading air travel platform: join our team of pilots to help people travel faster.

{error &&

Something went wrong!

}
{connectedAccountId &&

Your connected account ID is: {connectedAccountId}

} {accountLinkCreatePending &&

Creating a new Account Link...

}
); } export default function Return() { const {connectedAccountId} = useParams(); return (

Rocket Rides

Details submitted

That's everything we need for now

This is a sample app for Stripe-hosted Connect onboarding. View docs

); }

Rocket Rides

{!connectedAccountId &&

Rocket Rides is the world's leading air travel platform: join our team of pilots to help people travel faster.

} {connectedAccountId &&

Rocket Rides partners with Stripe to help you receive payments while keeping your personal and bank details secure.

} onClick={async () => { setAccountCreatePending(true); setError(false); fetch("/account.php", { method: "POST", }) fetch("/account", { method: "POST", }) .then((response) => response.json()) .then((json) => { setAccountCreatePending(false); const connectedAccountId = json.account; setConnectedAccountId(connectedAccountId); }); }} onClick={async () => { setAccountUpdatePending(true); setError(false); fetch(`/account.php`, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ account: connectedAccountId, }), }) fetch(`/account/${connectedAccountId}`, { method: "POST", }) .then((response) => response.json()) .then((json) => { setAccountUpdatePending(false); setConnectedAccountUpdated(true); }); }} {connectedAccountUpdated && (

Your onboarding flow goes here

)} import { ConnectAccountOnboarding, ConnectComponentsProvider, } from "@stripe/react-connect-js";

Rocket Rides

{!connectedAccountId &&

Rocket Rides is the world's leading air travel platform: join our team of pilots to help people travel faster.

} onClick={async () => { setAccountCreatePending(true); setError(false); fetch("/account.php", { method: "POST", }) fetch("/account", { method: "POST", }) .then((response) => response.json()) .then((json) => { setAccountCreatePending(false); const { account, error } = json; if (account) { setConnectedAccountId(account); } if (error) { setError(true); } }); }} setOnboardingExited(true)} />

Rocket Rides

{!connectedAccountId &&

Rocket Rides is the world's leading air travel platform: join our team of pilots to help people travel faster.

} {connectedAccountId &&

Matt's Mats partners with Stripe to help you receive payments and keep your personal bank and details secure.

} onClick={async () => { setAccountCreatePending(true); setError(false); fetch("/account.php", { method: "POST", }) fetch("/account", { method: "POST", }) .then((response) => response.json()) .then((json) => { setAccountCreatePending(false); const { account, error } = json; if (account) { setConnectedAccountId(account); } if (error) { setError(true); } }); }} onClick={async () => { setAccountLinkCreatePending(true); setError(false); fetch("/account_link.php", { fetch("/account_link", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ account: connectedAccountId, }), }) .then((response) => response.json()) .then((json) => { setAccountLinkCreatePending(false); const { url, error } = json; if (url) { window.location.href = url; } if (error) { setError(true); } }); }} import { loadConnectAndInitialize } from "@stripe/connect-js"; export const useStripeConnect = (connectedAccountId) => { const [stripeConnectInstance, setStripeConnectInstance] = useState(); useEffect(() => { if (connectedAccountId) { const fetchClientSecret = async () => { const response = await fetch("/account_session.php", { const response = await fetch("/account_session", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ account: connectedAccountId, }), }); if (!response.ok) { // Handle errors on the client side here const { error } = await response.json(); throw new Error("An error occurred: " + error); } else { const { client_secret: clientSecret } = await response.json(); return clientSecret; } }; setStripeConnectInstance( loadConnectAndInitialize({ publishableKey: process.env.REACT_APP_STRIPE_PUBLISHABLE_KEY, fetchClientSecret, appearance: { overlays: "dialog", variables: { colorPrimary: "#635BFF", }, }, }) ); } }, [connectedAccountId]); return stripeConnectInstance; };

Rocket Rides

{!connectedAccountId &&

Rocket Rides is the world's leading air travel platform: join our team of pilots to help people travel faster.

} {connectedAccountId &&

Matt's Mats partners with Stripe to help you receive payments while keeping your personal and bank details secure.

} onClick={async () => { setAccountCreatePending(true); setError(false); fetch("/api/account", { method: "POST", }) .then((response) => response.json()) .then((json) => { setAccountCreatePending(false); const { account, error } = json; if (account) { setConnectedAccountId(account); } if (error) { setError(true); } }); }} onClick={async () => { setAccountLinkCreatePending(true); setError(false); fetch("/api/account_link", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ account: connectedAccountId, }), }) .then((response) => response.json()) .then((json) => { setAccountLinkCreatePending(false); const { url, error } = json; if (url) { window.location.href = url; } if (error) { setError(true); } }); }} import { ConnectAccountOnboarding, ConnectComponentsProvider, } from "@stripe/react-connect-js";

Rocket Rides

{!connectedAccountId &&

Rocket Rides is the world's leading air travel platform: join our team of pilots to help people travel faster.

} onClick={async () => { setAccountCreatePending(true); setError(false); fetch("/api/account", { method: "POST", }) .then((response) => response.json()) .then((json) => { setAccountCreatePending(false); const { account, error } = json; if (account) { setConnectedAccountId(account); } if (error) { setError(true); } }); }} setOnboardingExited(true)} />

Rocket Rides

{!connectedAccountId &&

Rocket Rides is the world's leading air travel platform: join our team of pilots to help people travel faster.

} {connectedAccountId &&

Rocket Rides partners with Stripe to help you receive payments while keeping your personal and bank details secure.

} onClick={async () => { setAccountCreatePending(true); setError(false); fetch("/api/account", { method: "POST", }) .then((response) => response.json()) .then((json) => { setAccountCreatePending(false); const connectedAccountId = json.account; setConnectedAccountId(connectedAccountId); }); }} onClick={async () => { setAccountUpdatePending(true); setError(false); fetch(`/api/account/${connectedAccountId}`, { method: "POST", }) .then((response) => response.json()) .then((json) => { setAccountUpdatePending(false); setConnectedAccountUpdated(true); }); }} {connectedAccountUpdated && (

Your onboarding flow goes here

)} export default function Refresh() { const {query: {id: connectedAccountId}} = useRouter(); const [accountLinkCreatePending, setAccountLinkCreatePending] = useState(false); const [error, setError] = useState(false); React.useEffect(() => { if (connectedAccountId) { setAccountLinkCreatePending(true); fetch("/api/account_link", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ account: connectedAccountId, }), }) .then((response) => response.json()) .then((json) => { setAccountLinkCreatePending(false); const { url, error } = json; if (url) { window.location.href = url; } if (error) { setError(true); } }); } }, [connectedAccountId]); return (

Rocket Rides

Add information to start accepting money

Rocket Rides is the world's leading air travel platform: join our team of pilots to help people travel faster.

{error &&

Something went wrong!

}
{connectedAccountId &&

Your connected account ID is: {connectedAccountId}

} {accountLinkCreatePending &&

Creating a new Account Link...

}
); } export default function Return() { return (

Rocket Rides

Details submitted

That's everything we need for now

This is a sample app for Stripe-hosted Connect onboarding. View docs

); } export default async function handler(req, res) { if (req.method === 'POST') { try { const account = await stripe.accounts.create({}); const account = await stripe.accounts.create({ controller: { stripe_dashboard: { type: "none", }, stripe_dashboard: { type: "express", }, fees: { payer: "application" }, losses: { payments: "application" }, requirement_collection: "application", losses: { payments: "application" }, }, capabilities: { card_payments: {requested: true}, transfers: {requested: true} }, capabilities: { transfers: {requested: true} }, country: "US", }); res.json({account: account.id}); } catch (error) { console.error('An error occurred when calling the Stripe API to create an account:', error); res.status(500); res.json({error: error.message}); } } } export default async function handler(req, res) { if (req.method === 'POST') { try { const account = await stripe.v2.core.accounts.create({ dashboard: 'none', dashboard: 'express', dashboard: 'full', contact_email: 'person@example.com', defaults: { responsibilities: { fees_collector: 'application', fees_collector: 'stripe', losses_collector: 'application', losses_collector: 'stripe', }, }, configuration: { merchant: { capabilities: { card_payments: { requested: true, }, }, }, recipient: { capabilities: { stripe_balance: { stripe_transfers: { requested: true, }, }, }, }, }, identity: { country: 'US', }, include: [ 'configuration.merchant', 'configuration.recipient', 'identity', 'defaults', ], }); res.json({account: account.id}); } catch (error) { console.error('An error occurred when calling the Stripe API to create an account:', error); res.status(500); res.json({error: error.message}); } } } export default async function handler(req, res) { if (req.method === 'POST') { try { const {id: connectedAccountId} = req.query; const account = await stripe.accounts.update( connectedAccountId, { business_type: 'individual', }, ); res.json({ account: account.id }); } catch (error) { console.error('An error occurred when calling the Stripe API to update an account:', error); res.status(500); res.json({error: error.message}); } } } export default async function handler(req, res) { if (req.method === 'POST') { try { const {id: connectedAccountId} = req.query; const account = await stripe.v2.core.accounts.update( connectedAccountId, { identity: { entity_type: 'individual', }, include: ['identity'], }, ); res.json({ account: account.id }); } catch (error) { console.error('An error occurred when calling the Stripe API to update an account:', error); res.status(500); res.json({error: error.message}); } } } export default async function handler(req, res) { if (req.method === 'POST') { try { const accountSession = await stripe.accountSessions.create({ account: req.body.account, components: { account_onboarding: { enabled: true }, } }); res.json({ client_secret: accountSession.client_secret, }); } catch (error) { console.error( "An error occurred when calling the Stripe API to create an account session", error ); res.status(500); res.json({error: error.message}); } } } export default async function handler(req, res) { if (req.method === "POST") { try { const { account } = req.body; const accountLink = await stripe.accountLinks.create({ account: account, refresh_url: `${req.headers.origin}/refresh/${account}`, return_url: `${req.headers.origin}/return/${account}`, type: "account_onboarding", }); res.json({ url: accountLink.url, }); } catch (error) { console.error( "An error occurred when calling the Stripe API to create an account link:", error ); res.status(500); res.send({ error: error.message }); } } } export default async function handler(req, res) { if (req.method === "POST") { try { const { account } = req.body; const accountLink = await stripe.v2.core.accountLinks.create({ account: account, use_case: { type: 'account_onboarding', account_onboarding: { configurations: ['recipient'], configurations: ['merchant'], return_url: `${req.headers.origin}/return/${account}`, refresh_url: `${req.headers.origin}/refresh/${account}`, } } }); res.json(accountLink); } catch (error) { console.error( "An error occurred when calling the Stripe API to create an account link:", error ); res.status(500); res.send({ error: error.message }); } } } import { loadConnectAndInitialize } from "@stripe/connect-js"; export const useStripeConnect = (connectedAccountId) => { const [stripeConnectInstance, setStripeConnectInstance] = useState(); useEffect(() => { if (connectedAccountId) { const fetchClientSecret = async () => { const response = await fetch("/api/account_session", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ account: connectedAccountId, }), }); if (!response.ok) { // Handle errors on the client side here const { error } = await response.json(); throw new Error("An error occurred: " + error); } else { const { client_secret: clientSecret } = await response.json(); return clientSecret; } }; setStripeConnectInstance( loadConnectAndInitialize({ publishableKey: process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY, fetchClientSecret, appearance: { overlays: "dialog", variables: { colorPrimary: "#635BFF", }, }, }) ); } }, [connectedAccountId]); return stripeConnectInstance; }; export const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY, { apiVersion: '2026-04-22.dahlia', }); export const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY, { apiVersion: '2026-04-22.dahlia', }); margin-top: 0; margin-bottom: 80px; margin: 0; background-color: #635BFF; color: #ffffff; .example-form { height: 400px; width: 420px; display: flex; flex-direction: column; justify-content: center; align-items: center; border: 1px dashed black; padding: 0; } background-color: #635BFF; color: #ffffff; STRIPE_SECRET_KEY=sk_INSERT_YOUR_SECRET_KEY NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_INSERT_YOUR_PUBLISHABLE_KEY "@stripe/connect-js": "3.3.5", "@stripe/react-connect-js": "3.3.7", { "name": "stripe-sample", "version": "0.1.0", "private": true, "source": "public/index.html", "scripts": { "start-client": "parcel watch", "start-server": "node server.js", "build": "parcel build", "start": "concurrently \"yarn start-client\" \"yarn start-server\"" }, "dependencies": { "@stripe/connect-js": "3.3.13", "express": "^4.17.1", "stripe": "20.1.0", "vue": "^3.2.38", "vue-router": "4" }, "devDependencies": { "@parcel/transformer-vue": "^2.9.3", "concurrently": "4.1.2", "parcel": "^2.9.3" }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] } } { "name": "stripe-sample", "version": "0.1.0", "private": true, "scripts": { "start": "parcel watch", "build": "parcel build" }, "source": "public/index.html", "dependencies": { "@stripe/connect-js": "3.3.13", "vue": "^3.2.38", "vue-router": "4" }, "devDependencies": { "@parcel/transformer-vue": "^2.9.3", "parcel": "^2.9.3" }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] } } import Refresh from './components/Refresh.vue' import Return from './components/Return.vue' { path: '/refresh/:account', name: 'refresh', component: Refresh }, { path: '/return/:account', name: 'return', component: Return }

Rocket Rides

Rocket Rides is the world's leading air travel platform: join our team of pilots to help people travel faster.

fetch("/account_link.php", { fetch("/account_link", { \# Replace this placeholder with your publishable key from https://dashboard.stripe.com/test/apikeys VUE_APP_STRIPE_PUBLISHABLE_KEY=pk_INSERT_YOUR_PUBLISHABLE_KEY

Rocket Rides

Rocket Rides is the world's leading air travel platform: join our team of pilots to help people travel faster.

Rocket Rides partners with Stripe to help you receive payments while keeping your personal and bank details secure.

Your onboarding flow goes here

createAccount() { this.accountCreatePending = true; this.error = false; fetch("/account.php", { fetch("/account", { method: "POST", }).then((response) => response.json().then((json) => { this.accountCreatePending = false; this.connectedAccountId = json.account; }) ); }, updateAccount() { this.accountUpdatePending = true; this.error = false; fetch(`/account.php`, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ account: this.connectedAccountId, }), }) fetch(`/account/${this.connectedAccountId}`, { method: "POST", }) .then((response) => response.json().then((json) => { this.accountUpdatePending = false; this.connectedAccountUpdated = true; }) ); },

Rocket Rides

Rocket Rides is the world's leading air travel platform: join our team of pilots to help people travel faster.

createAccount() { this.accountCreatePending = true; this.error = false; fetch("/account.php", { fetch("/account", { method: "POST", }).then((response) => response.json().then((json) => { this.accountCreatePending = false; this.connectedAccountId = json.account; const fetchClientSecret = async () => { const response = await fetch("/account_session.php", { const response = await fetch("/account_session", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ account: this.connectedAccountId, }), }); if (!response.ok) { // Handle errors on the client side here const { error } = await response.json(); throw new Error("An error occurred: " + error); } else { const { client_secret: clientSecret } = await response.json(); return clientSecret; } }; this.stripeConnectInstance = loadConnectAndInitialize({ publishableKey: process.env.VUE_APP_STRIPE_PUBLISHABLE_KEY, fetchClientSecret, appearance: { overlays: "dialog", variables: { colorPrimary: "#635BFF", }, }, }); const container = document.getElementById("embedded-onboarding-container"); const embeddedOnboardingComponent = this.stripeConnectInstance.create("account-onboarding"); embeddedOnboardingComponent.setOnExit(() => { console.log('User exited the onboarding flow'); }); container.appendChild(embeddedOnboardingComponent); }) ); },

Rocket Rides

Rocket Rides is the world's leading air travel platform: join our team of pilots to help people travel faster.

Rocket Rides partners with Stripe to help you receive payments while keeping your personal and bank details secure.

createAccount() { this.accountCreatePending = true; this.error = false; fetch("/account.php", { fetch("/account", { method: "POST", }).then((response) => response.json().then((json) => { this.accountCreatePending = false; this.connectedAccountId = json.account; }) ); }, createAccountLink() { this.accountLinkCreatePending = true; this.error = false; fetch("/account_link.php", { fetch("/account_link", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ account: this.connectedAccountId, }), }).then((response) => response.json().then((json) => { this.accountLinkCreatePending = false; const { url, error } = json; if (url) { window.location.href = url; } if (error) { this.error = true; } }) ); }, margin-top: 0; margin-bottom: 80px; margin: 0; background-color: #635BFF; color: #ffffff; .example-form { height: 400px; width: 420px; display: flex; flex-direction: column; justify-content: center; align-items: center; border: 1px dashed black; padding: 0; } background-color: #635BFF; color: #ffffff; - pk_INSERT_YOUR_PUBLISHABLE_KEY 1. Build the server ~~~ pip3 install -r requirements.txt ~~~ 2. Run the server ~~~ FLASK_APP=server.py python3 -m flask run --port=4242 ~~~ 1. Build the server ~~~ bundle install ~~~ 2. Run the server ~~~ ruby server.rb -o 0.0.0.0 ~~~ 1. Build the server ~~~ composer install ~~~ 2. Run the server ~~~ php -S 127.0.0.1:4242 --docroot=dist ~~~ 1. Build the server ~~~ dotnet restore ~~~ 2. Run the server ~~~ dotnet run ~~~ 1. Build the server ~~~ mvn package ~~~ 2. Run the server ~~~ java -cp target/sample-jar-with-dependencies.jar com.stripe.sample.Server ~~~ 1. Install the dependencies ~~ go mod download github.com/stripe/stripe-go/v85 go mod download github.com/gorilla/mux ~~ 2. Run the server ~~~ go run server.go ~~~ 3. Build the client app ~~~ npm install ~~~ 4. Run the client app ~~~ npm start ~~~ 5. Go to [http://localhost:4242](http://localhost:4242) 1. Build the application ~~~ npm install ~~~ 2. Run the application ~~~ npm start ~~~ 3. Go to [http://localhost:4242/index.html](http://localhost:4242/index.html) 1. Build the application ~~~ npm install ~~~ 2. Run the application ~~~ npm run dev ~~~ 3. Go to [localhost:4242](http://localhost:4242) ### Stripe Node ライブラリをインストールする パッケージをインストールし、それをコードにインポートします。また、まったくゼロから開始していて `package.json` ファイルが必要な場合は、コードエディター内のダウンロードリンクを使用してプロジェクトファイルをダウンロードします。 #### npm ライブラリをインストールします。 ```bash npm install --save stripe@20.1.0 ``` #### GitHub stripe-node ライブラリのソースコードを [GitHub から](https://github.com/stripe/stripe-node/releases/tag/v20.1.0)直接ダウンロードします。 ### Stripe Ruby ライブラリをインストールする Stripe Ruby gem をインストールし、コードから要求します。また、まったくゼロから開始していて Gemfile が必要な場合は、コードエディター内のリンクを使用してプロジェクトファイルをダウンロードします。 #### Terminal gem をインストールします。 ```bash gem install stripe -v 18.1.0 ``` #### Bundler この行を Gemfile に追加します。 ```bash gem 'stripe', '18.1.0' ``` #### GitHub stripe-ruby gem ソースコードを [GitHub から](https://github.com/stripe/stripe-ruby/releases/tag/v18.1.0)直接ダウンロードします。 ### Stripe Java ライブラリをインストールする ビルドに依存関係を追加し、ライブラリをインポートします。まったくゼロから開始していてサンプルの `pom.xml` ファイル (Maven 用) が必要な場合は、コードエディター内のリンクを使用してプロジェクトファイルをダウンロードします。 #### Maven POM に次の依存関係を追加します。 ```bash \ncom.stripe\nstripe-java\n31.1.0\n ``` #### Gradle `build.gradle` ファイルに依存関係を追加します。 ```bash implementation "com.stripe:stripe-java:31.1.0" ``` #### GitHub JAR を [GitHub から](https://github.com/stripe/stripe-java/releases/tag/v31.1.0)直接ダウンロードします。 ### Stripe Python パッケージをインストールする Stripe パッケージをインストールし、コードにインポートします。まったくゼロから開始していて `requirements.txt` ファイルが必要な場合は、コードエディター内のリンクを使用してプロジェクトファイルをダウンロードします。 #### pip pip を使用してパッケージをインストールします。 ```bash pip3 install stripe==14.1.0 ``` #### GitHub stripe-python ライブラリのソースコードを [GitHub から](https://github.com/stripe/stripe-python/releases/tag/v14.1.0)直接ダウンロードします。 ### Stripe PHP ライブラリをインストールする コンポーザーを使用してライブラリをインストールし、シークレット API キーで初期化します。まったくゼロから開始していて `composer.json` ファイルが必要な場合には、コードエディター内のリンクを使用してファイルをダウンロードします。 #### Composer ライブラリをインストールします。 ```bash composer require stripe/stripe-php:19.1.0 ``` #### GitHub stripe-php ライブラリのソースコードを [GitHub から](https://github.com/stripe/stripe-php/releases/tag/v19.1.0)直接ダウンロードします。 ### Stripe Go ライブラリをインストールする ビルドに依存関係を追加し、ライブラリをインポートします。まったくゼロから開始していて `go.mod` ファイルが必要な場合には、コードエディター内のリンクを使用してプロジェクトファイルをダウンロードします。 #### Go 必ず Go モジュールを使用して初期化してください。 ```bash go get -u github.com/stripe/stripe-go/v85.0.0 ``` #### GitHub [GitHub から ](https://github.com/stripe/stripe-go/releases/tag/v85.0.0)stripe-go モジュールのソースコードを直接ダウンロードします。 ### Stripe.net ライブラリをインストールする .NET または NuGet でパッケージをインストールします。まったくゼロから開始する場合には、設定済みの `.csproj` ファイルが含まれるファイルをダウンロードします。 #### dotnet ライブラリをインストールします。 ```bash dotnet add package Stripe.net --version 50.1.0 ``` #### NuGet ライブラリをインストールします。 ```bash Install-Package Stripe.net -Version 50.1.0 ``` #### GitHub Stripe.net ライブラリのソースコードを [GitHub から](https://github.com/stripe/stripe-dotnet/releases/tag/v50.1.0)直接ダウンロードします。 ### Stripe ライブラリをインストールする パッケージをインストールし、コードにインポートします。まったくゼロから開始していて `package.json` ファイルが必要な場合には、コードエディター内のリンクを使用してプロジェクトファイルをダウンロードします。 ライブラリをインストールして、正しいベータヘッダーで Stripe SDK を初期化します。 ```bash npm install --save stripe@20.1.0 ``` ### 概要 Connect の実装内容は、連結アカウントの作成方法によって大きく変わります。Stripe は、Connect へのプラットフォームアカウント登録時に、お客様の選択に基づいて連結アカウントのプロパティをカスタマイズします。ここで加えた変更はプラットフォームの設定を更新するものではなく、ダッシュボードには反映されません。 これらの選択について詳しくは[連携の設計](https://docs.stripe.com/connect/interactive-platform-guide.md)をご覧ください。 ### 連結アカウントが Stripe にアカウント登録する方法を選択する 選択したアカウント登録方法は、下記の他のアカウントオプションを利用できるかどうかに影響します。 #### Item 1 Account Link を使用して、連結アカウントを Stripe がオンラインで提供するアカウント登録にリダイレクトします。 #### Item 2 ### 連結アカウントが Stripe にアカウント登録する方法を選択する 選択したアカウント登録方法は、下記の他のアカウントオプションを利用できるかどうかに影響します。 #### Item 1 プラットフォームのアプリケーションにアカウント登録の埋め込みコンポーネントを埋め込みます。 #### Item 2 ### 連結アカウントが Stripe にアカウント登録する方法を選択する 選択したアカウント登録方法は、下記の他のアカウントオプションを利用できるかどうかに影響します。 #### Item 1 自社で構築したアカウント登録フローで Stripe API を使用して、連結アカウントに本人確認情報を提供します。要件が変更されるか、期日を迎えたときは、プラットフォームが更新された情報を収集する責任を負います。 API によるアカウント登録フローを構築して維持するには複雑な作業が必要になります。その複雑さを十分に認識し責任を持って取り組む決意がない場合、このオプションはお勧めしません。カスタマイズしたアカウント登録フローの場合は、埋め込みアカウント登録を強くお勧めします。 #### Item 2 ### 連結アカウントが支払いとアカウントの詳細を管理する場所を選択する #### Item 1 連結アカウントに Stripe ダッシュボードへのアクセスを許可します。 #### Item 2 ### 連結アカウントが支払いとアカウントの詳細を管理する場所を選択する #### Item 1 連結アカウントに Express ダッシュボードへのアクセスを許可します。 #### Item 2 ### 連結アカウントが支払いとアカウントの詳細を管理する場所を選択する #### Item 1 Stripe API と [Connect の埋め込み型コンポーネント](https://docs.stripe.com/connect/get-started-connect-embedded-components.md)を使用して、連結アカウントのアカウント管理インターフェイスを構築します。 #### Item 2 ### 支払いタイプを選択する #### Item 1 連結アカウントで直接支払いを作成します。 #### Item 2 ### 支払いタイプを選択する #### Item 1 プラットフォームアカウントでデスティネーション支払いを作成し、連結アカウントに売上を送金します。連結アカウントの `transfers` ケイパビリティをリクエストします。 #### Item 2 ### 支払いタイプを選択する #### Item 1 プラットフォームアカウントでデスティネーション支払いを作成し、連結アカウントに売上を送金します。 #### Item 2 ### 支払いタイプを選択する #### Item 1 プラットフォームアカウントで支払いを作成し、各金額を複数の連結アカウントに分割します。連結アカウントの `transfers` ケイパビリティをリクエストします。 #### Item 2 ### 支払いタイプを選択する #### Item 1 プラットフォームアカウントで支払いを作成し、各金額を複数の連結アカウントに分割します。 #### Item 2 ### 手数料の負担者を選択する #### Item 1 Stripe は連結アカウントから Stripe 手数料を回収します。 #### Item 2 ### 手数料の負担者を選択する #### Item 1 Stripe はお客様のプラットフォームから Stripe 手数料を回収します。プラットフォームは、プラットフォーム手数料を使用して支払いを収益化できます。 #### Item 2 ### マイナス残高の責任者を選択する #### Item 1 プラットフォームはマイナスのアカウント残高に対する責任を負いません。要件が期限切れになるか、変更されたときは、Stripe が更新された情報を収集する責任を負います。 #### Item 2 ### マイナス残高の責任者を選択する #### Item 1 プラットフォームはマイナスのアカウント残高に対して責任を負います。プラットフォームには、要件が期限切れになるか、変更されたときに更新された情報を収集する責任もあります。 この設定でアカウントを作成する前に、マイナス残高の負債に対するプラットフォームの責任を慎重に検討し、認識してください。 #### Item 2 ### マイナス残高の責任者を選択する #### Item 1 プラットフォームはマイナスのアカウント残高に対する責任を負います。要件が期限切れになるか、変更されたときは、Stripe が更新された情報を収集する責任を負います。 この設定でアカウントを作成する前に、マイナス残高の負債に対するプラットフォームの責任を慎重に検討し、認識してください。 #### Item 2 ### 連結アカウントを作成するためのエンドポイントを追加する クライアントが連結アカウントの作成を処理するために呼び出すエンドポイントをサーバーに設定します。 ### 連結アカウントを作成する Stripe API を呼び出して連結アカウントを作成します。使用する属性は、上記で選択した設定に基づいて設定されています。プラットフォームですでに収集されている場合は、[アカウント](https://docs.stripe.com/api/accounts/create.md)の確認情報、ユーザーのビジネスプロフィール、その他のフィールドを事前入力できます。 ### 連結アカウントを作成する Stripe API を呼び出して連結アカウントを作成します。使用する属性は、上記で選択した設定に基づいて設定されています。プラットフォームですでに収集されている場合は、[アカウント](https://docs.stripe.com/api/v2/core/accounts/create.md)の確認情報、ユーザーの企業プロフィール、その他のフィールドを事前入力できます。 ### アカウントの国を指定する アカウントが Stripe がオンラインで提供するダッシュボードを使用しないときは、アカウントの国を事前に指定する必要があります。 ### アカウントの国を指定する アカウントの `identity.country` を事前に指定する必要があります。 ### エンドポイントを呼び出して、連結アカウントを作成する 上記で追加したエンドポイントを呼び出し、連結アカウントを作成します。 ### 概要 [設定の選択](https://docs.stripe.com/connect/onboarding/quickstart.md#choose-onboarding-surface)について、お客様は埋込型アカウント登録を選択しました。アプリケーションに直接埋め込まれたアカウント登録コンポーネントを使用して、連結アカウントをプラットフォームに登録します。 ### アカウントセッションを作成するためのエンドポイントを追加する クライアントが AccountSession を作成するために呼び出すサーバーエンドポイントを追加します。AccountSession を使用すると、Connect.js 埋め込みコンポーネントを使用できます。 ### AccountSession を作成する `v1/account_sessions` APIを呼び出して [AccountSession](https://docs.stripe.com/api/account_sessions.md) を作成します。 ### 連結アカウントに API アクセスを委任する 代理で操作している連結アカウントの ID を指定します。 ### アカウント登録コンポーネントを有効にする AccountSession の `account_onboarding` コンポーネントを有効にします。 ### client secret を返す エンドポイントで AccountSession から `client_secret` プロパティを返すようにします。 ### Connect.js を初期化する `loadConnectAndInitialize` は StripeConnect オブジェクトを返します。このオブジェクトは StripeConnectInstance を作成します。[公開可能キー](https://docs.stripe.com/keys.md)と、AccountSession を作成して `client_secret` を返す関数を渡します。 ### オプション: Connect の埋め込みコンポーネントのスタイルを設定する StripeConnect インスタンスの初期化時に `appearance` 設定を渡すことで、[アカウント登録コンポーネントのデザインをカスタマイズ](https://docs.stripe.com/connect/customize-connect-embedded-components.md)できます。デフォルトでは、Connect 埋め込みコンポーネントは親の HTML 要素のフォントファミリーを継承しますが、会社のカラースキームを渡すことで上書きできます。 ### Connect アカウント登録の埋め込みコンポーネントを含める Connect アカウント登録の埋め込みコンポーネントを追加します。初期化後は、StripeConnectInstance が、client secret と公開可能キーを使用して、コンテキストを管理し、 Stripe に対するリクエストを処理します。 ### アカウント登録の完了時にユーザーをリダイレクトする `onExit` コールバックを使用して、ユーザーを次のステップに進めます。ユーザーが埋め込みアカウント登録を完了すると、コンポーネントによって `onExit` が呼び出されます。 ### 概要 [設定の選択](https://docs.stripe.com/connect/onboarding/quickstart.md#choose-onboarding-surface)について、Stripe 上のオンラインアカウント登録を選択しました。プラットフォームは、[Account Link](https://docs.stripe.com/api/account_links.md) を使用して、Stripe 上のオンラインブランド提携アカウント登録インターフェイスに連結アカウントをリダイレクトします。 ### 概要 [選択された設定](https://docs.stripe.com/connect/onboarding/quickstart.md#choose-onboarding-surface)のとおり、Stripe がホストするユーザー登録を選択しました。貴社プラットフォームは、[Account Link](https://docs.stripe.com/api/v2/core/account-links.md)を使用して、連結アカウントを Stripe がホストする提携ブランドのユーザー登録インターフェイスにリダイレクトします。 ### アカウントリンクのエンドポイントを作成する サーバーにエンドポイントを追加して、アカウントリンクを作成します。 ### 戻り先 URL を指定する 連結アカウントは、アカウント登録フローを完了すると、戻り URL にリダイレクトされます。これは、すべての情報が収集されたことや、連結アカウントに未対応の要件がないことを意味するものではありません。顧客が適切にフローを開始して終了したことを意味するにすぎません。 ### 再読み込み URL を指定する リンクの有効期限が切れている、リンクがすでにアクセスされている、プラットフォームが連結アカウントにアクセスできない、あるいはアカウントが拒否された場合、Stripe は連結アカウントを更新 URL にリダイレクトします。再読み込み URL で新しいアカウント登録のアカウントリンクを作成し、ユーザーをそこにリダイレクトしてください。 ### アカウントリンクを作成するためのエンドポイントを呼び出す 連結アカウントの ID を入力します。 ### ユーザーを URL にリダイレクトする ユーザーを Stripe に送信して、アカウント登録を完了させます。ユーザーは、アカウント登録の完了時にアプリにリダイレクトされます。 ### 連結アカウントの返品を処理する 連結アカウントが Stripe がオンラインで提供するアカウント登録フローを終了する際に、有益なページを表示します。 ### アカウントリンクの再読み込みを処理する 再読み込み URL でアカウントリンクを更新するためのエンドポイントを呼び出します。 ### 概要 [設定の選択](https://docs.stripe.com/connect/onboarding/quickstart.md#choose-onboarding-surface)について、お客様は API アカウント登録を選択しました。連結アカウントは、お客様が構築した、Stripe API を呼び出すアカウント登録フローを使用してプラットフォームに登録されます。プラットフォームが、必要なすべての本人確認情報を収集します。 ### アカウントを更新するためのエンドポイントを追加する このエンドポイントを呼び出して、アカウント情報を収集するときに Stripe にアカウント情報を提供します。 ### Stripeに情報を提供する データの例としてビジネスのタイプを指定します。 ### エンドポイントを呼び出してアカウントを更新する 連結アカウントの ID を入力します。 ### アカウント登録フローを進める 収集が必要な[必須の情報](https://docs.stripe.com/connect/custom/onboarding.md#establish-requirements)を判断します。連結アカウントが情報を入力して Stripe に渡せるように、フローを構築します。 ### Stripe Node ライブラリをインストールする パッケージをインストールし、それをコードにインポートします。また、まったくゼロから開始していて `package.json` ファイルが必要な場合は、コードエディター内のダウンロードリンクを使用してプロジェクトファイルをダウンロードします。 #### npm ライブラリをインストールします。 ```bash npm install --save stripe@20.1.0 ``` #### GitHub stripe-node ライブラリのソースコードを [GitHub から](https://github.com/stripe/stripe-node/releases/tag/v20.1.0)直接ダウンロードします。 ### Stripe Ruby ライブラリをインストールする Stripe Ruby gem をインストールし、コードから要求します。また、まったくゼロから開始していて Gemfile が必要な場合は、コードエディター内のリンクを使用してプロジェクトファイルをダウンロードします。 #### Terminal gem をインストールします。 ```bash gem install stripe -v 18.1.0 ``` #### Bundler この行を Gemfile に追加します。 ```bash gem 'stripe', '18.1.0' ``` #### GitHub stripe-ruby gem ソースコードを [GitHub から](https://github.com/stripe/stripe-ruby/releases/tag/v18.1.0)直接ダウンロードします。 ### Stripe Java ライブラリをインストールする ビルドに依存関係を追加し、ライブラリをインポートします。まったくゼロから開始していてサンプルの `pom.xml` ファイル (Maven 用) が必要な場合は、コードエディター内のリンクを使用してプロジェクトファイルをダウンロードします。 #### Maven POM に次の依存関係を追加します。 ```bash \ncom.stripe\nstripe-java\n31.1.0\n ``` #### Gradle `build.gradle` ファイルに依存関係を追加します。 ```bash implementation "com.stripe:stripe-java:31.1.0" ``` #### GitHub JAR を [GitHub から](https://github.com/stripe/stripe-java/releases/tag/v31.1.0)直接ダウンロードします。 ### Stripe Python パッケージをインストールする Stripe パッケージをインストールし、コードにインポートします。まったくゼロから開始していて `requirements.txt` ファイルが必要な場合は、コードエディター内のリンクを使用してプロジェクトファイルをダウンロードします。 #### pip pip を使用してパッケージをインストールします。 ```bash pip3 install stripe==14.1.0 ``` #### GitHub stripe-python ライブラリのソースコードを [GitHub から](https://github.com/stripe/stripe-python/releases/tag/v14.1.0)直接ダウンロードします。 ### Stripe PHP ライブラリをインストールする コンポーザーを使用してライブラリをインストールし、シークレット API キーで初期化します。まったくゼロから開始していて `composer.json` ファイルが必要な場合には、コードエディター内のリンクを使用してファイルをダウンロードします。 #### Composer ライブラリをインストールします。 ```bash composer require stripe/stripe-php:19.1.0 ``` #### GitHub stripe-php ライブラリのソースコードを [GitHub から](https://github.com/stripe/stripe-php/releases/tag/v19.1.0)直接ダウンロードします。 ### Stripe Go ライブラリをインストールする ビルドに依存関係を追加し、ライブラリをインポートします。まったくゼロから開始していて `go.mod` ファイルが必要な場合には、コードエディター内のリンクを使用してプロジェクトファイルをダウンロードします。 #### Go 必ず Go モジュールを使用して初期化してください。 ```bash go get -u github.com/stripe/stripe-go/v85.0.0 ``` #### GitHub [GitHub から ](https://github.com/stripe/stripe-go/releases/tag/v85.0.0)stripe-go モジュールのソースコードを直接ダウンロードします。 ### Stripe.net ライブラリをインストールする .NET または NuGet でパッケージをインストールします。まったくゼロから開始する場合には、設定済みの `.csproj` ファイルが含まれるファイルをダウンロードします。 #### dotnet ライブラリをインストールします。 ```bash dotnet add package Stripe.net --version 50.1.0 ``` #### NuGet ライブラリをインストールします。 ```bash Install-Package Stripe.net -Version 50.1.0 ``` #### GitHub Stripe.net ライブラリのソースコードを [GitHub から](https://github.com/stripe/stripe-dotnet/releases/tag/v50.1.0)直接ダウンロードします。 ### Stripe ライブラリをインストールする パッケージをインストールし、コードにインポートします。まったくゼロから開始していて `package.json` ファイルが必要な場合には、コードエディター内のリンクを使用してプロジェクトファイルをダウンロードします。 ライブラリをインストールして、正しいベータヘッダーで Stripe SDK を初期化します。 ```bash npm install --save stripe@20.1.0 ``` ### シークレットキーを設定する シークレットキーをサーバーに追加します。 ### 環境変数を設定する シークレットキーと公開可能キーを `.env` ファイルに追加します。 Next.js はそれらを[環境変数](https://nextjs.org/docs/basic-features/environment-variables)としてアプリケーションに自動的に読み込みます。 ### 環境変数を設定する シークレットキーを `.env` ファイルに追加します。 Next.js はそれを[環境変数](https://nextjs.org/docs/basic-features/environment-variables)としてアプリケーションに自動的に読み込みます。 ### 公開可能キーを設定する 公開可能キーを `.env` ファイルを追加します。このキーは React によって自動的に[環境変数](https://create-react-app.dev/docs/adding-custom-environment-variables/)としてアプリケーションに読み込まれます。 ### Connect.js を設定する [@stripe/connect-js](https://github.com/stripe/connect-js) モジュールをインポートします。 #### npm ライブラリをインストールします。 ```bash npm install --save @stripe/connect-js ``` #### GitHub @stripe/connect-js ライブラリのソースコードを [GitHub から](https://github.com/stripe/connect-js)直接ダウンロードします 。 ### React Connect.js をインポートする [@stripe/react-connect-js](https://github.com/stripe/react-connect-js) モジュールをインポートします。React Connect.js は、埋め込みコンポーネントを任意の React アプリに追加できるようにする、Connect の埋め込みコンポーネントを囲む薄いラッパーです。 #### npm ライブラリをインストールします。 ```bash npm install --save @stripe/react-connect-js ``` #### GitHub [GitHub から](https://github.com/stripe/react-connect-js)直接、@stripe/react-connect-js ライブラリのソースコードをダウンロードします。 ### プラットフォームブランディングを追加する Stripe がオンラインで提供するアカウント登録を使用するには、まず[アカウント登録の設定](https://dashboard.stripe.com/settings/connect/onboarding-interface)にアクセスして、ブランディングをカスタマイズしてください。ビジネス名、アイコン、ブランドカラーを設定する必要があります。 ### 概要 Connect の実装内容は、連結アカウントの作成方法によって大きく変わります。Stripe は、Connect へのプラットフォームアカウント登録時に、お客様の選択に基づいて連結アカウントのプロパティをカスタマイズします。ここで加えた変更はプラットフォームの設定を更新するものではなく、ダッシュボードには反映されません。 これらの選択について詳しくは[連携の設計](https://docs.stripe.com/connect/interactive-platform-guide.md)をご覧ください。 ### 連結アカウントが Stripe にアカウント登録する方法を選択する 選択したアカウント登録方法は、下記の他のアカウントオプションを利用できるかどうかに影響します。 #### Item 1 Account Link を使用して、連結アカウントを Stripe がオンラインで提供するアカウント登録にリダイレクトします。 #### Item 2 ### 連結アカウントが Stripe にアカウント登録する方法を選択する 選択したアカウント登録方法は、下記の他のアカウントオプションを利用できるかどうかに影響します。 #### Item 1 プラットフォームのアプリケーションにアカウント登録の埋め込みコンポーネントを埋め込みます。 #### Item 2 ### 連結アカウントが Stripe にアカウント登録する方法を選択する 選択したアカウント登録方法は、下記の他のアカウントオプションを利用できるかどうかに影響します。 #### Item 1 自社で構築したアカウント登録フローで Stripe API を使用して、連結アカウントに本人確認情報を提供します。要件が変更されるか、期日を迎えたときは、プラットフォームが更新された情報を収集する責任を負います。 API によるアカウント登録フローを構築して維持するには複雑な作業が必要になります。その複雑さを十分に認識し責任を持って取り組む決意がない場合、このオプションはお勧めしません。カスタマイズしたアカウント登録フローの場合は、埋め込みアカウント登録を強くお勧めします。 #### Item 2 ### 連結アカウントが支払いとアカウントの詳細を管理する場所を選択する #### Item 1 連結アカウントに Stripe ダッシュボードへのアクセスを許可します。 #### Item 2 ### 連結アカウントが支払いとアカウントの詳細を管理する場所を選択する #### Item 1 連結アカウントに Express ダッシュボードへのアクセスを許可します。 #### Item 2 ### 連結アカウントが支払いとアカウントの詳細を管理する場所を選択する #### Item 1 Stripe API と [Connect の埋め込み型コンポーネント](https://docs.stripe.com/connect/get-started-connect-embedded-components.md)を使用して、連結アカウントのアカウント管理インターフェイスを構築します。 #### Item 2 ### 支払いタイプを選択する #### Item 1 連結アカウントで直接支払いを作成します。 #### Item 2 ### 支払いタイプを選択する #### Item 1 プラットフォームアカウントでデスティネーション支払いを作成し、連結アカウントに売上を送金します。連結アカウントの `transfers` ケイパビリティをリクエストします。 #### Item 2 ### 支払いタイプを選択する #### Item 1 プラットフォームアカウントでデスティネーション支払いを作成し、連結アカウントに売上を送金します。 #### Item 2 ### 支払いタイプを選択する #### Item 1 プラットフォームアカウントで支払いを作成し、各金額を複数の連結アカウントに分割します。連結アカウントの `transfers` ケイパビリティをリクエストします。 #### Item 2 ### 支払いタイプを選択する #### Item 1 プラットフォームアカウントで支払いを作成し、各金額を複数の連結アカウントに分割します。 #### Item 2 ### 手数料の負担者を選択する #### Item 1 Stripe は連結アカウントから Stripe 手数料を回収します。 #### Item 2 ### 手数料の負担者を選択する #### Item 1 Stripe はお客様のプラットフォームから Stripe 手数料を回収します。プラットフォームは、プラットフォーム手数料を使用して支払いを収益化できます。 #### Item 2 ### マイナス残高の責任者を選択する #### Item 1 プラットフォームはマイナスのアカウント残高に対する責任を負いません。要件が期限切れになるか、変更されたときは、Stripe が更新された情報を収集する責任を負います。 #### Item 2 ### マイナス残高の責任者を選択する #### Item 1 プラットフォームはマイナスのアカウント残高に対して責任を負います。プラットフォームには、要件が期限切れになるか、変更されたときに更新された情報を収集する責任もあります。 この設定でアカウントを作成する前に、マイナス残高の負債に対するプラットフォームの責任を慎重に検討し、認識してください。 #### Item 2 ### マイナス残高の責任者を選択する #### Item 1 プラットフォームはマイナスのアカウント残高に対する責任を負います。要件が期限切れになるか、変更されたときは、Stripe が更新された情報を収集する責任を負います。 この設定でアカウントを作成する前に、マイナス残高の負債に対するプラットフォームの責任を慎重に検討し、認識してください。 #### Item 2 ### Stripe Node ライブラリをインストールする パッケージをインストールし、それをコードにインポートします。また、まったくゼロから開始していて `package.json` ファイルが必要な場合は、コードエディター内のダウンロードリンクを使用してプロジェクトファイルをダウンロードします。 #### npm ライブラリをインストールします。 ```bash npm install --save stripe@20.1.0 ``` #### GitHub stripe-node ライブラリのソースコードを [GitHub から](https://github.com/stripe/stripe-node/releases/tag/v20.1.0)直接ダウンロードします。 ### Stripe Ruby ライブラリをインストールする Stripe Ruby gem をインストールし、コードから要求します。また、まったくゼロから開始していて Gemfile が必要な場合は、コードエディター内のリンクを使用してプロジェクトファイルをダウンロードします。 #### Terminal gem をインストールします。 ```bash gem install stripe -v 18.1.0 ``` #### Bundler この行を Gemfile に追加します。 ```bash gem 'stripe', '18.1.0' ``` #### GitHub stripe-ruby gem ソースコードを [GitHub から](https://github.com/stripe/stripe-ruby/releases/tag/v18.1.0)直接ダウンロードします。 ### Stripe Java ライブラリをインストールする ビルドに依存関係を追加し、ライブラリをインポートします。まったくゼロから開始していてサンプルの `pom.xml` ファイル (Maven 用) が必要な場合は、コードエディター内のリンクを使用してプロジェクトファイルをダウンロードします。 #### Maven POM に次の依存関係を追加します。 ```bash \ncom.stripe\nstripe-java\n31.1.0\n ``` #### Gradle `build.gradle` ファイルに依存関係を追加します。 ```bash implementation "com.stripe:stripe-java:31.1.0" ``` #### GitHub JAR を [GitHub から](https://github.com/stripe/stripe-java/releases/tag/v31.1.0)直接ダウンロードします。 ### Stripe Python パッケージをインストールする Stripe パッケージをインストールし、コードにインポートします。まったくゼロから開始していて `requirements.txt` ファイルが必要な場合は、コードエディター内のリンクを使用してプロジェクトファイルをダウンロードします。 #### pip pip を使用してパッケージをインストールします。 ```bash pip3 install stripe==14.1.0 ``` #### GitHub stripe-python ライブラリのソースコードを [GitHub から](https://github.com/stripe/stripe-python/releases/tag/v14.1.0)直接ダウンロードします。 ### Stripe PHP ライブラリをインストールする コンポーザーを使用してライブラリをインストールし、シークレット API キーで初期化します。まったくゼロから開始していて `composer.json` ファイルが必要な場合には、コードエディター内のリンクを使用してファイルをダウンロードします。 #### Composer ライブラリをインストールします。 ```bash composer require stripe/stripe-php:19.1.0 ``` #### GitHub stripe-php ライブラリのソースコードを [GitHub から](https://github.com/stripe/stripe-php/releases/tag/v19.1.0)直接ダウンロードします。 ### Stripe Go ライブラリをインストールする ビルドに依存関係を追加し、ライブラリをインポートします。まったくゼロから開始していて `go.mod` ファイルが必要な場合には、コードエディター内のリンクを使用してプロジェクトファイルをダウンロードします。 #### Go 必ず Go モジュールを使用して初期化してください。 ```bash go get -u github.com/stripe/stripe-go/v85.0.0 ``` #### GitHub [GitHub から ](https://github.com/stripe/stripe-go/releases/tag/v85.0.0)stripe-go モジュールのソースコードを直接ダウンロードします。 ### Stripe.net ライブラリをインストールする .NET または NuGet でパッケージをインストールします。まったくゼロから開始する場合には、設定済みの `.csproj` ファイルが含まれるファイルをダウンロードします。 #### dotnet ライブラリをインストールします。 ```bash dotnet add package Stripe.net --version 50.1.0 ``` #### NuGet ライブラリをインストールします。 ```bash Install-Package Stripe.net -Version 50.1.0 ``` #### GitHub Stripe.net ライブラリのソースコードを [GitHub から](https://github.com/stripe/stripe-dotnet/releases/tag/v50.1.0)直接ダウンロードします。 ### Stripe ライブラリをインストールする パッケージをインストールし、コードにインポートします。まったくゼロから開始していて `package.json` ファイルが必要な場合には、コードエディター内のリンクを使用してプロジェクトファイルをダウンロードします。 ライブラリをインストールして、正しいベータヘッダーで Stripe SDK を初期化します。 ```bash npm install --save stripe@20.1.0 ``` ### シークレットキーを設定する シークレットキーをサーバーに追加します。 ### 環境変数を設定する シークレットキーと公開可能キーを `.env` ファイルに追加します。 Next.js はそれらを[環境変数](https://nextjs.org/docs/basic-features/environment-variables)としてアプリケーションに自動的に読み込みます。 ### 環境変数を設定する シークレットキーを `.env` ファイルに追加します。 Next.js はそれを[環境変数](https://nextjs.org/docs/basic-features/environment-variables)としてアプリケーションに自動的に読み込みます。 ### 公開可能キーを設定する 公開可能キーを `.env` ファイルを追加します。このキーは React によって自動的に[環境変数](https://create-react-app.dev/docs/adding-custom-environment-variables/)としてアプリケーションに読み込まれます。 ### Connect.js を設定する [@stripe/connect-js](https://github.com/stripe/connect-js) モジュールをインポートします。 #### npm ライブラリをインストールします。 ```bash npm install --save @stripe/connect-js ``` #### GitHub @stripe/connect-js ライブラリのソースコードを [GitHub から](https://github.com/stripe/connect-js)直接ダウンロードします 。 ### React Connect.js をインポートする [@stripe/react-connect-js](https://github.com/stripe/react-connect-js) モジュールをインポートします。React Connect.js は、埋め込みコンポーネントを任意の React アプリに追加できるようにする、Connect の埋め込みコンポーネントを囲む薄いラッパーです。 #### npm ライブラリをインストールします。 ```bash npm install --save @stripe/react-connect-js ``` #### GitHub [GitHub から](https://github.com/stripe/react-connect-js)直接、@stripe/react-connect-js ライブラリのソースコードをダウンロードします。 ### プラットフォームブランディングを追加する Stripe がオンラインで提供するアカウント登録を使用するには、まず[アカウント登録の設定](https://dashboard.stripe.com/settings/connect/onboarding-interface)にアクセスして、ブランディングをカスタマイズしてください。ビジネス名、アイコン、ブランドカラーを設定する必要があります。 ### 連結アカウントを作成するためのエンドポイントを追加する クライアントが連結アカウントの作成を処理するために呼び出すエンドポイントをサーバーに設定します。 ### 連結アカウントを作成する Stripe API を呼び出して連結アカウントを作成します。使用する属性は、上記で選択した設定に基づいて設定されています。プラットフォームですでに収集されている場合は、[アカウント](https://docs.stripe.com/api/accounts/create.md)の確認情報、ユーザーのビジネスプロフィール、その他のフィールドを事前入力できます。 ### 連結アカウントを作成する Stripe API を呼び出して連結アカウントを作成します。使用する属性は、上記で選択した設定に基づいて設定されています。プラットフォームですでに収集されている場合は、[アカウント](https://docs.stripe.com/api/v2/core/accounts/create.md)の確認情報、ユーザーの企業プロフィール、その他のフィールドを事前入力できます。 ### アカウントの国を指定する アカウントが Stripe がオンラインで提供するダッシュボードを使用しないときは、アカウントの国を事前に指定する必要があります。 ### アカウントの国を指定する アカウントの `identity.country` を事前に指定する必要があります。 ### エンドポイントを呼び出して、連結アカウントを作成する 上記で追加したエンドポイントを呼び出し、連結アカウントを作成します。 ### 概要 [設定の選択](https://docs.stripe.com/connect/onboarding/quickstart.md#choose-onboarding-surface)について、お客様は埋込型アカウント登録を選択しました。アプリケーションに直接埋め込まれたアカウント登録コンポーネントを使用して、連結アカウントをプラットフォームに登録します。 ### アカウントセッションを作成するためのエンドポイントを追加する クライアントが AccountSession を作成するために呼び出すサーバーエンドポイントを追加します。AccountSession を使用すると、Connect.js 埋め込みコンポーネントを使用できます。 ### AccountSession を作成する `v1/account_sessions` APIを呼び出して [AccountSession](https://docs.stripe.com/api/account_sessions.md) を作成します。 ### 連結アカウントに API アクセスを委任する 代理で操作している連結アカウントの ID を指定します。 ### アカウント登録コンポーネントを有効にする AccountSession の `account_onboarding` コンポーネントを有効にします。 ### client secret を返す エンドポイントで AccountSession から `client_secret` プロパティを返すようにします。 ### Connect.js を初期化する `loadConnectAndInitialize` は StripeConnect オブジェクトを返します。このオブジェクトは StripeConnectInstance を作成します。[公開可能キー](https://docs.stripe.com/keys.md)と、AccountSession を作成して `client_secret` を返す関数を渡します。 ### オプション: Connect の埋め込みコンポーネントのスタイルを設定する StripeConnect インスタンスの初期化時に `appearance` 設定を渡すことで、[アカウント登録コンポーネントのデザインをカスタマイズ](https://docs.stripe.com/connect/customize-connect-embedded-components.md)できます。デフォルトでは、Connect 埋め込みコンポーネントは親の HTML 要素のフォントファミリーを継承しますが、会社のカラースキームを渡すことで上書きできます。 ### Connect アカウント登録の埋め込みコンポーネントを含める Connect アカウント登録の埋め込みコンポーネントを追加します。初期化後は、StripeConnectInstance が、client secret と公開可能キーを使用して、コンテキストを管理し、 Stripe に対するリクエストを処理します。 ### アカウント登録の完了時にユーザーをリダイレクトする `onExit` コールバックを使用して、ユーザーを次のステップに進めます。ユーザーが埋め込みアカウント登録を完了すると、コンポーネントによって `onExit` が呼び出されます。 ### 概要 [設定の選択](https://docs.stripe.com/connect/onboarding/quickstart.md#choose-onboarding-surface)について、Stripe 上のオンラインアカウント登録を選択しました。プラットフォームは、[Account Link](https://docs.stripe.com/api/account_links.md) を使用して、Stripe 上のオンラインブランド提携アカウント登録インターフェイスに連結アカウントをリダイレクトします。 ### 概要 [選択された設定](https://docs.stripe.com/connect/onboarding/quickstart.md#choose-onboarding-surface)のとおり、Stripe がホストするユーザー登録を選択しました。貴社プラットフォームは、[Account Link](https://docs.stripe.com/api/v2/core/account-links.md)を使用して、連結アカウントを Stripe がホストする提携ブランドのユーザー登録インターフェイスにリダイレクトします。 ### アカウントリンクのエンドポイントを作成する サーバーにエンドポイントを追加して、アカウントリンクを作成します。 ### 戻り先 URL を指定する 連結アカウントは、アカウント登録フローを完了すると、戻り URL にリダイレクトされます。これは、すべての情報が収集されたことや、連結アカウントに未対応の要件がないことを意味するものではありません。顧客が適切にフローを開始して終了したことを意味するにすぎません。 ### 再読み込み URL を指定する リンクの有効期限が切れている、リンクがすでにアクセスされている、プラットフォームが連結アカウントにアクセスできない、あるいはアカウントが拒否された場合、Stripe は連結アカウントを更新 URL にリダイレクトします。再読み込み URL で新しいアカウント登録のアカウントリンクを作成し、ユーザーをそこにリダイレクトしてください。 ### アカウントリンクを作成するためのエンドポイントを呼び出す 連結アカウントの ID を入力します。 ### ユーザーを URL にリダイレクトする ユーザーを Stripe に送信して、アカウント登録を完了させます。ユーザーは、アカウント登録の完了時にアプリにリダイレクトされます。 ### 連結アカウントの返品を処理する 連結アカウントが Stripe がオンラインで提供するアカウント登録フローを終了する際に、有益なページを表示します。 ### アカウントリンクの再読み込みを処理する 再読み込み URL でアカウントリンクを更新するためのエンドポイントを呼び出します。 ### 概要 [設定の選択](https://docs.stripe.com/connect/onboarding/quickstart.md#choose-onboarding-surface)について、お客様は API アカウント登録を選択しました。連結アカウントは、お客様が構築した、Stripe API を呼び出すアカウント登録フローを使用してプラットフォームに登録されます。プラットフォームが、必要なすべての本人確認情報を収集します。 ### アカウントを更新するためのエンドポイントを追加する このエンドポイントを呼び出して、アカウント情報を収集するときに Stripe にアカウント情報を提供します。 ### Stripeに情報を提供する データの例としてビジネスのタイプを指定します。 ### エンドポイントを呼び出してアカウントを更新する 連結アカウントの ID を入力します。 ### アカウント登録フローを進める 収集が必要な[必須の情報](https://docs.stripe.com/connect/custom/onboarding.md#establish-requirements)を判断します。連結アカウントが情報を入力して Stripe に渡せるように、フローを構築します。 ### 決済を受け付ける 連結アカウントのアカウント登録が完了したので、次に[ダイレクト支払いを作成します](https://docs.stripe.com/connect/direct-charges.md)。 ### 決済を受け付ける 連結アカウントのアカウント登録が完了したので、次に[デスティネーション支払いを作成します](https://docs.stripe.com/connect/destination-charges.md)。 ### 決済を受け付ける 連結アカウントのアカウント登録が完了したので、次に[支払いと送金別方式を作成します](https://docs.stripe.com/connect/separate-charges-and-transfers.md)。 ### API アカウント登録の構築を続ける [必要な確認情報](https://docs.stripe.com/connect/required-verification-information.md)のドキュメントを使用して、連結アカウントがアカウント登録を完了させるための方法を構築します。次に、[ダイレクト支払いを作成します](https://docs.stripe.com/connect/direct-charges.md)。 ### API アカウント登録の構築を続ける [必要な確認情報](https://docs.stripe.com/connect/required-verification-information.md)のドキュメントを使用して、連結アカウントがアカウント登録を完了させるための方法を構築します。次に、[デスティネーション支払いを作成します](https://docs.stripe.com/connect/destination-charges.md)。 ### API アカウント登録の構築を続ける [必要な確認情報](https://docs.stripe.com/connect/required-verification-information.md)のドキュメントを使用して、連結アカウントがアカウント登録を完了させるための方法を構築します。次に、[支払いと送金別方式を作成します](https://docs.stripe.com/connect/separate-charges-and-transfers.md)。