#dario2082

1 messages · Page 1 of 1 (latest)

open hearthBOT
weary beacon
#

How are you creating the Subscription ?

#

the subscription's default_payment_method is set when creating the Subscription

jade rapids
#

the subscription is created by Stripe when the user pay on our website. We use Stripe checkout

#

Before adding the second payment method on Customer portal I got the payment method. Then Iin the customer portal I added a new payment method and updated the plan from monthly to annual. Since this moment I didn't get the payement method anymore

weary beacon
jade rapids
#

Why I have to set the payment methods via the API if the user do it himself when paying the subscription ? And he added a new method in the Stripe customer poartal. I just want to retrieve his default payment method

open hearthBOT
weary beacon
#

Why I have to set the payment methods via the API if the user do it himself when paying the subscription ?
They are setting the payment method to use for the purchase but not as default one for the subscripiton and the upcoming invoices

jade rapids
#

yes there is a default payment method

#

for the upcoming invoices

weary beacon
#

Could you please share the Subscription Id ?

jade rapids
#

and when I get subscription with Subscription.retrieve the object DefaultPaymentMethod is null

#

it's in test mode

#

sub_1Nqbe2ICe6O7NPDIQ4mtAjiM

#

before adding the new payment method everything worked fine

weary beacon
#

The default payment method of the subscription was removed after this action on the customer portal req_48y4WEXlRlKQF3

jade rapids
#

yes, it's when the user added the new payment method

#

that is the default one now

weary beacon
#

The screenshot you are referring to is the default customer's payment method and not the subscirption's default payment

jade rapids
#

as you can see in the Customer portal

weary beacon
jade rapids
#

OK so How can I get the default payment method of the user ?

jade rapids
#

Customer customer = Customer.retrieve("cus_OdtQzgH9UafuTA");
PaymentMethodCollection paymentMethods = customer.listPaymentMethods();

#

If I do this, I get two payment methods, but I don't know which is the default one

weary beacon
jade rapids
#

OK thank you. Do you know if I can expand this field when I get the customer ? to avoid to make 2 api calls

weary beacon
#

yes you can expand the customerfield when retreiving the subscription

jade rapids
#

yes but how can I expand the defaultPaymentMethod in invoiceSettings.defaultPaymentMethod ? because I'm getting only the ID

weary beacon
#

you pass the expand property invoice_settings.default_payment_method when fetching the customer

jade rapids
#

ok thank you very much