#adamreisnz-billing
1 messages · Page 1 of 1 (latest)
Thank you
Yes, i'd recommend using SetupIntents instead.
You don't have to do a separate API call to attach the payment method to the Customer if you're using SetupIntents. When you include the Customer id in the SetupIntent and confirm the SetupIntent, the attachment will automatically be done
this guide is particularly useful : https://stripe.com/docs/payments/save-and-reuse
Right, but that will still require 2 server roundtrips, would it not?
Unless I create the customer on the client
Currently, the customer is created on the server
I should clarify that we only create the customer when they confirm their plan
- Customer is created on the server
- SetupIntent is also created on the server
- Confirm SetupIntent occurs on client-side
yep ^ will still require 2 server roundtrips yeah
To avoid cluttering our Stripe account with ghost customers
Ok, yep, and then the 2nd server call would be to create the subscription
Ok, I'll see if we can make it as customer friendly as we can
So that it appears as a single step to them
Thanks for the tips, I will see how we go with the setup intents
You're welcome! Feel free to reach out again if you have any questions!
Will do, cheers
Cool, this seem to have largely worked. The only problem appears to be, that after creating a new customer and then setupIntent, it doesn't seem like that payment method is automatically set as the default.
So when creating a new subscription, it throws the error This customer has no attached payment source or default payment method.
Is there a flag we can pass somewhere when confirming the setup intent to set this payment method as the default for the customer?
Since we are no longer creating a payment method first, we don't have a good way of passing this when creating the customer.
ah yes, it's unfortunate that we don't have this as an in-built feature/parameter
you'll need to set it here : https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method
Yes, I thought so
So I'll just have to query the customer's payment methods and then update the customer to set one of them as default
yep
Yes it'd be great if this could be automated
i'll pass on this feedback to the relevant team!
Cheers thanks
I'll see if we can obtain the paymentMethod ID from the confirmSetupIntent call, that would make it easier and avoid the need to query the payment methods
you definitely can, below snippet is in JS
if (result.setupIntent.status === 'succeeded') {
console.log(`SetupIntent success : ${result.setupIntent.payment_method}`);
}
this is what i've done before
Yes, will use that
This has worked well 👍
One more question while I have you here, for Stripe Billing, I was wondering why it's not possible to submit the currency code when creating a customer? It appears this is only set once a first invoice or payment is processed.
However, occasionally this will cause mistakes, if for example we create a customer first, and then manually create an invoice for something other than the billing subscription.
It has happened that we then forgot to use the correct currency, which then led us having to discard that customer and create a new one, because the currency can't be changed (even though the invoice was still a draft!)
Maybe that's some feedback you could pass on as well, to allow us to set the customer's currency code when creating the customer
It will automate it and make it less human error prone
hmm, i don't really have the context for this decision off the top of my head, let me quickly check in with some other folks if they know why
Alright
@regal zephyr no one knows off the top of their head why. i'd like to mention that the product team is aware of the limitations of having only one currency (that cannot be updated) on a Customer. They're considering how to improve things, but nothing concrete that can be shared at this point in time