#RHSDev - Checkout
1 messages · Page 1 of 1 (latest)
I want to buy products from stripe backend and for that I am using node server
const session = await stripe.checkout.sessions.create({
payment_method_types: ['card'],
line_items: [
{
price: "price_1LXVDCGhV9qlpej3DU5bGSXH",
adjustable_quantity: {
enabled: true,
minimum: 1,
maximum: 10
},
quantity: quantity,
},
],
mode: 'payment',
success_url: 'https://example.com/success',
cancel_url: 'https://example.com/cancel',
});
Do I have to do this or I can handle product payment inside the app directly?
You can do it in your app directly and not use Checkout if you wish.
We have a React Native SDK here: https://github.com/stripe/stripe-react-native
And a guide for accepting payments here: https://stripe.com/docs/payments/accept-a-payment?platform=react-native
Can I use this to buy products in multiple quantity?
I want to link products with this payment, I'm sorry if I sound too naive.
When you say "products" do you mean Stripe Products specifically, or just the generic concept of products?
I recommend you use Checkout for that, but it sounds like you don't want to use Checkout for some reason? Can you provide more details about your ultimate goal?
My ultimate goal is to buy this product with checkout session within the app
Without going to the webpage
Checkout is a Stripe-hosted payment page on the web, so it sounds like Checkout doesn't fit your requirements.
Just to confirm, you don't want to open Checkout in a web view within your app, correct?
I tried getting paymentIntent from checkout session it gave me error "You can not perform this action on paymentIntents created by checkout"
Yes, this is my client's requirement
Yeah, so you can't use Checkout. Really your only viable option is to create a one-off Invoice with the Products/Prices on it and then use the React Native SDK to confirm the Invoice's Payment Intent.
I'm trying to do it for more than 7 hours right now
We don't have a guide for doing that exactly, but this is a good starting point: https://stripe.com/docs/invoicing/integration
Also is it possible to get transaction id after paymentIntent success?
Which transaction ID?
That's the Payment Method ID, which is the object that represents the Payment Method used. It's available on the Payment Intent's payment_method property: https://stripe.com/docs/api/payment_intents/object#payment_intent_object-payment_method
It is not transaction-specific. A single Payment Method, if attached to a Customer, can be used for multiple payments.