#waleed-khalid_api
1 messages · Page 1 of 1 (latest)
👋 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/1300758713736626207
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
Hello os4m37
👋
Hello, can you please guide me on api reference and flow
I need to implement subscription model in our system just like netflix.
I need to give free trial to customer for starting 10 days but capture their credit card details. for future autmatically capture payments from customer saved payment method. Need to have webhooks for all events so I can provision customer access. Also if automatic payment failed how we can proceed with it.
This guide is a good starting point
And this one for configuring trial
Then you can monitor the æctive subscription using these webhooks:
https://docs.stripe.com/billing/subscriptions/webhooks#active-subscriptions
You can do multiple simulations using Stripe test clock:
https://docs.stripe.com/billing/testing/test-clocks
👋 taking over for my colleague. Let me know if there's any follow-up Qs I can answer!
sure i am still confused over the flow.
keeping trial thing apart. I need to implement subscription flow
ok let's start by figuring out how you want to integrate with Stripe?
do you want to use the Checkout Sessions (hotsted or embedded) or are you looking for a custom form using PaymentElement?
First I need to capture customer credit card details only so it will be saved payment method against my customer on stripe
then i did not need any any form stripe will automatically capture funds from client saved payment method
this is what i need to implement
what you're describing is basically using SetupIntents to attach a PaymentMethod to your customer and then creating the Subscription later
that's not how we recommend building the Subscription flow
I need same like netflix
how it captures customer credit card at first and then capture amount automatically when subscription ends adn satrt new one
regardless of what the UI will finally look like
the integration path is still the same
also that doesn't answer which Stripe component you will be using Checkout Sessions or PaymentElement
let's start by taking that decision
I will be using checkout session api for custom ui
in that case you need to be looking at this guide here https://docs.stripe.com/billing/subscriptions/build-subscriptions?platform=web&ui=embedded-form
this is the form to collect money from customer ?
and it will save the payment method for future use right ?
yes
you just need to pass the subscription_data for trial and the recurring price in the line_items
you can download this quickstart https://docs.stripe.com/checkout/embedded/quickstart if you haven't started with your project
of course instead of mode payment you would replace that with mode subscription
i am checking this
let me know if you need any more help
I am checking
dont need to do anything for future auto payments strip will auto deduct from credit card ?
yes, but you also need to keep track of payment failures due to requiring additional action from the user
that was what my colleague was trying to say when they suggested using webhooks https://docs.stripe.com/billing/subscriptions/webhooks#additional-action
to provision access to your service
you just need to pass the subscription_data for the recurring price in the line_items
where to send subscription_data recurring price
you pass https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-line_items-price for the recurring price
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
and https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-subscription_data-trial_period_days for trial days
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
recurring price is what stripe will capture from customer card when subscription endds? and stripe will again deduct amount ?
to continue that subscription ?
no the recurring price is the price per cycle
so each cycle Stripe will attempt collecting that price
I have 2 products for moonthly subscription and yearly subscription. can you send me an example checkout session api which mention recurring price, mode subscription etc
but you can't have 2 different price intervals in the same subscription
like a yearly and a monthly prices
line_items: {
price_data: {
currency: "",
product: "product_id",
recurring: {
interval: "month",
internal_count: 3
}
}
}
is this right
Hi! I'm taking over from my colleague. Please, give me a moment to catch up.
sure