# Charges API と PaymentIntents API Stripe の 2 つの主要な支払い API の違いと、それぞれを使用するタイミングは以下のとおりです。 ## Stripe の支払いのための API について 現在 Stripe で支払いを受け付けるには、3 通りの方法があります。 - Stripe Checkout - Charges API - *Payment Intents API* (The Payment Intents API tracks the lifecycle of a customer checkout flow and triggers additional authentication steps when required by regulatory mandates, custom Radar fraud rules, or redirect-based payment methods) [Stripe Checkout](https://docs.stripe.com/payments/checkout.md) は事前に構築された支払いページであり、購入と*サブスクリプション* (A Subscription represents the product details associated with the plan that your customer subscribes to. Allows you to charge the customer on a recurring basis)を簡単にするために顧客をこのページにリダイレクトできます。Apple Pay、Google Pay、国際化、フォーム検証など、多くの機能を提供します。 [Charges (支払い)](https://docs.stripe.com/api/charges.md) API および [Payment Intents (支払いインテント)](https://docs.stripe.com/api/payment_intents.md) API を使用すると、カスタムの支払いフローと体験を構築できます。 Payment Intents API は、すべての Stripe 製品と決済手段の統合 API です。Charges API を廃止する予定はありませんが、新機能は Payment Intents API のみで使用できます。 すべての機能の比較については、以下の表を参照してください。 | Charges API | Payment Intents API | | -------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | カードの受け付けにシンプルな方法を好む米国 / カナダの顧客を主とするビジネスが使用。 | 認証を必要とする複数の支払い方法とカードに対応するビジネスで必要です (ヨーロッパの*強力な顧客認証 (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) に対応するためなど)。 | | Web、iOS、Android で動作。 | Web、iOS、Android で動作します。Terminal で実店舗での支払いを受け付ける際にも使用できます。 | | [Sources API](https://docs.stripe.com/sources.md) でカードとあらゆる支払いをサポート。 | 3DS を必要とするカード、iDEAL、SEPA、および[その他の多くの支払い方法](https://docs.stripe.com/payments/payment-methods/overview.md)をサポートします。 | | SCA **未対応** | *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) | ## 支払いから読み取るコードを移行する アプリケーションに複数の支払いフローがあり、それぞれを Charges API から [Payment Intents API](https://docs.stripe.com/payments/payment-intents.md) に段階的に移行する場合は、最初に [Charge (支払い)](https://docs.stripe.com/api/charges.md) オブジェクトから読み取るコードを更新する必要があります。これを支援するために、Charge オブジェクトには [payment_method_details](https://docs.stripe.com/api/charges/object.md#charge_object-payment_method_details) と [billing_details](https://docs.stripe.com/api/charges/object.md#charge_object-billing_details) という 2 つの新しいプロパティがあり、支払いに使用された支払い方法の詳細を読み取るための一貫したインターフェイスを提供します。 これらのフィールドは、すべての API バージョン、および Charges API と Payment Intents API の両方で作成された支払いオブジェクトで使用できます。 次の表は、支払いで通常使用されるプロパティと、追加プロパティを使用して同じ情報にアクセスする方法を示しています。 #### カードと銀行口座 | 説明 | 前 | 後 | | ---------------------- | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | | 支払いの作成時に使用された支払い方法の詳細 | `charge.source` | `charge.payment_method_details` | | 支払いに使用された支払い方法の ID | `charge.source.id` | `charge.payment_method` | | 使用される支払い方法タイプ | `charge.source.object` (`card`、`bank_account` など) | `charge.payment_method_details.type` | | 支払いの請求先情報 (請求先の郵便番号など) | `charge.source.address_zip` | `charge.billing_details.address.postal_code` | | カード保有者の名前 | `charge.source.name` | `charge.billing_details.name` | | 使用されたカードの末尾 4 桁 | `charge.source.last4` | `charge.payment_method_details.card.last4` | | カードのフィンガープリント | `charge.source.fingerprint` | `charge.payment_method_details.card.fingerprint` | | セキュリティコード確認ステータス | `charge.source.cvc_check` | `charge.payment_method_details.card.checks.cvc_check` | | カードブランド値 | `charge.source.brand` は、`American Express`、`Diners Club`、`Discover`、`JCB`、`MasterCard`、`UnionPay`、`Visa` のいずれか | `charge.payment_method_details.card.brand` は、`amex`、`diners`、`discover`、`jcb`、`mastercard`、`unionpay`、`visa` のいずれか | | Google Pay の enum 値 | `charge.source.tokenization_method` は `android_pay` | `charge.payment_method_details` 内の `card.wallet.type` は `google_pay` | #### Sources | 説明 | 前 | 後 | | ---------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | | 支払いの作成時に使用された支払い方法の詳細 | `charge.source` | `charge.payment_method_details` | | 支払いに使用された支払い方法の ID | `charge.source.id` (3D セキュアが使用される場合には `charge.source.three_d_secure.card`) | `charge.payment_method` | | 使用される支払い方法タイプ | `charge.source.object == 'source' && charge.source.type` (`charge.source.type` が `three_d_secure` の場合を除く) | `charge.payment_method_details.type` | | 支払いの請求先情報 (請求先の郵便番号など) | `charge.source.owner.address.postal_code` | `charge.billing_details.address.postal_code` | | カード保有者の名前 | `charge.source.owner.name` | `charge.billing_details.name` | | 使用されたカードの末尾 4 桁 | `charge.source.card.last4` `charge.source.three_d_secure.last4` | `charge.payment_method_details.card.last4` | | 3D セキュアが成功したかどうか | `charge.source.object == 'source' && charge.source.type == 'three_d_secure'` | `charge.payment_method_details.card.three_d_secure.succeeded` | | カードのフィンガープリント | `charge.source.card.fingerprint` | `charge.payment_method_details.card.fingerprint` | | セキュリティコード確認ステータス | `charge.source.card.cvc_check` | `charge.payment_method_details.card.checks.cvc_check` | | カードブランド値 | `charge.source.card.brand` は、`American Express`、`Diners Club`、`Discover`、`JCB`、`MasterCard`、`UnionPay`、`Visa` のいずれか | `charge.payment_method_details.card.brand` は、`amex`、`diners`、`discover`、`jcb`、`mastercard`、`unionpay`、`visa` のいずれか | | Google Pay の enum 値 | `charge.source.card.tokenization_method` は `android_pay` | `charge.payment_method_details` 内の `card.wallet.type` は `google_pay` | ## See also - [Payment Intents への移行](https://docs.stripe.com/payments/payment-intents/migration.md)