#shayan - payment request button & subscription
1 messages · Page 1 of 1 (latest)
from what I understand uptill now is that you need to create a payment intent and than pass it to PaymentRequestButtonElement
or PaymentElement that is needed for onetime purchase, show how to ask for a subscription? where can I pass the stripe price_id for recurring purchase?
following this document:
https://stripe.com/docs/payments/save-during-payment?html-or-react=react#web-create-payment-intent
I'm trying to set it up for subscription and one time purchase, It's good to go for one time purchase but a bit confused on subscription flow
You wouldn't pass a price, you'd create a subscription separately then confirm the payment intent associated with the first invoice similar to what you see here in steps 5 & 6:
https://stripe.com/docs/billing/subscriptions/build-subscription?ui=elements#create-subscription
That would work directly with the payment element
the payment request button is a little different, as you need to get the payment method first
You get the payment method from the PRB there and then use it to confirm the payment intent
in the on('paymentmethod') event
Got it, I'll implement it this way, just one other question, can we create a payment intent with price id instead of manually passing the amount and currency?
We're working on something like that, but not currently in the public API no
ok, thanks a lot @sturdy plume
NP!