#ingeniousambivert-payment-links

1 messages · Page 1 of 1 (latest)

versed relic
#

Hi there!

#

What is SPA?

umbral prism
#

Single Page Application

versed relic
#

Ah thanks

umbral prism
#

I am using MERN stack

versed relic
#

Gotcha

#

So you want to embed the payment form in your SPA, correct? You don't want to involve a redirect?

umbral prism
#

The flow is kinda similar to the subscription flow where the user gets access based on the payment plan

#

But instead of a fixed products I need dynamic amounts

#

Embed payment or redirect, whichever is easier works for me

versed relic
#

Thanks

#

So you want it to be recurring or not?

umbral prism
#

But it needs to track the payment status thats it. I need some kind of a webhook or something to let my app know the payment succeeded or failed

versed relic
#

Sounds like you are looking for one-time payments

#

But you mentioned Subscriptions so wanted to clarify

umbral prism
#

Not recurring

versed relic
#

Got it

#

Last question

#

is it a set Price amount per quantity of your product?

#

Like is it $1 per x units?

#

Or is this literally a "the customer specifies whatever they want"

umbral prism
versed relic
#

Yep that makes sense

umbral prism
#

No its just 1 unit with every payment

#

So my app decides the amount depending on a few other parameters

versed relic
#

So for instance we have an "adjustable quantity" feature which would allow the customer to specify the quantity of a Product, but that Product would be like $1 per unit, as opposed to the customer just inputting $33.44 as the amount they are paying.

#

So are you looking for the ability for them to specify an arbitrary amount, or are you trying to give them a base amount and they choose the quantity of that amount?

umbral prism
#

Actually the customer does not decide anything

versed relic
#

Hrmm okay now I'm confused 😅

umbral prism
#

Hold on

versed relic
#

Let's back up and have you write out the flow for me

umbral prism
#

Yes

versed relic
#

And I'll recommend the best integration based on that

umbral prism
#

Sure. Just a min

#

So basically the customer signs up on my app and then they check a few boxes and depending on that my app decides the amount they pay (one unit only). So I can either embed the payment form in my app or I can redirect them to a stripe payment page. As long as I can track what customer paid what amount, either option is fine.

versed relic
#

Gotcha that's much simpler then

#

It does involve a redirect but it is the simplest integration

#

And will handle everything you need.

umbral prism
#

Do I need to create products and prices for this ?

versed relic
#

Essentially you will just create a Checkout Session based on what your customer selects on your app, then redirect the customer to that Session's URL when they hit your "checkout" button. Then you implement webhooks (https://stripe.com/docs/payments/checkout/fulfill-orders) for fulfillment.

umbral prism
#

I need something where I just enter an amount and some description and the customer pays for it

versed relic
#

Right, you can dictate the amount when you create the Session.

umbral prism
#

Okay, I was looking into paymentIntents and charges.

versed relic
#

Yep you could go that route

#

But it is a higher integration burden

#

So really just a trade-off of what you want.

umbral prism
#

Can you please explain me in a nutshell the flow for checkout, charges, payment intents ?

versed relic
#

Sure

umbral prism
#

Thank you so much

versed relic
#

Checkout = you create Checkout Session to determine how much to charge the user, you redirect user to session URL, we handle everything on the redirect page, customer is redirected back to your page after successful payment, you listen for webhooks for fulfillment

#

Checkout Sessions create PaymentIntents and Charges

#

So those will still be involved

#

Using Elements = you create a PaymentIntent to determine how much to charge the user, you pass the PaymentIntent's client secret to your client, you render the Stripe Payment Element within your webpage using that client secret, customer enters payment details into the Payment Element, upon success you show a success message, you handle fulfillment with Webhooks.

#

That is the short of it

umbral prism
#

Oh, okay. Can I control the ttl for the checkout session ?

#

Also what exactly would I need to store in my db to determine the success or failure of the payment via webhooks ? customerId, anything else ? Also do I need to create products and prices for checkout sessions (I am a little confused about this) ? Because I just want my app to dynamically decide the amount for the checkout so creating product and prices would be an overhead for me every single time a customer decides to pay (since the amount will be dyanmic )

versed relic
#

Yep you can expire Checkout Sessions. Minimum amount of time though is 30 mins. They auto expire in 24 hours.

umbral prism
#

Can I extend the ttl to say 7 days ?

versed relic
#

No 24 hours max for a Checkout Session

#

You would have to create a new Session

#

You can handle Prices dynamically with Checkout

umbral prism
#

Okay got it. Thank you so much

#

I will try this

#

I really appreciate your help

versed relic
#

Sure thing! Let us know if you run into any issues while integrating!