Endpoint to delete a credit card

Hello,

I’m looking through the documentation for a way to delete a saved credit card from a user’s account, but I haven’t found anything yet.

Would anyone happen to know?

Good morning, Igor!

There is an option via API, which requires a user Cookie with the Telesales User access profile to perform these actions.

After that, the first step would be to use the Get client profile by email API to retrieve the creditCardAccountId:

curl --location 'https://{{accountName}}.vtexcommercestable.com.br/api/checkout/pub/profiles?email={{customerEmail}}' \
--header 'Content-Type: application/json' \
--header 'Accept: application/vnd.vtex.ds.v10+json' \
--header 'REST-Range: resources=0-10' \
--header 'VtexIdclientAutCookie:{{CallCenterAuthCookie}}' \
--header 'Cookie: janus_sid=07a0c9c8-2cad-4238-849b-252d50f5b3e7'

After that, just make a DELETE request to delete the data, replacing the creditCardAccountId in the following request:

curl -X DELETE 'http://{{accountName}}.myvtex.com/api/checkout/pub/current-user/payments/{{creditCardAccountId}}' \
-H 'Content-Type: application/json' \
-H 'Cookie: VtexIdclientAutCookie={{CallCenterAuthCookie}}; vtex-impersonated-customer-email={{customerEmail}}'

Karina Mota
Field Software Engineer | VTEX