Update a PaymentIntent
POST
/v1/payment_intents/{id}Updates properties on a PaymentIntent object without confirming.
Depending on which properties you update, you may need to confirm the PaymentIntent again. For example, updating the payment_method will always require you to confirm the PaymentIntent again. If you prefer to update and confirm at the same time, we recommend updating properties via the confirm API instead.
请求参数
Path Params
id
string
required
Body Params application/json
payment_method_data
string
optional
If provided, this object will be used to create a PaymentMethod. The new PaymentMethod will appear in the payment_method property on the PaymentIntent.
Example
{
"amount": 10,
"currency": "USD",
"confirm": true,
"payment_method_data": {
"type": "card",
"card": {
"exp_month": "12",
"exp_year": "2026",
"number": "4111111111111111",
"cvc": "123"
},
"billing_details": {
"address": {
"line1": "XX mansion",
"line2": "XX Town",
"city": "city",
"state": "California",
"country": "US",
"postal_code": "55555"
},
"name": "Tom"
}
},
"description": "product description",
"quantity": 2,
"metadata": {
"key1": "value1"
},
"merchant_user_id": "123456",
"merchant_order_id": "Order112344343",
"shipping": {
"address": {
"line1": "XX mansion",
"line2": "XX Town",
"city": "city",
"state": "California",
"country": "US",
"postal_code": "xxx xxx"
},
"name": "tom",
"phone": "xxxx"
},
"return_url": "https://your.website"
}
示例代码
Responses
OK(200)
HTTP 状态码: 200
内容格式: JSONapplication/json
Data Schema
object {0}
Example
{
"id": "pi_1604012360740110336",
"object": "payment_intent",
"created": 1671261323000,
"currency": "USD",
"amount": 10,
"status": "succeeded",
"description": "product description",
"metadata": {
"key1": "value1"
},
"livemode": false,
"shipping": {
"address": {
"city": "city",
"country": "US",
"line1": "XX mansion",
"line2": "XX Town",
"state": "California",
"postal_code": "xxx xxx"
},
"carrier": null,
"name": "tom",
"phone": "xxxx",
"tracking_number": null
},
"customer": null,
"quantity": 2,
"invoice": null,
"merchant_user_id": "123456",
"merchant_order_id": "Order112344343",
"client_secret": "pi_1604012360740110336_secret_YYFHuk8Lago3RSqjbVFe68AA",
"last_payment_error": null,
"next_action": null,
"payment_method_types": "[\"wechat_pay\",\"alipay\",\"card\"]",
"receipt_email": null,
"cancel_at": "",
"cancellation_reason": null,
"confirmation_method": "automatic",
"payment_method_options": "{\"card\":{\"request_three_d_secure\":\"auto\",\"capture_method\":\"automatic\"}}",
"3ds_status": null,
"amount_capturable": null,
"return_url": "https://your.website",
"payment_method": "pm_1604012357044928512",
"amount_received": null,
"capture_method": "automatic"
}
Last modified: 9 个月前