#ali-ahmadi_api

1 messages ¡ Page 1 of 1 (latest)

edgy quarryBOT
#

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

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

crystal cedarBOT
past gulch
#

Hi, let me help you with this.

white zodiac
#

thanks for your reply. this option in create subscription Api, when should I call this api in my flow? at this time I only call checkout api and this api creates subscriptions for my users

past gulch
#

Yes, that should be possible.
So the plan is the following:

  1. Create a Checkout Session in mode "subscription", as you already are.
  2. Listen to checkout.session.completed webhook event: https://docs.stripe.com/api/events/types#event_types-checkout.session.completed
  3. Call Subscription update endpoint with ID of the new Subscription (event.data.subscription), with collection_method: "send_invoice" and days_until_due: https://docs.stripe.com/api/subscriptions/update#update_subscription-days_until_due
white zodiac
#

thank you very very much. for clarification, this method will act same as create subscription from dashboard and in Subscription settings-> check Email invoice to the customer to pay manually?

past gulch
#

Actually there's an easier way. You can just create a Subscription directly, and specify collection_method: "send_invoice". You don't need Stripe Checkout for this, the first Invoice will be sent to the customer's email immediately.

past gulch
past gulch
white zodiac
#

1- As docs mentioned:"and mark the subscription as active", is there any way to set the subscription incomplete until the user pays the invoice?
2- I didn't get any invoice email after creating subscription for pay the invoice

past gulch
#
  1. Only the first Invoice?
  2. Are you trying in test mode?
white zodiac
#
  1. It's okay to change the status of the first invoice to incomplete.
  2. Yes, I'm currently in test mode
past gulch
white zodiac
#

Thank you very much

past gulch
#

Happy to help.