Hi, I’d like to add a new payment method in stripe to an existing customer and set that payment method as the default. Is there a way to do that with the out-of-box credit card component? I can get it to add the new card (and not charge where currency = 0) but that new card is not set as the “default”.
Hi there @blschaef15,
Unfortunately this is not possible via the Card component. Seems doable using the Stripe API endpoints for Payment Methods. I’d recommend looking into the API docs and see if the endpoints allow for the functionality you are trying to achieve.
Thanks Nico. Is there a way to access the Stripe response after clicking “submit/update” via the card control? If I could get the returned payment method / card ID then I could make another request to set as default.
Hey @blschaef15 so I played around with this a bit, let me know if this is what you are looking for. So with the credit card control, you have the ability to return the payment token on the control on submit, you want to make sure the Return Payment Token toggle is checked.
This token is surfaced through the event namespace on the submit successful event on the credit card control. You can see here, i’m setting a variable to
What this looks like in the debugger, is there are two properties that get surfaced, which is
It looks like with this
tokenId, you can possibly get the
cardID using the Retrieve Token API. Meaning you can pass the tokenID to a data flow and use the HTTP data operation to get the Card ID.
One thing to be mindful of is checking to see if the card ID from Stripe is sensitive information, as you wouldn’t want to pass/store/touch credit card information more than necessary.