#dev-commerciax_api

1 messages ยท Page 1 of 1 (latest)

copper belfryBOT
#

๐Ÿ‘‹ 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/1397842468829003878

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

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.

gusty solar
vivid gale
#

Checkout Session and Subscription Schedule are 2 different things. It's expected that they will create a Subscription themselves, so you have 2 Subscriptions

gusty solar
#

SO, What's the solution? I am using embedded checkout in my frontend which expects a client secret and checkout session id which I can get both from only a checkout session

#

I went through the docs and all there is, is how to create a subscription schedule, and nothing about how to take the payment or any integration guides

vivid gale
#

Let's take a step back. What are you trying to achieve? Normally you only use either one of those API (Checkout vs Subscription Schedule)

gusty solar
#

So, I want to give my users a paid trail before the subscription starts. like 3 months @ $1. So, first month they pay $1 and then the next 2 months they are not charged anything and then in the 4th month, they pay the actual subscription price.

#

But this was complex and there were a lot of issues. So, I asked for help and one of the stripe devs suggested me to use subscription schedules

#

But Since there's not much on it I was doing it the way I shared

vivid gale
#

Hmm I think that approach is fine though... Which kind of issues you have? Sorry don't mean to revert the conversation, just want to understand the context correctly

gusty solar
#

No problem, There were a lot like since the payment intent is not related to susbcription directly I was not getting the invoice linked to subscription. The correct invoice for initial payment. Also, the payment method was not linked to customer in that case and I couldn't show that either. And Sincerely No billing reached the 3 moths, So I wasn't sure if they will be charged correctly since the payment method is not linked to subscription but rather it was one time payment. and so on

vivid gale
#

Well I think once you can manage the linkage (using metadata for example), you can solve them all. But okie let's put that aside

#

Let's say now you want to use Subscirption Schedule. Do you need to collect the customer payment method before starting the trial?

gusty solar
#

Yes, Since there are lot of customers Who use defaulted cards which has 0 balance and take free trial. So the company thought of converting it into paid trial.

#

As soon as the subscription starts and initial payment is done, customers can see their chosen payment method in the dashboard

vivid gale
#

Sure. So

  1. Use a Checkout Session in Setup mode to collect the customer payment method.
  2. Take the collected Payment Method inside the SetupIntent, set to the customer's default payment method
  3. Proceed to create a Subscription Schedule on that Customer, setting trial to 3 months
copper belfryBOT
wise carbon
#

๐Ÿ‘‹ taking over for my colleague. Let me know if there's any follow-up Qs I can answer!

gusty solar
#

Earlier I was recieving customer.susbcription.updated where I handled payment method as payment method id was available but this mode doesn't do that. and Since I can't attach any metadata to payment.method.attached event, it would be hard for me to track the payment method in subscription

tiny oyster
#

hi! I'm taking over this thread.

#

not sure I really understand your question about metadata. can you share more details about your use case?

gusty solar
#

So, is there a better way to track the related payment method? I only get these 5 events

#

Okay, So I am using subscription schedules with setup mode checkout session for initial payment. shared the code bove

#

I recieve only these events this time compared to earlier where I was recieving a lot more events and handling the susbcription data. Now I need to link the susbcription to the payment method attached

#

but since payment.method.attached doesn't take any metadata from my side, it is hard to track without a payment method id, unless I store it which is not a good way for stateless server.

#

So I was tracking it earlier in subscription.updated event but Now I don't recieve it, so How do i link them?

#

Since checkout.session.completed also doesn't provide me with payment method id

#

If either I could attach some meta to the payment.method.attached event or I could get its id in some other event where I recieve the meta, so I would be able to track it

tiny oyster
#

why not listen to the checkout.session.completed event? and with that event you should be able to retrive all the information you need: customer, payment method, etc.

#

also note that I think your flow could be simplified:

  • Directly create a Subscription with the Checkout Session. you can use Discount to lower the first amount the user has to pay
  • As soon as the Subscription is created, then you can transform the existing subscription into a subscription schedule with multiple phases
copper belfryBOT
gusty solar
#

This is the event object where I am not getting payment method Id or customer billing address. Not only that I am also not getting the invoice details in invoice.created, it has number, url and other properties as null

vague mesa
#

Hey! Taking over for my colleague. Let me catch up.

gusty solar
#

Sure, do take your time

vague mesa
#

This Checkout Session, was created for setup mode evt_1RoKI1SCN5U3Z9OGTxYWbKh9 and not for Subscription