#thiago-spindola_docs
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/1229858046163947611
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- thiago-spindola_api, 1 day ago, 6 messages
Hello! Not sure I understand your question. Generally speaking you don't pass Subscription info, Products, or Prices to Elements. Can you provide more details? Which Elements are you using? What are you trying to build?
I'm building a solution to implements the checkout inside my react component. In the actual system, is created a customer, a subscription based on a price id from the product chosen by the client and create a checkout session before redirect the client to checkout page:
const checkoutSession : Stripe.Checkout.Session = await StripeService.createSession(createSession, pricesId[0]);.
How can i follow this way using Elements?
Can you understand me?
So you're using Checkout now, and you want to switch to Elements and get the same functionality?
Yes
If so, we don't provide that out of the box. You would need to build a lot of that on your own. An alternative is to use embedded Checkout on your page instead: https://docs.stripe.com/payments/checkout/how-checkout-works?payment-ui=embedded-form
Stripe Elements are individual UI components that serve a specific purpose, like collecting payment information.
Stripe Checkout is a much more comprehensive solution that displays info, allows for discounts, displays line items, collects payment info displays terms of service, and a whole lot more.
Can i use Element to collect payment info and add to a subscription?
I see in thia part i can change mode to subscription:
const elements = stripe.elements({
mode: 'payment',
currency: 'usd',
amount: 1099,
});
Yes, you can, but Stripe Elements is not aware of the Subscription part, and won't display anything related to the Subscription.
That only indicates to the Payment Element the type of payment, so it doesn't show options that aren't eligible for recurring payments for example.
Payment Element isn't aware of any of the details related to a specific Subscription.
Can you tell me why embedded Checkout won't work for you?
I´m tell about this with my product manager and another people
Do you know what the way to add collected payment data to subscription in this case?
You create the Checkout Session in subscription mode. The Customer will supply payment info in Checkout which will start a new Subscription.
And how can I do the same thing using Elements to collect payment?
You create the Subscription on your server, then you confirm the Payment Intent on the Invoice it generates using the Payment Element.
How do I associate the subscription with the payment intent?
The Subscription creates an Invoice, and the Invoice creates the Payment Intent. It's already associated with the Subscription.
The video here might help: https://docs.stripe.com/payments-api/tour#payment-objects
Thank you for helping man. Regards 👍