Sample - Stripe API
POST/v1/payment_methods/{payment_method}/detach

Detach a PaymentMethod from a Customer

Detaches a PaymentMethod from a Customer. Use payment_method to identify the instrument to detach and expand to request additional response fields. Detachment is permanent and irreversible, so you cannot use or re-attach the PaymentMethod after this operation.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.
  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

1 parameter · 1 body field
payment_methodstringrequired
The identifier of the PaymentMethod to detach, with a maximum length of 5,000 characters.

Optional form-encoded options controlling the PaymentMethod response.

expandarray<string>optional
Specifies which fields in the response should be expanded.

2 status codes
200Returns the detached PaymentMethod object, including its identifier, type, billing details, and current payment instrument data.
acss_debitobjectoptional
affirmobjectoptional
afterpay_clearpayobjectoptional
alipayobjectoptional
allow_redisplaystringoptional
This field indicates whether this payment method can be shown again to its customer in a checkout flow. Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow. The field defaults to “unspecified”.
Allowed:alwayslimitedunspecified
almaobjectoptional
amazon_payobjectoptional
au_becs_debitobjectoptional
bacs_debitobjectoptional
bancontactobjectoptional
billieobjectoptional
billing_detailsobjectrequired
bizumobjectoptional
blikobjectoptional
boletoobjectoptional
cardobjectoptional
card_presentobjectoptional
cashappobjectoptional
createdintegerrequired
Time at which the object was created. Measured in seconds since the Unix epoch.
cryptoobjectoptional
customobjectoptional
customerstringoptional
The ID of the Customer to which this PaymentMethod is saved. This will not be set when the PaymentMethod has not been saved to a Customer.
customer_accountstringoptional
customer_balanceobjectoptional
epsobjectoptional
fpxobjectoptional
giropayobjectoptional
grabpayobjectoptional
idstringrequired
Unique identifier for the object.
idealobjectoptional
interac_presentobjectoptional
kakao_payobjectoptional
klarnaobjectoptional
konbiniobjectoptional
kr_cardobjectoptional
linkobjectoptional
livemodebooleanrequired
If the object exists in live mode, the value is `true`. If the object exists in test mode, the value is `false`.
mb_wayobjectoptional
metadataobjectoptional
Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
mobilepayobjectoptional
multibancoobjectoptional
naver_payobjectoptional
nz_bank_accountobjectoptional
objectstringrequired
String representing the object's type. Objects of the same type share the same value.
Allowed:payment_method
oxxoobjectoptional
p24objectoptional
pay_by_bankobjectoptional
paycoobjectoptional
paynowobjectoptional
paypalobjectoptional
paytoobjectoptional
pixobjectoptional
promptpayobjectoptional
radar_optionsobjectoptional
Options to configure Radar. See [Radar Session](https://docs.stripe.com/radar/radar-session) for more information.
revolut_payobjectoptional
samsung_payobjectoptional
satispayobjectoptional
scalapayobjectoptional
sepa_debitobjectoptional
sofortobjectoptional
sunbitobjectoptional
swishobjectoptional
twintobjectoptional
typestringrequired
The type of the PaymentMethod. An additional hash is included on the PaymentMethod with a name matching this value. It contains additional information specific to the PaymentMethod type.
Allowed:acss_debitaffirmafterpay_clearpayalipayalmaamazon_payau_becs_debitbacs_debitbancontactbilliebizumblik
upiobjectoptional
us_bank_accountobjectoptional
wechat_payobjectoptional
zipobjectoptional
defaultError response.
errorobjectrequired

Error handling

payment_method must be a string no longer than 5,000 characters. Each value in expand must be a string no longer than 5,000 characters; review the permanent detachment before submitting the request.