#learner - ReactJS
1 messages · Page 1 of 1 (latest)
I'm not super familiar with React so I haven't built these examples out but have you had a chance to look here:
https://stripe.com/docs/stripe-js/react
Thanks @outer lichen or may be a general example which has both the API implementations available?
Well, once again I haven't had the chance to review it thoroughly but we've got a NextJS sample integration here:
https://github.com/stripe-samples/nextjs-typescript-react-stripe-js
When trying to create a Payment Intent, we specify the amount we intent to charge a param. What happens if user applies a discount code later - would we have to update the value in the created payment intent before charging it?
Is there a param available in confirmPayment to charge the customer a different amount, less than the original amount shared while creating the Payment Intent?
@outer lichen
Okay so what are you trying to build out?
So you create the PaymentIntent server side with an amount. Then, during the user interaction you want then to be able to apply a discount code?
yes
Well...you can update the paymentIntent to a new amount
But paymentIntents don't support the concept of a coupon in and of themselves. It would be up to you to handle that in your integration.
ok. Also, after the payment is successful, is there a way to get information like first-6 digits/last 4 digits etc of Credit Card entered by customer?
Yeah it's on the PaymentMethod object.
https://stripe.com/docs/api/payment_methods/object
It's part of the card attribute: card.last4
https://stripe.com/docs/api/payment_methods/object