#fkaib

1 messages · Page 1 of 1 (latest)

jade thunderBOT
slim ingot
#

Hello! Do you have a specific question?

acoustic rain
#

yes so when the user tries to purchase a subscription, how do they select the payment method they want to use? is that what the ExpressCheckout is for?

slim ingot
#

In the Checkout page UI they'd see a bunch of payment method type options and they'd provider their payment details there

acoustic rain
#

how do I display those UI? is there a specific component I should be using for this?

slim ingot
#

Sorry mixed up my threads there for a second

#

If you're using PaymentElement you'd see what I mentioned - the UI will have a bunch of tabs w/ each payment method type

#

The PaymentElemtn is meant to be used when you accept NEW payment methods

#

If you want a UI that shows your customer's existing payment methods you'd have to build your own or use somethign like the customer portal for managing those

acoustic rain
#

When the user tries to purchase something, is there a way to automatically charge the card that has been added previously in the billing page?

jade thunderBOT
slim ingot
#

Yes, you'd create a PaymentIntent and set payment_method to the payment method you want to use

acoustic rain
#

so I can't do tripe.Subscription.create()? I'd have to create a payment intent?

white sleet
#

Hello! I'm taking over and catching up...

acoustic rain
#

hi

white sleet
#

To summarize, are you asking if there's a Stripe UI component for displaying already-saved Payment Methods on your website?

acoustic rain
#

yes.

#

and if not is there a way to automatically charge the payment method that the user has added in the past already?

#
Confirm.tsx:143 Error occurred while confirming payment: IntegrationError: Invalid value for stripe.confirmPayment(): elements should have a mounted Payment Element or Express Checkout Element. 
    at h (v3:1:425586)
    at g.betas (v3:1:427508)
    at y (v3:1:427878)
    at v3:1:365450

This is the error I get when I use the code that I sent at the top.

white sleet
#

There is no UI component for that, but you can build your own UI for it using the API.

acoustic rain
#

that's exactly what I use. Not sure why I get this error

white sleet
#

Sounds like you're passing in elements as well?

acoustic rain
#

changing elements to clientSecret resolved the error I was getting earlier. However I'm getting a new error now:

shared-36a7a23d6f6ae10182102d1e91d95784.js:1     POST https://api.stripe.com/v1/payment_intents/pi_3Nb5WqEvUNDxHSmf10E4i4yn/confirm 400
white sleet
acoustic rain
#

req_Ks0yukiy1niDM9

white sleet
#

The error is accurate; you can't confirm a Payment Intent that doesn't have a Payment Method associated with it.

#

You need to specify the Payment Method to use to confirm it.

acoustic rain
#

so I need to add a payment method inside stripe.Subscription.create()?

white sleet
#

No, you would add it when you confirm.

#

I mean, I guess you could add it when you create the Subscription too.