# 3D セキュアの結果のインポート 3D セキュアが Stripe 以外で実行されている場合に支払いを処理します。 3DS の結果のインポートは高度な決済フローで、認証の結果をインポートすることによって外部の 3DS 認証を Stripe の支払いに取り込むことができます。以下に該当する場合は、3DS の結果をインポートする必要があります。 - 旅行業界のお客様で、Expedia や Sabre のような旅行情報サイトからカード番号や暗号化された情報を受け取る場合 - サードパーティープロバイダーを使用して 3DS を実行している場合 このような状況では、Stripe Elements を使用して支払い情報を収集して 3DS を実行する代わりに、Payment Intents API にカード詳細と暗号を直接渡すことができます。 3DS の結果のインポートは、以下の国でご利用いただけます。 - AU - CA - CH - EU - GB - HK - MX - NZ - SG - US (ベータ) Stripe がカード支払いに対応しているその他すべての国。 3DS の結果のインポートは、以下の国ではご利用いただけません。 - IN - MY - TH > 以下のすべてのコードサンプルでは、`three_d_secure` オブジェクトで設定されたパラメーターが、3DS プロバイダーによって返される値と完全に一致する必要があります。 ## カード詳細を使用して支払い処理する サーバーでカード詳細を処理する場合、以下のようにします。 1. 1 回の API コールでカード詳細と 3DS の詳細を呼び出して PaymentIntent を作成し、*確定* (Confirming an intent indicates that the customer intends to use the current or provided payment method. Upon confirmation, the intent attempts to initiate the portions of the flow that have real-world side effects)します。 1. PaymentIntent を作成する際、[confirm](https://docs.stripe.com/api/setup_intents/create.md#create_setup_intent-confirm) を `true` に設定します。 1. 再試行可能な支払い拒否の処理中に Stripe が 3DS リクエストを実行できないようにするため、PaymentIntent を確定するときに [error_on_requires_action](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-error_on_requires_action) を `true` に設定します。 ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d amount=2000 \ -d currency=eur \ -d "payment_method_types[]=card" \ -d "payment_method_data[type]=card" \ -d "payment_method_data[card][number]=4000002760003184" \ -d "payment_method_data[card][exp_month]=12" \ -d "payment_method_data[card][exp_year]=23" \ -d "payment_method_data[card][cvc]=123" \ -d "payment_method_options[card][three_d_secure][version]=2.1.0" \ -d "payment_method_options[card][three_d_secure][electronic_commerce_indicator]=05" \ --data-urlencode "payment_method_options[card][three_d_secure][cryptogram]=CJSJbzXT6TRQlvZDX+ZdOG4QriE=" \ -d "payment_method_options[card][three_d_secure][transaction_id]=aaa65c7b-b0fc-4e71-bd6c-29c87acad489" \ -d confirm=true \ -d error_on_requires_action=true ``` ## PaymentMethod を使用して支払いを処理する [Payment Methods API](https://docs.stripe.com/api/payment_methods.md) を使用してカード詳細をトークン化する場合、以下のようにします。 1. 1 回の API コールで PaymentMethod ID と 3DS の詳細を呼び出して PaymentIntent を作成し、確定します。 1. PaymentIntent を作成する際、[confirm](https://docs.stripe.com/api/setup_intents/create.md#create_setup_intent-confirm) を `true` に設定します。 1. 再試行可能な支払い拒否の処理中に Stripe が 3DS リクエストを実行できないようにするため、PaymentIntent を確定するときに [error_on_requires_action](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-error_on_requires_action) を `true` に設定します。 ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d amount=2000 \ -d currency=eur \ -d "payment_method_types[]=card" \ -d "customer={{CUSTOMER_ID}}" \ -d "payment_method={{PAYMENTMETHOD_ID}}" \ -d "payment_method_options[card][three_d_secure][version]=2.2.0" \ -d "payment_method_options[card][three_d_secure][electronic_commerce_indicator]=02" \ --data-urlencode "payment_method_options[card][three_d_secure][cryptogram]=M6+990I6FLD8Y6rZz9d5QbfrMNY=" \ -d "payment_method_options[card][three_d_secure][transaction_id]=f879ea1c-aa2c-4441-806d-e30406466d79" \ -d confirm=true \ -d error_on_requires_action=true ``` > カード詳細をトークン化した直後に PaymentMethod で支払いを処理する場合は、代わりに未加工のカードデータを使用してください。 ## 将来の支払いを設定する 3DS プロトコルは次の 2 つのメッセージカテゴリーをサポートします。 - **支払いの認証**: 取引時のカード保有者の認証に使用されます。 - **支払いの認証以外**: 本人確認およびアカウントの確認に使用されます。 将来の支払いのために顧客のアカウント登録が必要な場合は、 [SetupIntent](https://docs.stripe.com/api/setup_intents.md) の作成と確定時に、支払いの認証以外の暗号と、カード情報または PaymentMethod ID を含めます。 ```curl curl https://api.stripe.com/v1/setup_intents \ -u "<>:" \ -d "payment_method_types[]=card" \ -d "customer={{CUSTOMER_ID}}" \ -d "payment_method={{PAYMENTMETHOD_ID}}" \ -d "payment_method_options[card][three_d_secure][version]=2.2.0" \ -d "payment_method_options[card][three_d_secure][electronic_commerce_indicator]=05" \ --data-urlencode "payment_method_options[card][three_d_secure][cryptogram]=4BQwsg4yuKt0S1LI1nDZTcO9vUM=" \ -d "payment_method_options[card][three_d_secure][transaction_id]=f879ea1c-aa2c-4441-806d-e30406466d79" \ -d confirm=true \ -d "expand[]=latest_attempt" ``` ## 3DS が免除された結果をインポートする Stripe 外で ‘low-risk’ *SCA* (Strong Customer Authentication (SCA) is a regulatory requirement in effect as of September 14, 2019, that impacts many European online payments. It requires customers to use two-factor authentication like 3D Secure to verify their purchase) 免除を含む 3DS の結果を取得した場合、[exemption_indicator](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-payment_method_options-card-three_d_secure-exemption_indicator) パラメーターを使用して、その 3DS の結果の性質に基づく免除のフラグを立てることで、Stripe に伝えることができます。 Stripe のリアルタイム取引リスク分析によって適切であると判断された場合、Stripe は、[低リスクによる免除](https://stripe.com/guides/strong-customer-authentication#low-risk-transactions)をカード発行会社に要求して、オーソリリクエストのレスポンスで [exemption_indicator_applied](https://docs.stripe.com/api/charges/object.md#charge_object-payment_method_details-card-three_d_secure-exemption_indicator_applied) を返すことにより、このアクションをお客様に通知します。 ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d amount=2000 \ -d currency=eur \ -d "payment_method_types[]=card" \ -d "payment_method={{PAYMENTMETHOD_ID}}" \ -d "payment_method_options[card][three_d_secure][version]=2.2.0" \ -d "payment_method_options[card][three_d_secure][electronic_commerce_indicator]=07" \ --data-urlencode "payment_method_options[card][three_d_secure][cryptogram]=CJSJbzXT6TRQlvZDX+ZdOG4QriE=" \ -d "payment_method_options[card][three_d_secure][transaction_id]=aaa65c7b-b0fc-4e71-bd6c-29c87acad489" \ -d "payment_method_options[card][three_d_secure][exemption_indicator]=low_risk" \ -d confirm=true \ -d error_on_requires_action=true \ -d "expand[]=latest_charge" ``` Stripe が低リスクによる免除をリクエストしたかどうかを確認するには、`latest_charge` を[拡張](https://docs.stripe.com/api/expanding_objects.md)し、[three_d_secure](https://docs.stripe.com/api/charges/object.md#charge_object-payment_method_details-card-three_d_secure) 属性を調べます。 ```json { "id": "pi_3aTnU0Aif3fLhNTb0le1BSXI", "object": "payment_intent", // ... "latest_charge": { "id": "ch_3aTnU1AifffLhNTb0tUoEZcd", "object": "charge", // ... "payment_method_details": { "card": { // ... "three_d_secure": { "authentication_flow": "frictionless", "electronic_commerce_indicator": "07","exemption_indicator": "low_risk", "exemption_indicator_applied": true, "result": "exempted", "result_reason": null, "transaction_id": "aaa65c7b-b0fc-4e71-bd6c-29c87acad489", "version": "2.2.0" }, // ... }, // ... }, // ... }, // ... } ``` ## Cartes Bancaires の結果をインポートする Cartes Bancaires ネットワーク上で処理される取引に 3D セキュアのインポートを利用するには、[ネットワーク](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-payment_method_options-card-network)パラメーターを使用して、リクエストで認証済みネットワークを明示的に渡す必要があります。 Cartes Bancaires の暗号をインポートする場合は、外部の 3D セキュアサーバーから追加のデータも取得する必要があります。以下の表は、こうした追加の必須フィールドと推奨フィールドの詳細を示しています。これらの推奨フィールドは、PaymentIntent と SetupIntent の両方を使用して 3DS の結果をインポートする場合に適用されます。 | フィールド | 説明 | 選択肢 | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- | | [electronic_commerce_indicator](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-payment_method_options-card-three_d_secure-electronic_commerce_indicator) | Electronic Commerce Indicator (ECI) はお使いの 3DS プロバイダーによって返され、オーソリがどの程度行われたかを示します。 | オプション。利用可能な場合に含まれる。 | | [cb_avalgo](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-payment_method_options-card-three_d_secure-network_options-cartes_bancaires-cb_avalgo) | カード発行会社の ACS が認証暗号を計算する際に使用する暗号計算アルゴリズム。cavv アルゴリズムとも呼ばれる。 ARes/RReq messageExtension: `CB-AVALGO` | 必須。 | | [cb_exemption](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-payment_method_options-card-three_d_secure-network_options-cartes_bancaires-cb_exemption) | ARes で Cartes Bancaires から返される免除インジケーター。Base64 でエンコードされた 3 バイトのビットマップ (最下位バイト優先、最上位ビット優先)。文字列 (4 文字)。 ARes message extension: `CB-EXEMPTION` | オプション。利用可能な場合に含まれる。 | | [cb_score](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-payment_method_options-card-three_d_secure-network_options-cartes_bancaires-cb_score) | ARes で Cartes Bancaires から返されるリスクスコア。数値は 0 から 99。 ARes/RReq message extension: `CB-SCORE` | オプション。利用可能な場合に含まれる。 | | [ares_trans_status](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-payment_method_options-card-three_d_secure-ares_trans_status) | AResで、カード発行会社の ACS から返される `transStatus`。 | オプション。利用可能な場合に含まれる。 | | [requestor_challenge_indicator](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-payment_method_options-card-three_d_secure-requestor_challenge_indicator) | カード発行会社の ACS に送信される AReq でリクエストされたチャレンジインジケーター (`threeDSRequestorChallengeInd`)。01 から 99 までの 2 桁の数字からなる文字列。 | オプション。利用可能な場合に含まれる。 | オーソリの成功機会を増やすために、こうした追加のフィールドをできるだけ多く指定してください。 ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d amount=2000 \ -d currency=eur \ -d "payment_method_types[]=card" \ -d "payment_method={{PAYMENTMETHOD_ID}}" \ -d "payment_method_options[card][network]=cartes_bancaires" \ -d "payment_method_options[card][three_d_secure][version]=2.2.0" \ -d "payment_method_options[card][three_d_secure][electronic_commerce_indicator]=05" \ --data-urlencode "payment_method_options[card][three_d_secure][cryptogram]=CJSJbzXT6TRQlvZDX+ZdOG4QriE=" \ -d "payment_method_options[card][three_d_secure][transaction_id]=aaa65c7b-b0fc-4e71-bd6c-29c87acad489" \ -d "payment_method_options[card][three_d_secure][requestor_challenge_indicator]=02" \ -d "payment_method_options[card][three_d_secure][ares_trans_status]=Y" \ -d "payment_method_options[card][three_d_secure][network_options][cartes_bancaires][cb_avalgo]=1" \ -d "payment_method_options[card][three_d_secure][network_options][cartes_bancaires][cb_score]=9" \ -d "payment_method_options[card][three_d_secure][network_options][cartes_bancaires][cb_exemption]=BAAA" \ -d confirm=true \ -d error_on_requires_action=true ``` ### Cartes Bancaires お客様が 3DS に対して *SCA* (Strong Customer Authentication (SCA) is a regulatory requirement in effect as of September 14, 2019, that impacts many European online payments. It requires customers to use two-factor authentication like 3D Secure to verify their purchase) 免除を許可されている場合、`cb_exemption` パラメーターか `exemption_indicator` パラメーターのいずれか、または両方を送信する必要があります。これらのパラメーターのいずれかが、アクワイアラーの取引リスク分析に基づいて、免除が低リスクであることを示している場合、Stripe は、[3D 免除された結果を[インポートする](https://docs.stripe.com/payments/payment-intents/three-d-secure-import.md#import-exempted-outcomes)で説明されているように、取引を再評価します。 - `cb_exemption` にアクセスできる場合、その値を渡して、`exemption_indicator` を設定しないでください。Stripe は `cb_exemption` に基づいて適切な免除インジケーターを推測します。 - `cb_exemption` パラメーターと `exemption_indicator` パラメーターの両方を渡す場合は、両方が免除されたステータスを正しく示していることを確認してください。 - 免除インジケーターが `exemption_indicator=none` で、一方 `cb_exemption` のビットマップは適用される免除が低リスク免除であることを示している場合、Stripe はリクエストを拒否します。 ## テスト 認証が必要なテストカード (`4000 0027 6000 3184` または `pm_card_authenticationRequired`) を使用して、サンドボックスでシステムを検証できます。 シミュレーションでは、正しくフォーマットされた 3DS の結果がすべて受け入れられます。以下はその例です。 - バージョン: `2.1.0` - E コマースインジケータ: `02` - 暗号: `M6+990I6FLD8Y6rZz9d5QbfrMNY=` - 取引 ID: `5f5d08f2-8c36-4f72-99d1-57b4fb70b7d5` または: - バージョン: `2.2.0` - 電子コマースインジケータ: `05` - 暗号: `4BQwsg4yuKt0S1LI1nDZTcO9vUM=` - 取引 ID: `f879ea1c-aa2c-4441-806d-e30406466d79` ### 3DS による免除の適用 テスト環境では、`exemption_indicator` を含むすべてのカードが `exemption_indicator_applied` を true で返します。TRA の内部チェックにパスせず false を返す PaymentIntent の作成をテストするには、カード番号 `4000 0000 0001 6123` を使用し、`exemption_indicator=low_risk` を設定します。 ### Cartes Bancaires 以下の共同ブランドカードを使用して、Cartes Bancaires の結果のインポートをテストできます。 #### カード番号 | 番号 | ブランド | セキュリティコード | 日付 | | ------------------- | ----------------------------- | ---------- | -------- | | 4000 0025 0000 1001 | Cartes Bancaires / Visa | 任意の 3 桁の数字 | 任意の将来の日付 | | 5555 5525 0000 1001 | Cartes Bancaires / Mastercard | 任意の 3 桁の数字 | 任意の将来の日付 | | 4000 0000 0001 6123 | Cartes Bancaires / Visa | 任意の 3 桁の数字 | 任意の将来の日付 | #### トークン | トークン | ブランド | | ---------------------------------------------------- | ----------------------------- | | `tok_visa_cartesBancaires` | Cartes Bancaires / Visa | | `tok_mastercard_cartesBancaires` | Cartes Bancaires / Mastercard | | `tok_threeDSecureImportExemptionIndicatorNotApplied` | Cartes Bancaires / Visa | #### PaymentMethods | 決済手段 | ブランド | | -------------------------------------------------------- | ----------------------------- | | `pm_card_visa_credit_fr_cartesBancaires` | Cartes Bancaires / Visa | | `pm_card_mastercard_credit_fr_cartesBancaires` | Cartes Bancaires / Mastercard | | `pm_card_threeDSecureImportExemptionIndicatorNotApplied` | Cartes Bancaires / Visa | 以下のように、有効な `cb_exemption` 値はすべてテストに使うことができます。 - `AAAA`: 免除は一切許可されない - `BAAA`: 低リスク免除は許可される [標準的な免除フロー](https://docs.stripe.com/payments/payment-intents/three-d-secure-import.md#exemptions-granted-through-3ds)のように、`cb_exemption` が低リスクに相当する場合、テストカード `4000 0000 0001 6123` は、[exemption_indicator_applied](https://docs.stripe.com/api/charges/object.md#charge_object-payment_method_details-card-three_d_secure-exemption_indicator_applied) に false を返します。 ## 未加工の PAN 使用 Stripe では、未加工カードデータ API へのアクセスを付与する前に、カード保有者のデータが Payment Card Industry Data Security Standard (PCI DSS) に準拠した方法で安全に処理されていることを検証するようにユーザーに義務付けています。 この機能を必要とするビジネスを対象として、Stripe は 以下に挙げる厳格な要件を適用します。 - PCI DSS 準拠の検証 - Stripe の審査プロセスへの提出 - Stripe のデフォルトのセキュリティ設定に加えて適用される制御の維持への同意 イネーブルメントの詳細については、[未加工のカードデータ API へのアクセスを有効にする](https://support.stripe.com/questions/enabling-access-to-raw-card-data-apis)のサポート記事をご覧ください。 > カスタム料金体系を使用するアカウントにおいて、3DS のリクエストで Stripe をアクワイアラーとして指定した場合、Stripe は、お客様との契約に従って 3DS に適用されるネットワークコストを渡します。 ## See also - [PaymentIntent での 3D セキュアオプション](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-payment_method_options-card-three_d_secure)