#gasper_api

1 messages ยท Page 1 of 1 (latest)

tender shuttleBOT
#

๐Ÿ‘‹ 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.

quartz sun
#

You need to make an update API call on the customer and set the collected/saved Payment Method as a default one:

queen stirrup
#

you mean after payment method is created using payment sheet API?

quartz sun
#

Yes

queen stirrup
#

but as I spoke with mobile dev he said he don't get payment method id back when creating new payment method

#

@quartz sun still here?

queen stirrup
#

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

quartz sun
#

Yes you can fetch all the Customer's payment method and set their latest one as a default one via your backend.

queen stirrup
#

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.

quartz sun
queen stirrup
#

what about webhook?

#

payment_method.attached ?

quartz sun
tender shuttleBOT
queen stirrup
#

when new payment method is created using payment sheet api, Is it automatically attached to the customer

quartz sun
#

Is it automatically attached to the customer
If you are using SetupIntent, yes it is.

queen stirrup
#

yes we are using setup intent

quartz sun
queen stirrup
#

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?

quartz sun
#

Yes exactly

queen stirrup
#

can this be done differently? Or this is how it shoud be done?

ancient perch
#

Hi! I'm taking over from my colleague. Please, give me a moment to catch up.

#

Why do you want to do it differently?

queen stirrup
#

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

ancient perch
#

No, you will need to set the default Payment Method manually, one way or the other.

queen stirrup
#

ok, tnx!

ancient perch
#

Happy to help.