コンテンツにスキップ
アカウントを作成
または
サインイン
Stripe ドキュメントのロゴ
/
AI に質問する
アカウントを作成
サインイン
始める
支払い
財務の自動化
プラットフォームおよびマーケットプレイス
資金管理
開発者向けのツール
始める
支払い
財務の自動化
始める
支払い
財務の自動化
プラットフォームおよびマーケットプレイス
資金管理
概要
Connect の使用を開始
導入の基本
導入の例
アカウント登録
アカウントのダッシュボードを設定する
    Connect の埋め込みコンポーネントの使用を開始
      クイックスタート
    Connect の埋め込みコンポーネントをカスタマイズ
    対応可能な Connect の埋め込みコンポーネント
    Stripe ダッシュボードのカスタマイズ
    Stripe ダッシュボードアカウントのプラットフォーム制御
    Express ダッシュボード
決済を受け付ける
アカウントへの送金
Connect プラットフォームを管理
Connect プラットフォームの納税申告書
連結アカウントのタイプの操作
ホームプラットフォームおよびマーケットプレイスConfigure account Dashboards

注

このページはまだ日本語ではご利用いただけません。より多くの言語で文書が閲覧できるように現在取り組んでいます。準備が整い次第、翻訳版を提供いたしますので、もう少しお待ちください。

Connect の埋め込みコンポーネントの使用を開始する

ダッシュボードの機能をウェブサイトに埋め込む方法をご紹介します。

ページをコピー

Connect の埋め込みコンポーネントを使用して、連結アカウントのダッシュボード機能をウェブサイトに追加します。これらのライブラリとサポートする API を使用することで、ダッシュボードから Stripe 製品に直接アクセスできる許可をユーザーに付与できます。

プライベートプレビュー

The iOS SDK is currently available with invite only and has the following limitations:

  • Only accounts where controller.requirement_collection is application, such as Custom connected accounts, are supported.
  • ユーザー認証はサポートされていないため、アカウントセッションの作成時にすべてのコンポーネントのサーバーエンドポイントで features.disable_stripe_user_authentication を true に設定する必要があります。

招待をご希望の場合は、以下のフォームにメールアドレスを入力してください。

StripeConnect を設定する
クライアント側
サーバー側

Stripe は AccountSession を使用して、API アクセスを連結アカウントに委任する意図を表します。

AccountSessions API は Client Secret を返し、ウェブクライアントの埋め込みコンポーネントが、まるでユーザーが API コールを行っているかのように連結アカウントのリソースにアクセスできるようにします。

AccountSession を作成する サーバー

アプリは、アカウントセッションを取得するリクエストをサーバーに対して開始する必要があります。Client Secret をアプリに返す新しいエンドポイントをサーバー上に作成できます。

main.rb
Ruby
require 'sinatra' 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. Stripe.api_key =
'sk_test_BQokikJOvBiI2HlWgH4olfQ2'
post '/account_session' do content_type 'application/json' # Create an AccountSession begin account_session = Stripe::AccountSession.create({ account:
'{{CONNECTED_ACCOUNT_ID}}'
, components: { account_onboarding: { enabled: true, features: { # Authentication must be disabled for the mobile SDK disable_stripe_user_authentication: 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

注意

ユーザー認証はサポートされていないため、アカウントセッションの作成時にすべてのコンポーネントのサーバーエンドポイントで features.disable_stripe_user_authentication を true に設定する必要があります。

Create Account Session API

The Create Account Session API determines component and feature access for Connect embedded components. Stripe enforces these parameters for any components that correspond to the account session. If your app supports multiple user roles, make sure components and features that are enabled for that account session correspond to the current user’s role. For example, you can enable refund management only for administrators of your site, but not for other users. To make sure user role access are enforced, you must map your site’s user role to account session components.

StripeConnect SDK をインストールする クライアント

Stripe iOS SDK はオープンソースです。詳細なドキュメントが提供されており、iOS 15 以降をサポートするアプリと互換性があります。

SDK をインストールするには、以下のステップに従います。

  1. In Xcode, select File > Add Package Dependencies… and enter https://github.com/stripe/stripe-ios-spm as the repository URL.
  2. リリースページから最新のバージョン番号を選択します。
  3. StripeConnect 製品をアプリのターゲットに追加します。

注

For details on the latest SDK release and past versions, see the Releases page on GitHub. To receive notifications when a new release is published, watch releases for the repository.

カメラ認証を設定する クライアント側

Stripe Connect iOS SDK では、本人確認書類をキャプチャーするためにデバイスのカメラにアクセスする必要があります。アプリからカメラへのアクセスの許可をリクエストできるようにするには、次の操作を行います。

  1. Xcode で、プロジェクトの Info.plist を開きます。
  2. NSCameraUsageDescription キーを追加します。
  3. アプリにカメラへのアクセスの許可が必要な理由をユーザーに説明する文字列値を追加します。

このアプリは、カメラを使用して本人確認書類の写真を撮影します。

カメラ認証のリクエストについて、詳細は Apple のドキュメントを参照してください。

Initialize EmbeddedComponentManager クライアント

Set your publishable key using StripeAPI.shared and instantiate an EmbeddedComponentManager with a closure that retrieves a client secret by calling the new endpoint you created on your server. To create a component, call the appropriate create method on the EmbeddedComponentManager that you instantiated above. This returns a controller that you can use to present it in the app.

MyViewController.swift
@_spi(PrivateBetaConnect) import StripeConnect import UIKit class MyViewController: UIViewController { let errorView: UIView func fetchClientSecret() async -> String? { let url = URL(string: "https://{{YOUR_SERVER}}/account_session")! var request = URLRequest(url: url) request.httpMethod = "POST" do { // Fetch the AccountSession client secret let (data, _) = try await URLSession.shared.data(for: request) let json = try JSONSerialization.jsonObject(with: data) as? [String : Any] errorView.isHidden = true return json?["client_secret"] as? String } catch let error { // Handle errors on the client side here print("An error occurred: \(error)") errorView.isHidden = false return nil } } override func viewDidLoad() { super.viewDidLoad() // This is your test publishable API key. STPAPIClient.shared.publishableKey = "{{PUBLISHABLE_KEY}}", let embeddedComponentManager = EmbeddedComponentManager( fetchClientSecret: fetchClientSecret ) let controller = embeddedComponentManager.createAccountOnboardingController() controller.present(from: self) } }

サポートされている埋め込みコンポーネントの一覧を参照 →

Configure the Embedded Component Manager
クライアント側

コードリファレンスを参照してください。

Connect 埋め込みコンポーネントのデザインをカスタマイズする

埋め込みコンポーネント Figma UI ツールキットには、すべてのコンポーネント、一般的なパターン、サンプルアプリケーションが含まれています。これを使用して、ウェブサイトに埋め込まれた UI を可視化してデザインできます。

Stripe は、Connect 埋め込みコンポーネントのデザインをカスタマイズするための一連のオプションを提供しています。これらをカスタマイズすると、デザインシステムのボタン、アイコン、その他のアクセントに影響します。

Necessary popups

Some behavior in embedded components, such as user authentication, must be presented in a popup. You can’t customize the embedded component to eliminate such popups.

これらのオプションは、EmbeddedComponentManager の初期化時に EmbeddedComponentManager.Appearance を使用して設定できます。

MyViewController.swift
func fetchClientSecret() async -> String? { let url = URL(string: "https://{{YOUR_SERVER}}/account_session")! var request = URLRequest(url: url) request.httpMethod = "POST" do { let (data, _) = try await URLSession.shared.data(for: request) let json = try JSONSerialization.jsonObject(with: data) as? [String : Any] return json?["client_secret"] as? String } catch { return nil } } // Specify custom fonts var customFonts: [CustomFontSource] = [] let myFont = UIFont(name: "My Font", size: 16)! let fontUrl = Bundle.main.url(forResource: "my-font-2", withExtension: "woff")! do { let customFontSource = try CustomFontSource(font: myFont, fileUrl: fontUrl) customFonts.append(customFontSource) } catch { print("Error loading custom font: \(error)") } // Customize appearance var appearance = EmbeddedComponentManager.Appearance() appearance.typography.fontfont.base = myFont appearance.typography.fontSizeBase = 16 // Unscaled font size appearance.colors.primary = UIColor { traitCollection in if traitCollection.userInterfaceStyle == .dark { UIColor(red: 0.455, green: 0.424, blue: 1.000, alpha: 1.0) } else { UIColor(red: 0.404, green: 0.365, blue: 1.000, alpha: 1.0) } } STPAPIClient.shared.publishableKey = "{{PUBLISHABLE_KEY}}", let embeddedComponentManager = EmbeddedComponentManager( appearance: appearance, fonts: customFonts, fetchClientSecret: fetchClientSecret )

Use custom fonts

アプリでカスタムフォントを使用する場合 (たとえば、アプリのバイナリに埋め込まれた .otf ファイルや .tff ファイルなど)、EmbeddedComponentManager の初期化時に fonts 引数に渡される CustomFontSource でフォントファイルを指定する必要があります。そうすることで、Connect 埋め込みコンポーネントがフォントファイルにアクセスできるようになり、フォントを適切にレンダリングできます。

appearance で指定されたフォントは、正しくレンダリングされるように、サポートされているシステムフォントか、初期化時に EmbeddedComponentManager に渡される CustomFontSource のいずれかを使用する必要があります。

リファレンスドキュメントを参照してください。

Configure appearance

ダークモードやアクセシビリティコントラストなど、ダイナミックプロバイダーを使用したデザインの色は、UITraitCollection が更新されたときに Connect 埋め込みコンポーネントに自動的に適用されます。デフォルトのデザインにはダークモードの色は含まれていないため、アプリでダークモードを対応するには、EmbeddedComponentManager にダイナミックカラーを使用したデザインを指定する必要があります。

When specifying font sizes, use the unscaled font size that displays for the device’s default size class. The embedded component automatically scales the font size based on its UITraitCollection.

See the full list of appearance options on iOS.

Update Connect embedded components after initialization

Call the update method to change the appearance of the embedded components after initialization:

MyViewController.swift
var appearance = EmbeddedComponentManager.Appearance() appearance.colors.primary = UIColor.red manager.update(appearance: appearance)

認証

Stripe は、Connect 埋め込みコンポーネントでアカウントセッションとユーザー認証情報を管理するための一連の API を提供しています。

Client Secret を更新する

長時間実行されるセッションでは、最初に提供された Client Secret によるセッションが期限切れになることがあります。有効期限が切れると、Stripe は自動的に fetchClientSecret を使用して新しい Client Secret を取得し、セッションを更新します。貴社が追加のパラメーターを渡す必要はありません。

MyViewController.swift
func fetchClientSecret() async -> String? { var request = URLRequest(url: URL(string: "https://{{YOUR_SERVER}}/account_session")!) request.httpMethod = "POST" do { let (data, _) = try await URLSession.shared.data(for: request) let json = try JSONSerialization.jsonObject(with: data) as? [String : Any] return json?["client_secret"] as? String } catch let error { return nil } } STPAPIClient.shared.publishableKey = "{{PUBLISHABLE_KEY}}", let embeddedComponentManager = EmbeddedComponentManager( fetchClientSecret: fetchClientSecret )

各地域への適応

Connect 埋め込みコンポーネントは、次のロケールに対応しています。

言語ロケールコード
ブルガリア語 (ブルガリア)bg-BG
中国語 (簡体字)zh-Hans
中国語 (繁体字 - 香港)zh-Hant-HK
中国語 (繁体字 - 台湾)zh-Hant-TW
クロアチア語 (クロアチア)hr-HR
チェコ語 (チェコ)cs-CZ
デンマーク語 (デンマーク)da-DK
オランダ語 (オランダ)nl-NL
英語 (オーストラリア)en-AU
英語 (インド)en-IN
英語 (アイルランド)en-IE
英語 (ニュージーランド)en-NZ
英語 (シンガポール)en-SG
英語 (イギリス)en-GB
英語 (アメリカ)en-US
エストニア語 (エストニア)et-EE
フィリピノ語 (フィリピン)fil-PH
フィンランド語 (フィンランド)fi-FI
フランス語 (カナダ)fr-CA
フランス語 (フランス)fr-FR
ドイツ語 (ドイツ)de-DE
ギリシャ語 (ギリシャ)el-GR
ハンガリー語 (ハンガリー)hu-HU
インドネシア語 (インドネシア)id-ID
イタリア語 (イタリア)it-IT
日本語 (日本)ja-JP
韓国語 (韓国)ko-KR
ラトビア語 (ラトビア)lv-LV
リトアニア語 (リトアニア)lt-LT
マレー語 (マレーシア)ms-MY
マルタ語 (マルタ)mt-MT
ノルウェーブークモール語 (ノルウェー)nb-NO
ポーランド語 (ポーランド)pl-PL
ポルトガル語 (ブラジル)pt-BR
ポルトガル語 (ポルトガル)pt-PT
ルーマニア語 (ルーマニア)ro-RO
スロバキア語 (スロバキア)sk-SK
スロベニア語 (スロベニア)sl-SI
スペイン語 (アルゼンチン)es-AR
スペイン語 (ブラジル)es-BR
スペイン語 (中南米)es-419
スペイン語 (メキシコ)es-MX
スペイン語 (スペイン)es-ES
スウェーデン語 (スウェーデン)sv-SE
タイ語 (タイ)th-TH
トルコ語 (トルコ)tr-TR
ベトナム語 (ベトナム)vi-VN

読み込みエラーを処理する

コンポーネントが読み込まれない場合は、コンポーネントの didFailLoadWithError デリゲートメソッドを実装することでエラーに対処できます。エラーの原因によっては、didFailLoadWithError メソッドが複数回呼び出される場合があります。didFailLoadWithError によってトリガーされるロジックは、べき等でなければなりません。

MyViewController.swift
// All components emit load errors. This example uses AccountOnboarding. // All components support didFailLoadWithError. class MyViewController: UIViewController, AccountOnboardingControllerDelegate { func openAccountOnboarding() { let accountOnboardingController = embeddedComponentManager.createAccountOnboardingController(); accountOnboardingController.delegate = self accountOnboardingController.present(from: self) } // MARK: - AccountOnboardingControllerDelegate func accountOnboarding(_ accountOnboarding: AccountOnboardingController, didFailLoadWithError error: Error) { print("Account onboarding failed to load with error '\(error)'") } }

アクセスのリクエスト プライベートプレビュー版

Sign in to request access to the Connect embedded component mobile SDK in preview.

Stripe アカウントをお持ちでない場合は、今すぐ登録できます。

このページはお役に立ちましたか。
はいいいえ
お困りのことがございましたら 、サポートにお問い合わせください。
早期アクセスプログラムにご参加ください。
変更ログをご覧ください。
ご不明な点がございましたら、お問い合わせください。
LLM ですか?llms.txt を読んでください。
Powered by Markdoc