Attach a payment method to a payment intent

Attaches a payment method, which starts the authorization and returns the payer's next_action. Served where the intent and the method live, whatever the organization's rollout, in the same response shape either way: an intent payments-api does not run is attached on core-api; one payments-api runs is attached there when payments-api holds the method, and is otherwise handed back to core-api, which attaches a method it holds. When payments-api cannot say who runs the intent or whether it holds the method, the attach fails and nothing is attached. A request carrying payment_method_options is served by either; on payments-api it is not applied. A saved (vaulted) method attached to an intent created with setup_future_usage must be saved to that intent's customer_id, checked against customer-api; otherwise the attach answers parameter_invalid on payment_method. Without setup_future_usage, a saved method need only belong to the same organization. On payments-api, a method saved off_session, a subscription's card, is attached only with a secret key: with a public key the attach answers payment_method_not_allowed on payment_method. payments-api's refusal of an attach, such as its 409 resource_locked for a spent method or an intent taking no method, is answered as payments-api sends it, payment_method_id named payment_method. An attach declined at once, leaving the intent awaiting_payment_method, answers 400 resource_failed_state on payment_method on either service, whatever the method: sub_code is the decline's code, null when it has none, and the body is the error alone, so the intent and its last_payment_error are read with a GET. An attach payments-api applied whose payments then cannot be read answers 500 internal_server_error, its detail saying the payment method was attached: retrieve the payment intent, which carries next_action, rather than attaching again.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Path Params
string
required

Payment intent ID

Body Params

Payment method to attach

data
object
Responses

Language
Credentials
Basic
base64
:
URL
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json