#kshitij khanal
1 messages · Page 1 of 1 (latest)
what do you have so far? can you paste your code snippet?
I am a new developer in this project. Let me have a look in the project.
In the meantime, can you provide me some curl request sample that achieves such feature?
I passed you the guide to refer to : https://stripe.com/docs/billing/quickstart in our previous conversation
that should provide a good starting point
const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const session = await stripe.checkout.sessions.create({
success_url: 'https://example.com/success',
line_items: [
{price: 'price_A', quantity: 2}, // mode = payment
{price: 'price_B', quantity: 1}, // mode = subscription
{price: 'price_C', quantity: 1}, // mode = subscription
],
mode: '', // what mode to put here?
});
This is the code snippet. While creating session, the lineitems will contain product with mode 'payment' and 'subscription' both. How do i tell which items (B and C) are subscription based and which items (A) are payment based in the same session?
@young current
Hey! Taking over for my colleague. Let me catch up.
You need to use mode: 'subscription'
Won't this make the customer to pay $80 next time? We want the customer to pay only $30 next time
what is $80 and what is $30? only recurring prices will be charged next time.
The price of line items B and C are $20 and $10 which totals in $30. The price of line item A is $50.
Now, i want to create a single session where the customer will pay total $80 for the first time (for all items A, B and C), and $30 for subscriptions (for items B and C) on a recurring basis.
The above code snippet seems to assume that all the 3 items in the line_items are subscription based, as
mode: 'subscription' is applicable for all the items in the line_items.
How does stripe know/distinguish that only items B and C are recurring payments and the item A is not recurring from that line_items codebase in the same session?
Am i missing something? @hollow cape ?
Each price has type.
The first payment will be 80$ and the next invoice will be just for 30$ the recurring prices.
Oh, got it, thank you very very much.
Happy to help!