Connect の埋め込みコンポーネントの使用を開始する
ダッシュボードの機能をウェブサイトに埋め込む方法をご紹介します。
Connect の埋め込みコンポーネントを使用して、連結アカウントのダッシュボード機能をウェブサイトに追加します。これらのライブラリとサポートする API を使用することで、ダッシュボードから Stripe 製品に直接アクセスできる許可をユーザーに付与できます。
プライベートプレビュー
The Android SDK is currently available with invite only and has the following limitations:
- Only accounts where
controller.
isrequirement_ collection 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 をアプリに返す新しいエンドポイントをサーバー上に作成できます。
注意
ユーザー認証はサポートされていないため、アカウントセッションの作成時にすべてのコンポーネントのサーバーエンドポイントで 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 Android SDK はオープンソースであり、詳細なドキュメントが提供されています。
To install the SDK, add connect
to the dependencies
block of your app/build.gradle file:
注
SDK の最新リリースおよび過去バージョンの詳細については、GitHub の Releases ページをご覧ください。新しいリリースの公開時に通知を受け取るには、リポジトリのリリースを確認してください。
Initialize EmbeddedComponentManager クライアント
Instantiate an EmbeddedComponentManager with your publishable key and a lambda that retrieves a client secret by calling the new endpoint you created on your server. In order to handle configuration changes, keep the EmbeddedComponentManager
instance in an Activity or Fragment ViewModel
.
To create a component, first call EmbeddedComponentManager.
in your Activity’s onCreate
method. Then, call the appropriate create method on the EmbeddedComponentManager
that you instantiated above. This returns a controller that you can use to present the component in the app.
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.
You can set these options using Appearance when initializing EmbeddedComponentManager
.
Use custom fonts 
If you use custom fonts in your app (for example, from .
or .
files embedded in your app binary), you must specify the font files in a CustomFontSource passed to the customFonts
argument when initializing EmbeddedComponentManager
. This gives Connect embedded components access to the font files to properly render the fonts.
Fonts specified in appearance
must use a CustomFontSource passed to the EmbeddedComponentManager
on initialization to properly render.
See the reference documentation .
Configure appearance 
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 the user’s Accessibility font settings.
See the full list of appearance options on Android.
Update Connect embedded components after initialization
Call the update
method to change the appearance of the embedded components after initialization:
認証
Stripe は、Connect 埋め込みコンポーネントでアカウントセッションとユーザー認証情報を管理するための一連の API を提供しています。
Client Secret を更新する
長時間実行されるセッションでは、最初に提供された Client Secret によるセッションが期限切れになることがあります。有効期限が切れると、Stripe は自動的に fetchClientSecret
を使用して新しい Client Secret を取得し、セッションを更新します。貴社が追加のパラメーターを渡す必要はありません。
各地域への適応
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 |
読み込みエラーを処理する
コンポーネントが読み込まれない場合は、コンポーネントの onLoadError
リスナーメソッドを実装することでエラーに対処できます。エラーの原因によっては、onLoadError
メソッドが複数回呼び出される場合があります。onLoadError
によってトリガーされるロジックは、べき等でなければなりません。
アクセスのリクエスト プライベートプレビュー版
サインインして、プレビュー版のこの Connect 埋め込みコンポーネントへのアクセスをリクエストします。
Stripe アカウントをお持ちでない場合は、今すぐ登録できます。