#_api

1 messages ¡ Page 1 of 1 (latest)

storm ferryBOT
hot cargoBOT
#

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.

  • _api, 6 days ago, 14 messages
  • _api, 6 days ago, 30 messages
storm ferryBOT
#

👋 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/1276159077977821277

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

rustic meadow
#

hi there!

desert snow
#

hello!

rustic meadow
#

no, a Checkout Session can only create brand new Subscriptions.

#

but why whould you need this? to exit an existing Subscription?

desert snow
#

no, we want to give users a payment page when they want to go pay for a trial

rustic meadow
#

then why not use a Checkout Session to create a new Subscription?

#

I'm not sure I understand your use case.

desert snow
#

so a trial creates a subscription object in the backend, and we want to add payment details to that trial so that it becomes a paid subscription rather than a whole new subscription

rustic meadow
#

so your goal is to add a payment method to a Subscription that is active with a trial?

storm ferryBOT
desert snow
#

Yea that's our current solution

#

but what we want is a link to the payment page you get when you do a subscription - is that possible?

rustic meadow
#

I don't undertsand your question. if you use the customer portal, users will be able to add a payment method to their subscription.

desert snow
#

I know that it works, but we want to reduce the friction since customer portal has a lot showing there

#

we want them to land directly on the payment page for subscriptions

rustic meadow
glass sonnet
#

Hi, stepping in and catching up

desert snow
#

Hello

#

Let me know if you need me to clarify anything

#

also in a work call, don't clsoe the thread

glass sonnet
glass sonnet
#

const session = await stripe.billingPortal.sessions.create({
customer: '{{CUSTOMER_ID}}',
return_url: 'https://example.com/account/overview',
flow_data: {
type: 'payment_method_update',
},
});

desert snow
#

by doing this, the customer will only be shown the payment page and nothing else?

desert snow
glass sonnet
#

Yes, that is correct. I highly recommend that you test this using your test api key and play around a bit.

desert snow
#

what about the other question i asked?

glass sonnet
#

I am sorry, can you clarify which question? I might have missed it

glass sonnet
#

I shared the code with you before

#

Can you try it please?

desert snow
#

that is for billing portal and this is "update_payment_method"

#

okay

glass sonnet
#

Yes, that is correct.

desert snow
#

do you have the api docs for this?

#

im using python and you've shared js

desert snow
#

I tried it out and see what you mean

#

this works, thanks!

#

wait

#

how is this attached to a current subscription?

#

i need it to be for a specific customer for a specific subscription - this doesn't have that

glass sonnet
#

Are you saying that if a customer has 2 subscriptions, you would want them to update the payment method on only one of the subscriptions? Why?

desert snow
#

yes

#

because if customer has two subscriptions, and they want to purchase only one of them for the next month, I don't want them to put their payment details for both of them

#

just the one they want to purchase

#

the same idea with trials as well

glass sonnet
#

That is not possible. The above method updates this customer.invoice_settings.default_payment_method on the customer object.

desert snow
glass sonnet
desert snow
#

this creates a customer portal session

#

the link i shared is not a csutomer portal

#

please look at the link

glass sonnet
#

The link you shared is using the CustomerPortal but you would use it with the deep link I shared with you above.

#

Can you try passing the customer id to the previous code you tested?

desert snow
#

I did pass in a customer id

#

I want to pass in a subscription id as well

#

i need it to be for a specific customer for a specific subscription - this doesn't have that

glass sonnet
#

That is not possible

desert snow
#

It is!

#

I made the link through the stripe portal earlier

#

how can I make it programtically?

#

its not a customer portal link

glass sonnet
desert snow
#

the earlier snippet of code you shared is a billing portal and this is to create a customer portal

#

I don't it's possible from our conversation

#

thanks for the help

glass sonnet
#

Sure!