#Dara - Payment Element
1 messages · Page 1 of 1 (latest)
Hello! That's correct, the Payment Element requires a client secret from a Payment Intent or Setup Intent during initialization.
The other methods you mentioned, retryInvoiceWithNewPaymentMethod and handlePaymentThatRequiresCustomerAction, sound like methods you created yourself? Or are they from Stripe? Can you provide more details about what you want to do?
No, those methods were provided in the doc back then. Let me see if i can still find it but i doubt that.
I want to migrate to Payment Element to offer more payment methods other than cards but when i review the changes, i dont even have the orignal code as described in the migration doc.
Okay, at a high level if you have an Invoice and you want to pay it using the Payment Element you would pass the client secret of the Invoice's Payment Intent to the Payment Element.
Invoices have a payment_intent property: https://stripe.com/docs/api/invoices/object#invoice_object-payment_intent
And Payment Intents have a client_secret property: https://stripe.com/docs/api/payment_intents/object#payment_intent_object-client_secret
Does that help?
Ok, If i remember correctly, I was following the tier-priced subscription doc back then.
Not really, the invoice was just a part of the step during subscription integration. I just need to know what to follow for Payment Element from the code I have now or maybe even switch to Checkout...
Let's back up. What are you trying to build?
Oh I saved the link to the doc then. This is the code I have.
https://stripe.com/docs/billing/subscriptions/per-seat#test
Gotcha. That guide uses the Card Element. Very little, if any of that code or overall approach would apply to a Payment Element integration.
But your overall goal is to allow people to Subscribe and pay with the Payment Element?
If so, have you looked at this guide? https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements
Yes I am exactly looking at that link and the link https://stripe.com/docs/payments/payment-element/migration and notice so much difference that I got confused!
Yep, it's very different for sure!
Checkout would be much easier and is recommended if it will fit your use case.
In the current doc, I don't even see the card element for subscription.
2 years ago, Checkout didn't offer tier-priced subscription.
Looks like we added support over a year ago now, so you should be all set there.
Can you confirm if I wanna use Payment Element, i scrap the retryInvoiceWithNewPaymentMethod and handlePaymentThatRequiresCustomerAction, keep the createCustomer, createSubscription and add confirmPayment?
And you would recommend Chekcout over Payment Element, right?
Oh, i forgot to say there is no code example for payment element in React
I would recommend Checkout if it works for you, yes. If you want to build your own integration I recommend scrapping all of the code from before and starting fresh with the guide linked above.
Not sure I understand? There was no React version of the previous guide, was there?
I see. I will provide all the info and make a decision in my team.
I think there was. I was following the Next.js doc also and combine different docs to make it work including the Github code exmaple. It took me a great deal bc there were errors on the Stripe doc which I contacted you guys back then. Back then, there wasn't elements.create and card.mount.
Are you guys planning to add React on this doc page? HTML is old school.
https://stripe.com/docs/billing/subscriptions/build-subscriptions
you can probably use https://stripe.com/docs/billing/quickstart as a reference instead. This guide contains React
Between Payment Element and Checkout, which one is a better integration against card testers? Because I was about to add Captcha and rate limit to our website. These frauders are using our website to test cards because we are using Card Elements.
True
I saw though it's only for Checkout.
gimme a sec to look at this, i'll get back to you
Ok
generally, as long as you use one of our recommended payment integrations, we have certain controls in place to detect for and mitigate card testing. If you're using the Payment Element then yes, you would want to add Captcha and rate limits to your site as well
Thanks!