#binay-subscriptions

1 messages ยท Page 1 of 1 (latest)

covert knot
#

Hello! Give me a minute and I'd be happy to help

north portal
#

When I say customer with premium subscription can opt for premium monthly as well, I mean at the same time customer can have both premium and premium_monthly subscription

#

I am using stripe checkout for subscription. Now, suppose a customer has bought a premium subscription and in future customer wants to buy premium monthly subscription as well. In that case, what I am currently doing is I am creating a stripe subscription using Subscription.objects.create api and passing the customer id of the customer. But I also need to pass default payment method of a customer. How can I obtain that?

covert knot
#

Usually, you'd find the default payment method of a customer at invoice_settings.default_payment_method - but this may be different for checkout. Have you already checked there?

north portal
#

Yes I tried, but did get anything from there

#

I also tried stripe.customer.list_payment_methods api, but it returns the list of all payments methods associated with the customer and there is no annotation to identify which one is default one

covert knot
#

I believe the issue here is that Checkout does not set a default on the customer - it just sets the default on the specific subscription. If you know the subscription that was previously created through Checkout you should be able to check default_payment_method (https://stripe.com/docs/api/subscriptions/object#subscription_object-default_payment_method) and get it from there

north portal
#

After successful chekout, I am storing the customer id and subscription id in my database. Are you suggesting to obatin the subscription object using that id and obtaining the default_payment_method from there

#

?

tidal forge
#

Hi there ๐Ÿ‘‹ taking over for karbi

That is correct. Just making a retrieve call to get the default_payment_method from the Subscription

north portal
#

Okay, let me try.