#devparry
1 messages ยท Page 1 of 1 (latest)
Hello ๐
You'd just pass the one-time and the recurring price to the line_items array when creating a checkout session
Not sure if we have a specific guide for that but let me check
okay
you mean like this ?
Yes, are you seeing any API errors when you run the code?
๐
i am facing one issue under it
What's the issue?
as I am checking under the product dashboard
it shows me the proper description but under the checkout session it is a little bit confusing
both price have same description but we set different differnt
Can you share the product/price IDs?
Ah it might be because Checkout is using Product description when rendered (instead of price description)
Can you try creating two different products for these prices?
you mean should i create new Product using these prices ?
Create separate products for one time fee price and the recurring price
but as per the documentation, we can assign multiple prices to a single product so why i need to create a different product ?
will this fix my problem on the stripe checkout page?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
For the Product description.
Stripe Checkout uses Product name & description (which for both the prices is Pay Test - xxx & This is the description)
will this fix my problem on the stripe checkout page?
That will create a new price on each checkout session
we already create a one-time price which assigns under the product please have a look
These are two prices for the same product.
Checkout uses Product information when listing out line items on Checkout page and NOT price information.
Let me explain what is our requirement we have a subscription product and have two prices.
and The default price is monthly and 2nd price is for one time ( which is a one-time installation processing fee )
So how we can make it workable?
if we pass static name and description as per this document : https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-line_items-price_data-product_data-description
will this fix my problem on the stripe checkout page?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Let's take a step back, I feel like we're talking past each other.
You are creating one product with two prices
Let's call this product - Product A,
- It has a one-time fee of $10
- And a recurring price of $20
Both the prices above belong to "Product A" (single product)
So when you use both prices as line items in a checkout session, Checkout page pulls the "Product" information when rendering the line items. In this case both prices belong to "Product A"
Hence, the line items would show the name & the description of "Product A" on the checkout page for both prices
If you want separate name & description for one-time fee and the recurring price then you'll need to create two separate products for them
That way one-time fee will belong to "Product A" and recurring price will belong to "Product B", in which case the Checkout page will pull two different product names/descriptions for line items
hmmm thanks for clear my doubt
if we pass static name and description as per this document : https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-line_items-price_data-product_data-description
If you useprice_dataparameter, then it will create a new inline price and product when you create the checkout session
NP!
Do you mean it creates fresh new Product under the stripe dashboard ?
Yes
and each have it own new product and price ids
yup so you might end up with thousands of products/prices
LOL, noo we don't want to do that. This will create problems in our existing system. let me share this with my team
Thanks for clearing my doubts with detailed example.
No worries, happy to help
one thing more i have to ask
Sure
we have created web hooks for the events such as :
- checkout.session.completed
- checkout.session.async_payment_succeeded
- checkout.session.async_payment_failed
by the following documentation: https://stripe.com/docs/payments/checkout/fulfill-orders#fulfill
so when checkout.session.completed fire we save the subscription order data on our local-db
Could you please let me know which event fire when ?
will checkout.session.completed return all the subscription data ( with active status ) + invoice data at the same time stripe provide me subscription data under different events listed above ?
Actually for subscriptions <> webhooks we have a pretty great doc here
https://stripe.com/docs/billing/subscriptions/webhooks
I'd recommend reading through it, it should answer most of your questions
if you can explain to me that : what the fulfill_order($session) function do next it helps to me under stand easily.
yes i read it but i am confused under this checkout session only as shown in example
When checkout.session.async_payment_succeeded event fire what data will stripe return to us as compared to checkout.session.completed ?
fulfill_order in above case would most likely need to update your database and provision access to the product/service you're selling
means it is for only updating the data for the subscription
when ever fulfill_order() function call in the above example it means update the data on our local database
correct
thanks for sharing valuable info
NP! Happy to help ๐
have a nice day ahead