MobilePay での支払い
デンマークとフィンランドで一般的な支払い方法として使われている MobilePay を受け付ける方法をご紹介します。
MobilePay is a single-use card wallet payment method used in Denmark and Finland. It allows your customer to authenticate and approve payments using the MobilePay app.
When your customer pays with MobilePay, Stripe performs a card transaction using the card data we receive from MobilePay. The processing of the card transaction is invisible to your integration, and Stripe immediately notifies you whether the payment succeeded or failed.
Stripe を設定するサーバー側
アプリケーションから Stripe API にアクセスするには、Stripe の公式ライブラリを使用します。
PaymentIntent を作成するサーバー側
A PaymentIntent is an object that represents your intent to collect a payment from a customer and tracks the lifecycle of the payment process through each stage. Create a PaymentIntent
on your server and specify the amount to collect and a supported currency (eur
, dkk
, sek
, or nok
). If you already have an integration using the Payment Intents API, add mobilepay
to the list of payment method types.
レスポンスの例
{ "id": "pi_12345", "amount": 1099, "client_secret": "pi_12345_secret_abcdef", "currency": "dkk", "payment_method": "pm_12345", "payment_method_types": [ "mobilepay" ], "status": "requires_confirmation" }
client secret を取得する
PaymentIntent には、client secret が含まれています。これは、支払いプロセスを安全に完了するためにクライアント側で使用されます。client secret をクライアント側に渡す際は、いくつかの方法を使用できます。
PaymentIntentを確定する
Use the PaymentIntent ID from step 2 to confirm the PaymentIntent. This declares that the customer intends to pay with the specified PaymentMethod. Stripe initiates a payment after confirming the PaymentIntent. The return_url indicates where Stripe redirects the customer after they complete the payment.
レスポンスの例
{ "id": "pi_12345", "amount": 1099, "currency": "dkk", "payment_method": "pm_12345", "next_action": { "redirect_to_url": { "return_url": "https://example.com/checkout/complete", "url": "https://pm-redirects.stripe.com/authorize/acct_123/pa_nonce_abc" }, "type": "redirect_to_url" }, "payment_method_types": [ "mobilepay" ], "status": "requires_action" }
To authorize the payment, redirect your customer to the URL in the next_action[redirect_to_url][url] field.
- デスクトップでは、URL によって MobilePay スタートページが開き、顧客はそこで、MobilePay アカウントを識別する電話番号を入力します。その後、顧客は MobilePay スマートフォンアプリを使用して支払いの認証を進めることができます。
- モバイルデバイスでは、デスクトップでのプロセスと同様に、この URL によって、MobilePay アプリケーションが直接開くか (存在する場合)、MobilePay スタートページに移動します。
Your customer has 5 minutes to open the redirect URL and authorize the payment in the MobilePay app. If the underlying card charge fails, your customer can choose a different card and retry in the MobilePay app. If the payment isn’t authorized within 5 minutes, the payment fails and the PaymentIntent’s status transitions to requires_
.
支払い後のイベントを処理する
支払いが完了すると、Stripe は payment_intent.succeeded イベントを送信します。ダッシュボード、カスタム Webhook、またはパートナーソリューションを使用してこれらのイベントを受信し、また、顧客への注文確認メールの送信、データベースでの売上の記録、配送ワークフローの開始などのアクションを実行します。
クライアントからのコールバックを待つのではなく、これらのイベントをリッスンします。クライアント側では、コールバックが実行される前に顧客がブラウザーのウィンドウを閉じたり、アプリを終了したりする可能性があります。また、悪意を持つクライアントがレスポンスを不正操作する恐れもあります。非同期型のイベントをリッスンするよう構築済みのシステムを設定することで、これ以降はより多くの決済手段を簡単に受け付けられるようになります。サポートされているすべての決済手段の違いをご確認ください。
手動
Stripe ダッシュボードは、すべての Stripe 支払いの確認、メールでの領収書の送信、入金処理、または失敗した支払いの再試行に使用できます。
カスタムコード
Webhook ハンドラを作成してイベントをリッスンし、カスタムの非同期決済フローを作成します。Stripe CLI を使用し、ローカルで Webhook 組み込みのテストとデバッグを行います。
事前構築のアプリ
オートメーションやマーケティングとセールスなどの一般的なビジネスイベントを、パートナーアプリケーションとの連携によって処理します。
Test the integration
Using your test API keys, create a PaymentIntent. After confirming the PaymentIntent, follow the next_
redirect URL to a test page with options to authorize or fail the payment.
- Authorize test payment (テスト支払いをオーソリする) をクリックして、支払い成功のケースをテストします。 PaymentIntent は
requires_
からaction succeeded
に移行します。 - Fail test payment (テスト支払いを失敗させる) をクリックして、顧客の認証失敗のケースをテストします。PaymentIntent が
requires_
からaction requires_
に移行します。payment_ method
失敗した支払い
MobilePay transactions can fail if the underlying card transaction is declined. Learn more about card declines. In this case, the PaymentMethod is detached and the PaymentIntent’s status automatically transitions to requires_
.
When the PaymentIntent’s status is requires_
, your customer must authenticate the payment within 5 minutes. If no action is taken after 5 minutes, the PaymentMethod detaches and the PaymentIntent’s status automatically transitions to requires_
.
返金と不審請求の申請
Stripe performs a card transaction using standard card rails as part of a MobilePay transaction. Refunds and disputes are subject to the Visa and Mastercard network rules.