#lafafm

1 messages · Page 1 of 1 (latest)

unique escarpBOT
viral flame
#

hi! hmm, there's no direct function. You just make the PaymentRequest using your own logic for what to show to the user(you likely want to use pending amounts in it for example if it's a SetupIntent)

Or use PaymentElement instead which handles it all for you.

odd jay
#

Hmm

The issue I seeing here - that we're using our custom TaxRates (from another Tax provider)

And the conflict for me is:

We're creating a paymentRequest based on the price provided, at the page load

Customer tax rate would be determined only after he enters some billing details

#

So, in that case PaymentRequest wouldn't match the actual amount (+ tax)

#

Also, can you help me with an order of subscription creation using PaymentRequestButton?

E.g. Should the subscription be created before we're making any processing of payment? On user clicking PRB and only then continue to process the payment?

viral flame
#

yeah it's kind of not perfect

#

either way works but the recommended Stripe integration is to create a Subscription when the page loads and send the invoice.payment_intent or the subscription.pending_setup_intent to the frontend for client side action

odd jay
#

Can the PaymentRequest be updated after customer clicked on PRB?

E.g. to add some handler on PRB.click(), create subscription there, and update PaymentRequest to apply tax / discounts, and only then proceed to GPay / Apple Pay logic?

viral flame
#

you can't really do custom logic between the customer clicking the button and showing the popup, since browsers will block the popup from showing if it's not called from a 'gesture handler' (a click event; if you make an XHR to your backend then you lose that context)