Payment Intent API関数
すべてのPayment Intentをリスト表示する
Payment Intentのリストを返します。
エンドポイント: https://api.stripe.com/v1/payment_intents
操作: GET
例
cURLの例:
curl -X GET https://api.stripe.com/v1/payment_intents \
-u <YOUR_SECRET_KEY>:
レスポンス
レスポンスは標準コードを返します。
200: OK
{
"object": "list",
"data": [
{
"id": "pi_1234567890",
"object": "payment_intent",
"amount": 1000,
"currency": "usd",
"status": "requires_confirmation"
}
],
"has_more": false,
"url": "/v1/payment_intents"
}
400: Bad Request
{
"error": {
"message": "If passing an array with explicit keys (e.g. foo[0]=a&foo[1]=b) instead of as an array (e.g. foo[]=a&foo[]=b), the keys must be numeric and sequential starting from 0. You passed the keys `1`, we expected to have a key with the value `0`.",
"param": "expand",
"request_log_url": "https://dashboard.stripe.com/test/logs/req_kCeAL5FAly5bkh?t=1734734555",
"type": "invalid_request_error"
}
}
401: Unauthorized
{
"error": {
"type": "invalid_request_error",
"message": "Invalid API Key provided: sk_test_********************1234"
}
}
パラメーター
クエリパラメーター
| パラメーター | 型 | 説明 |
|---|---|---|
limit | 整数 | 返されるオブジェクトの数の制限。制限は1から100の間で、デフォルトは10です。 |
starting_after | 文字列 | ページネーションに使用するカーソル。starting_afterは、リスト内での位置を定義するオブジェクトIDです。 |
ending_before | 文字列 | ページネーションに使用するカーソル。ending_beforeは、リスト内での位置を定義するオブジェクトIDです。 |
expand[] | 文字列の配列 | レスポンス内のどのフィールドを展開するかを指定します。 |
Payment Intentを作成する
Payment Intentが作成されたら、支払い方法を添付して確認し、支払いを続行します。
作成時に confirm=true を使用することは、同じ呼び出しでPayment Intentを作成して確認することと同じです。 confirm=true を適用すると、confirm APIの任意のパラメーターを使用できるようになります。
エンドポイント: https://api.stripe.com/v1/payment_intents
操作: POST
confirm リクエストは HTTPS 経由で行う必要があります。
例
cURLの例:
curl -X POST https://api.stripe.com/v1/payment_intents \
-u <YOUR_SECRET_KEY>: \
-d "amount=212¤cy=usd&payment_method=pm_card_visa&confirm=true"
レスポンス
レスポンスは標準コードを返します。
200: OK
{
"id": "pi_3Rsx4dDtWMrPDtgt0mUrePJ9",
"object": "payment_intent",
"amount": 212,
"amount_capturable": 0,
"amount_details": {
"tip": {}
},
"amount_received": 0,
"application": null,
"application_fee_amount": null,
"automatic_payment_methods": {
"allow_redirects": "always",
"enabled": true
},
"canceled_at": null,
"cancellation_reason": null,
"capture_method": "automatic_async",
"client_secret": "pi_3Rsx4dDtWMrPDtgt0mUrePJ9_secret_7sqfufxuIYiBhbw52Vi51Z47o",
"confirmation_method": "automatic",
"created": 1754447247,
"currency": "usd",
"customer": null,
"description": null,
"last_payment_error": null,
"latest_charge": null,
"livemode": false,
"metadata": {},
"next_action": null,
"on_behalf_of": null,
"payment_method": null,
"payment_method_configuration_details": {
"id": "pmc_1RsGk1DtWMrPDtgtcaQ0d3Sg",
"parent": null
},
"payment_method_options": {
"amazon_pay": {
"express_checkout_element_session_id": null
},
"card": {
"installments": null,
"mandate_options": null,
"network": null,
"request_three_d_secure": "automatic"
},
"cashapp": {},
"klarna": {
"preferred_locale": null
},
"link": {
"persistent_token": null
}
},
"payment_method_types": [
"card",
"klarna",
"link",
"cashapp",
"amazon_pay"
],
"processing": null,
"receipt_email": null,
"review": null,
"setup_future_usage": null,
"shipping": null,
"source": null,
"statement_descriptor": null,
"statement_descriptor_suffix": null,
"status": "requires_payment_method",
"transfer_data": null,
"transfer_group": null
}
400: Bad Request
{
"error": {
"code": "parameter_invalid_integer",
"doc_url": "https://stripe.com/docs/error-codes/parameter-invalid-integer",
"message": "Invalid integer: <integer>",
"param": "amount",
"request_log_url": "https://dashboard.stripe.com/test/logs/req_UQf6XBwBl9yk66?t=1734829676",
"type": "invalid_request_error"
}
}
401: Unauthorized
{
"error": {
"type": "invalid_request_error",
"message": "Invalid API Key provided: sk_test_********************1234"
}
}
パラメーター
ボディパラメーター
| パラメーター | 型 | 説明 |
|---|---|---|
amount | 整数 | (必須) 収集される予定の金額。通貨の最小単位(例:$1.00を請求する場合は100セント)でいくら請求するかを表す正の整数。 |
currency | 文字列 | (必須) 3文字のISO通貨コード(小文字)。サポートされている通貨である必要があります。 |
confirm | boolean | このPaymentIntentを即座に確認しようとする場合はtrueに設定します。 |
customer | 文字列 | このPaymentIntentが属するカスタマーのID(存在する場合)。 |
description | 文字列 | オブジェクトに添付される任意の文字列。 |
payment_method | 文字列 | このPaymentIntentに添付する支払い方法のID。 |
payment_method_types[] | 文字列の配列 | このPaymentIntentが使用できる支払い方法タイプのリスト。 |
shipping | オブジェクト | PaymentIntentの配送情報。 |
statement_descriptor | 文字列 | 顧客のクレジットカードの利用明細に表示される任意の文字列。 |
statement_descriptor_suffix | 文字列 | 顧客のクレジットカードの利用明細に表示される追加の詳細情報を提供します。 |
expand[] | 文字列の配列 | レスポンス内のどのフィールドを展開するかを指定します。 |
Payment Intentを検索する
Stripeの検索クエリ言語を使用して、以前に作成されたPayment Intentを検索できます。
厳密な一貫性が必要なリード・アフター・ライト・フローでは、検索リクエストを使用しないでください。通常の状態では、データは1分足らずで検索可能になります。まれに、障害発生時に新規または更新されたデータの反映が最大1時間遅れることがあります。
インドの加盟店は検索機能を利用できません。
エンドポイント: https://api.stripe.com/v1/payment_intents/search
操作: GET
例
cURLの例:
curl -X GET "https://api.stripe.com/v1/payment_intents/search?query=amount:1000" \
-u <YOUR_SECRET_KEY>:
レスポンス
レスポンスは標準コードを返します。
200: OK
{
"object": "search_result",
"data": [],
"has_more": false,
"next_page": null,
"url": "/v1/payment_intents/search"
}
400: Bad Request
{
"error": {
"code": "parameter_invalid_string",
"doc_url": "https://stripe.com/docs/error-codes/parameter-invalid-string",
"message": "Provide a query parameter with a valid search query string.",
"param": "query",
"type": "invalid_request_error"
}
}
401: Unauthorized
{
"error": {
"type": "invalid_request_error",
"message": "Invalid API Key provided: sk_test_********************1234"
}
}
パラメーター
クエリパラメーター
| パラメーター | 型 | 説明 |
|---|---|---|
expand[] | 文字列の配列 | レスポンス内のどのフィールドを展開するかを指定します。 |
limit | 整数 | 返されるオブジェクトの数の制限。制限は1から100の間で、デフォルトは10です。 |
page | 文字列 | 複数ページの結果にわたるページネーション用のカーソル。最初の呼び出しにはこのパラメーターを含めないでください。以前のレスポンスで返された next_page の値を使用して、後続の結果をリクエストします。 |
query | 文字列 | (必須) 検索クエリ文字列。検索クエリ言語と、Payment Intentでサポートされているクエリフィールドのリストを参照してください。 |