#ReneDenmark-payment-element

1 messages · Page 1 of 1 (latest)

vestal bough
honest night
#

Thanks. Failed to mention I am doing the subcription payment.

#

Which I already have made and want to upgrade to Payment Elements. But the migration guide is also not giving me much help.

vestal bough
#

I see, or do you want to use the Checkout page? it's much easier to integration and it works well with subscription.

honest night
#

No, I have to use a custom flow.

#

I have everything working, but problems changing to Payment Element. A working example would me a lot to do the upgrade. Thats all 🙂

vestal bough
#

No problem, let me help you with that.

#

So basically that's what you need to do

  1. Create a customer
  2. Create a subscription for the customer
  3. Pass the subscription's latest_invoice.payment_intent.client_secret to the payment element to render
  4. enter the payment details and call stripe.confirmPayment to confirm the payment
  5. The subscription will be active if the payment is successful.
honest night
#

Yeah. I almost have all that. But fx the examples says the JS is the following: fetch('/create-subscription', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
priceId: priceId,
customerId: customerId,
}),
})

#

But there has to more JS. Using the return, setting the parameters and such. This is were I have to do som e guessing and so on.
Just want a complete example to work from. If there is any.

vestal bough
#

Your code looks good to me, is there a particular problem that you have encountered?

honest night
#

No, not yet. Just trying to avoid all the guessing. But let me work on it and get back if I have problems. Just wanted a working example (.Net) to work with.

vestal bough
#

I'd suggest to play with the APIs first, and you are welcome to come back anytime if you hit any problems

honest night
#

Ok. Thanks.