#rangermillze_api
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1293224405325058170
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- rangermillze_api, 1 hour ago, 27 messages
- rangermillze_api, 3 hours ago, 89 messages
Sure
I currently use paymenet elements which works perfectly fine for card payments
I use stripe.confirmPayment and stripe.confirmSetup response codes to create a user environment once payment has been made using the same script.
i.e if payload.setupIntent.status == "succeeded" then run setup code.
I use webhooks to manage the licenses
the card payments work great and i get a response fine, however the paypal button send me to another page away form my script. So looking at the docs I can use paypal express checkout element however I dont want to have to duplicate code so Im wondering if I can remove the current paypal button from the payment element and use or add a paypal express checkout button?
Yes you can do that
Paypal will still result in a redirect from the page after confirmPayment or confirmSetup promise fulfillment.
Is that the part you are worried about?
Or you don't like the redirect to the Paypal authorization?
Paypal as it is atm redirects to a page for me to enter my paymenet details and then returns to another page away from the script.
Correct
With Express Checkout Element it will perform that authorization within a modal
This is what I dont want as the script is waiting for a response to finish my client setups
yes, this is what I need )authorization in a modal)
To be clear though you will still get a redirect upon successful confirmPayment() or confirmSetup()
Hmm actually I haven't tested that ... that might not happen if you set redirect: if_required here
stripe.confirmPayment({
elements,
confirmParams: {
// Return URL where the customer should be redirected after the PaymentIntent is confirmed.
return_url: 'https://kwiktactix.com/gateway/err.php',
},
redirect: 'if_required'
})
.then(function(payload) {
this is what i use ( redirect: 'if_required' )
so i keep the redirect under control
this works great
Which is why you are seeing that
But yeah for ECE it should not be
Since it uses a modal
This is the issue, I am trying to use both on the same page.
I understand. I think it should work fine with Paypal where it doesn't redirect with Express Checkout Element. But you'll need to test that
I can get this to work with express checkout but I am trying to utilize my code to use both options. The payment elements and the paypal button.
Yes that's fine
I am wondering if I can show the payment element as well as the expresscheckout button. So the user can press the yellow express checkout button if they want to use paypal
And remove the paypalk button from the payment element.
You use the expressCheckoutElement.on('confirm', handler for your code for ECE
And you would use your own button handler for Payment Element
When you create your ECE you specify that you want to show Paypal
Via paymentMethodTypes: https://docs.stripe.com/elements/express-checkout-element/accept-a-payment#additional-options
would i mount EXE as const ppelements = stripe.elements(options); and mount paymenet elements as const elements = stripe.elements(options); on the same page?
sry ECE
No you would need to initialize multiple elements instances here.
Since you are going to have different options for each
hmm, ok this is where I think i am falling over.
I want the user experience to be simple, either click pay with card or click use EXE
ECE
i'll have a play and see if I can get both working together
but thanks for confirming I can use both (or should be fine).
thanks m8! appreciate it