#AM-payments
1 messages · Page 1 of 1 (latest)
@wise quail if you only have a token tok_xxx then you first have to convert it to a PaymentMethod by calling https://stripe.com/docs/api/payment_methods/create#create_payment_method-card (it notes how to convert a token to a PaymentMethod)
then you would use that resulting pm_xxx PaymentMethod to confirm a SetupIntent(https://stripe.com/docs/api/setup_intents) which attaches it to a customer.
ideally you'd change your frontend so you can just do all this client side per https://stripe.com/docs/payments/save-and-reuse but it it possible to do this with your current set up I think, it's just advanced.
I get the following error: A source must be attached to a customer to be used as a payment method. Where did I go wrong?
And btw thanks for answering my question directly and not just saying update the frontend. Much appreciated!
do you have the request ID req_xxx for that error you got? https://support.stripe.com/questions/finding-the-id-for-an-api-request
req_9dctCk41WexUw5
yep you can't use a card_xxx directly in a call like that(I assume you pulled that from the token->card->id in your code)
you have to convert the token to a PaymentMethod first as mentioned above, and then use the PaymentMethod with the SetupIntent
Where do I use the token here?
Ok, I'll give that a go and let you know if it works. Thanks