#Mohana-default_payment_method
1 messages ยท Page 1 of 1 (latest)
okay ๐
https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
invoice_settings.default_payment_method
np!
source is a legacy parameter
invoice_settings.default_payment_method is newer and take precedence
source is only there for old API level compatible users
cool ๐ thanks
hi guys
so i am having one more query
I have created a subscription for a customer and since he does not have an invoice, i am using the send invoice via email option
when the customer pays for the invoice, i can see that the payment methods are collected and set as default payment method in dashboard
When i retrieve the customer object, i am seeing the default payment method in default source parameter and not in invoice_settings.default_payment_method
What I am trying to achieve is, when creating subscriptions, i need to check if the customer has a payment method saved and if so, charge for the subscription via the default payment method
i guess i can't just look at the invoice_settings.default_payment_method and come to a conclusion as to whether or not the customer has a payment method set right ?
I'm assuming you have built a UI for your subscription creation where your customers checkout via?
i.e. where they can select their payment method
Umm, we had to not use checkout sessions because we were unable to set billing_cycle_anchor through checkout sessions
so, the payment for initial subscription for a new customer will be collected via the invoice sent by email
once the payment methods are collected, successive subscriptions/renewals will make use of the default payment method (if available)
Do you have an example cus_xxx I can look at?
I'm surprised invoice_setting.default_payment_method is unset after the invoice is paid
Yep, I guess the Hosted Invoice Page instead sets the default_source on the Customer object: https://dashboard.stripe.com/test/logs/req_ohzYxVe20IWkDN
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
is that intentional ?
earlier Orakaro mentioned that field was a legacy field for old api
Seems that way! Although not sure why โ let me test to confirm
okay ๐ with that info, will either customer's default source or invoice_settings.default_payment_method provide me whether or not I can create subscriptions with collection_method as charge_automatically ?
Yep I can replicate this!
Okay ๐
Well, those fields might contain a Payment Method/Source object or they might not
๐ฎ
Assuming there's been a previous Hosted Invoice Page payment then it looks like the default_source field is set. But equally, that can be unset via the API/Dashboard
Ahhh I see
So if either customer.default_source or customer.invoice_settings.default_payment_method is set, a new subscription can be created right ?
with collection_method as charge_automatically ?
Yes, and we will automatically attempt to charge the provided payment method
cool ๐
one more request, is it possible to include the billing_cycle_anchor on the checkout session api ?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
We want to create subscriptions which renews 1st of every month
Is it to specifically start on that date, or just renew then?
you can start the subscription on any date but it will always renew on 1st of month
so the first cycle will be short of 30 days
and rest all will fall on 1st of every month
when i mentioned as a request, i hope you got it as a feature request right ?
we had this conversation a couple of days back ๐ and i got several alternatives for that
Got it. Yep, it's a common ask. Just trying to understand the use case as some merchants want to specify a date on which the subscription starts too
Right now you could use one of the trial parameters to se tthe billing anchor
you too