#gasper_api
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1283716717645922325
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- gasper_api, 1 day ago, 20 messages
- gasper_paypal-future-charges, 2 days ago, 19 messages
You need to make an update API call on the customer and set the collected/saved Payment Method as a default one:
you mean after payment method is created using payment sheet API?
Yes
but as I spoke with mobile dev he said he don't get payment method id back when creating new payment method
we followed this documentation https://docs.stripe.com/payments/save-and-reuse?platform=react-native&mobile-ui=payment-element
@quartz sun still here?
They can fetch it from your backend
our customer can have multiple payment methods, and when they add new payment method we would like that this newly added card become default one
Yes you can fetch all the Customer's payment method and set their latest one as a default one via your backend.
before using payment sheet we were creating payment methods where we used different api which returned us payment method token which was sent to our BE api where we set it as default payment method
`customer = stripe_client.customer.retrieve(user_stripe_account.token)
# attach new payment method to customer
stripe_client.payment_method.attach(
payment_method_id, {
customer: user_stripe_account.token
})
# update default payment method
stripe_client.customer.update(
customer.id,
{ preferred_locales: preferred_locales, invoice_settings: { default_payment_method: payment_method_id } }
)`
like this
now when using payment sheet api new payment method is created but in response we do not get payment method id whith which we could set it as a default payment method
aha I missed your suggestion
Yes you can fetch all the Customer's payment method and set their latest one as a default one via your backend.
๐
For what usage exactly ?
when new payment method is created using payment sheet api, Is it automatically attached to the customer
Is it automatically attached to the customer
If you are using SetupIntent, yes it is.
yes we are using setup intent
And yes this is a good event to listen to
so either our mobile dev create new api request on our BE after new payment method is created and we retrieve all payment methods using payment_methods = stripe_client.customer.list_payment_methods(customer_token) and set the latest one as default OR we listen to payment_method.attached webhook call?
Yes exactly
can this be done differently? Or this is how it shoud be done?
Hi! I'm taking over from my colleague. Please, give me a moment to catch up.
Why do you want to do it differently?
I don't know, asking just if there is any better approach, if there is smth we can set when using payment sheet api when creating new payment method
we would like to avoid extra api calls or creating webhooks
No, you will need to set the default Payment Method manually, one way or the other.
ok, tnx!
Happy to help.