コンテンツにスキップ
アカウントを作成
または
サインイン
Stripe ドキュメントのロゴ
/
AI に質問する
アカウントを作成
サインイン
始める
支払い
売上
プラットフォームおよびマーケットプレイス
資金管理
開発者向けのツール
概要
Stripe Payments について
構築済みのシステムをアップグレード
支払いの分析
オンライン決済
概要ユースケースを見つけるManaged Payments
Payment Links を使用する
決済ページを構築
高度なシステムを構築
アプリ内実装を構築
決済手段
決済手段を追加
    概要
    支払い方法の導入オプション
    ダッシュボードで支払い方法を管理
    決済手段のタイプ
    カード
    Stripe 残高で支払う
    仮想通貨
    銀行口座引き落とし
    銀行へのリダイレクト
    銀行振込
    クレジットトランスファー (Sources)
    後払い
      Affirm
      Afterpay/Clearpay
        決済を受け付ける
        サイトメッセージ
      Alma
      Billie
      Capchase Pay
      Klarna
      Kriya
      Mondu
      請求書支払い
      Scalapay
      SeQura
      Sunbit
      Zip
    リアルタイム決済
    店舗支払い
    ウォレット
    国ごとに現地の支払い方法を有効化
    カスタムの決済手段
決済手段を管理
Link による購入の迅速化
支払いインターフェイス
Payment Links
Checkout
Web Elements
アプリ内 Elements
決済シナリオ
カスタムの決済フロー
柔軟なアクワイアリング
オーケストレーション
店頭支払い
端末
他の Stripe プロダクト
Financial Connections
仮想通貨
Climate
ホーム支払いAdd payment methodsBuy now, pay laterAfterpay / Clearpay

注

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

Afterpay または Clearpay の支払いを受け付ける

アメリカ、カナダ、イギリス、オーストラリア、ニュージーランドで、Afterpay (イギリスでは Clearpay とも呼ばれている) による支払い方法を受け付ける方法をご紹介します。

ページをコピー

アプリで Afterpay を受け付けるには、顧客が支払いを認証するための Webview を表示します。その後、顧客はアプリに戻り、お客様は支払いが成功したか失敗したかをすぐに確認できます。

注

Before you start the integration, make sure your account is eligible for Afterpay by navigating to your Payment methods settings.

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

まず、Stripe アカウントが必要です。今すぐ登録してください。

サーバ側

この組み込みには、サーバ上に Stripe API と通信するエンドポイントが必要です。サーバから Stripe API にアクセスするには、Stripe の公式ライブラリを使用します。

Command Line
Ruby
# Available as a gem sudo gem install stripe
Gemfile
Ruby
# If you use bundler, you can add this line to your Gemfile gem 'stripe'

クライアント側

Stripe Android SDK はオープンソースであり、詳細なドキュメントが提供されています。

To install the SDK, add stripe-android to the dependencies block of your app/build.gradle file:

build.gradle.kts
Kotlin
plugins { id("com.android.application") } android { ... } dependencies { // ... // Stripe Android SDK implementation("com.stripe:stripe-android:21.17.0") // Include the financial connections SDK to support US bank account as a payment method implementation("com.stripe:financial-connections:21.17.0") }

注

SDK の最新リリースおよび過去バージョンの詳細については、GitHub の Releases ページをご覧ください。新しいリリースの公開時に通知を受け取るには、リポジトリのリリースを確認してください。

Stripe の公開可能キーを使用して SDK を設定し、 Application サブクラスなどで、Stripe API へのリクエストを実行できるようにします。

Kotlin
import com.stripe.android.PaymentConfiguration class MyApp : Application() { override fun onCreate() { super.onCreate() PaymentConfiguration.init( applicationContext,
"pk_test_TYooMQauvdEDq54NiTphI7jx"
) } }

注

Use your test keys while you test and develop, and your live mode keys when you publish your app.

Stripe サンプルでは、サーバへの HTTP リクエストの作成に、OkHttp および GSON も使用します。

PaymentIntent を作成する
サーバ側
クライアント側

A PaymentIntent is an object that represents your intent to collect payment from a customer and tracks the lifecycle of the payment process through each stage.

サーバ側

First, create a PaymentIntent on your server and specify the amount to collect and the currency. If you already have an integration using the Payment Intents API, add afterpay_clearpay to the list of payment method types for your PaymentIntent.

Command Line
curl
curl https://api.stripe.com/v1/payment_intents \ -u
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:
\ -d "amount"=1099 \ -d "currency"="usd" \ -d "payment_method_types[]"="afterpay_clearpay"

その他の支払い方法オプション

You can specify an optional reference parameter in the payment method options for your PaymentIntent that sets an internal order identifier for the payment. Although this isn’t typically visible to either the business or the consumer, Afterpay’s internal support team can access it during manual support requests. The identifier is limited to 128 characters and may contain only letters, digits, underscores, backslashes, and dashes.

Command Line
curl
curl https://api.stripe.com/v1/payment_intents \ -u
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:
\ -d "amount"=1099 \ -d "currency"="usd" \ -d "payment_method_types[]"="afterpay_clearpay" \ -d "payment_method_options[afterpay_clearpay][reference]"="order_123"

クライアント側

Included in the returned PaymentIntent is a client secret, which the client side can use to securely complete the payment process instead of passing the entire PaymentIntent object. On the client, request a PaymentIntent from your server and store its client secret.

Kotlin
class AfterpayPaymentActivity: AppCompatActivity() { private lateinit var paymentIntentClientSecret: String override fun onCreate(savedInstanceState: Bundle?) { // ... startCheckout() } private fun startCheckout() { // Request a PaymentIntent from your server and store its client secret } }

支払い方法の詳細を収集する
クライアント側

Afterpay requires billing details to be present for the payment to succeed. In your app, collect the required billing details from the customer:

  • Full name (first and last)
  • メールアドレス
  • Full billing address

これらの詳細を使用して、PaymentMethodCreateParams を作成します。

Additionally, while shipping details aren’t required they can help improve authentication rates. To collect shipping details, collect the following from the customer:

  • 氏名
  • Full shipping address

これらの詳細を使用して、ConfirmPaymentIntentParams.Shipping を作成します。

Kotlin
val billingDetails = PaymentMethod.BillingDetails( name = "Jenny Rosen", email = "jenny@rosen.com", address = Address.Builder() .setLine1("1234 Market St") .setCity("San Francisco") .setState("CA") .setCountry("US") .setPostalCode("94111") .build() ) val paymentMethodCreateParams = PaymentMethodCreateParams.createAfterpayClearpay(billingDetails) // Shipping details are optional but recommended to pass in. val shippingDetails = ConfirmPaymentIntentParams.Shipping( name = "Jenny Rosen", address = Address.Builder() .setLine1("1234 Market St") .setCity("San Francisco") .setState("CA") .setCountry("US") .setPostalCode("94111") .build() )

Stripe に支払いを送金する
クライアント側

ステップ 2 で作成した PaymentIntent から client secret を取得し、PaymentLauncher confirm メソッドを呼び出します。これにより、Webview が表示され、顧客は銀行のウェブサイトまたはアプリで支払いを完了できます。完了後、支払い結果とともに、onActivityResult が呼び出されます。

Kotlin
class AfterpayPaymentActivity : AppCompatActivity() { // ... private lateinit var paymentIntentClientSecret: String private val paymentLauncher: PaymentLauncher by lazy { val paymentConfiguration = PaymentConfiguration.getInstance(applicationContext) PaymentLauncher.Companion.create( this, paymentConfiguration.publishableKey, paymentConfiguration.stripeAccountId, ::onPaymentResult ) } private fun startCheckout() { // ... // Shipping details are optional but recommended to pass in. val confirmParams = ConfirmPaymentIntentParams .createWithPaymentMethodCreateParams( paymentMethodCreateParams = paymentMethodCreateParams, clientSecret = paymentIntentClientSecret, shipping = shippingDetails ) paymentLauncher.confirm(confirmParams) } private fun onPaymentResult(paymentResult: PaymentResult) { when (paymentResult) { is PaymentResult.Completed -> { // show success UI } is PaymentResult.Canceled -> { // handle cancel flow } is PaymentResult.Failed -> { // handle failures // (for example, the customer may need to choose a new payment // method) } } } }

オプションPaymentIntent にラインアイテムを追加する

オプションオーソリとキャプチャの分離

オプション支払い後のイベントを処理する

オプションAfterpay の組み込みをテストする

失敗した支払い

Afterpay は、取引を受け付けるか拒否するかを決定する際に複数の要因を考慮します (買い手が Afterpay を使用している期間、顧客が返済する必要のある未払い額、現在の注文の値など)。

You should always present additional payment options such as card in your checkout flow, as Afterpay payments have a higher rate of decline than many payment methods. In these cases, the PaymentMethod is detached and the PaymentIntent object’s status automatically transitions to requires_payment_method.

For an Afterpay PaymentIntent with a status of requires_action, customers need to complete the payment within 3 hours after you redirect them to the Afterpay site (this doesn’t apply to declined payments). If they take no action within 3 hours, the PaymentMethod detaches and the object status for the PaymentIntent automatically transitions to requires_payment_method.

このような場合、決済フローに表示される別の支払いオプションで再試行するように顧客に通知します。

エラーコード

一般的なエラーコードと対応する推奨アクションは以下のとおりです。

エラーコード推奨される対応
payment_intent_payment_attempt_failedAfterpay の決済が失敗したことを示す一般的なエラー。これは、拒否エラーコードとして表示されない拒否である可能性もあります。
payment_method_provider_declineAfterpay が顧客の支払いを拒否しました。次のステップとして、顧客から Afterpay に詳細を問い合わせる必要があります。
payment_intent_payment_attempt_expired顧客が Afterpay の決済ページで支払いを完了しておらず、支払いセッションの期限が切れています。Stripe は、最初の決済フローの作成から 3 時間が経過しても正常にオーソリされなかった Payment Intents を自動的に期限切れにします。
payment_method_not_availableAfterpay でサービス関連のエラーが発生したため、リクエストを完了できません。後で再試行してください。
amount_too_smallEnter an amount within Afterpay’s default transactions limits for the country.
amount_too_largeEnter an amount within Afterpay’s default transactions limits for the country.
このページはお役に立ちましたか。
はいいいえ
お困りのことがございましたら 、サポートにお問い合わせください。
早期アクセスプログラムにご参加ください。
変更ログをご覧ください。
ご不明な点がございましたら、お問い合わせください。
LLM ですか?llms.txt を読んでください。
Powered by Markdoc