I only need a single page as part of my checkout flow; to capture the billing information and accept terms. I want to be able to capture the billing information via a postback (as per the demos) but then immediately send the user to Stripe to take the payment.
Is this possible? And if so, how what do I need to do?
Also as an additional - has anybody managed to use Stripe Elements yet? Would I need to create a new payment provider for this?
We can't entirely emulate BeginPaymentForm on the server side as depending on the payment provider being used, some of them return javascript that needs to be executed so we can't just return a URL to navigate to.
If you know the payment gateway, and you know it returns a URL and you want to bypass everything Vendr does, you can call order.InitializeTransaction() to give the order an order number before redirecting to the known providers URL.
My generally recommended approach though if you want it to work for any payment gateway is to do what we do on the Vendr.net site and introduce an interim page after the single page checkout that displays a brief message "Redirecting to payment gateway" then on that page, render the BeginPaymentForm and use some javascript to automatically submit it. This is ultimately the JS that we use for auto submitting the form.
setTimeout(function() {
var form = document.getElementById("paymentForm");
if (form.hasAttribute("onsubmit")) {
form.dispatchEvent(new Event('submit', { cancelable: true }));
} else {
form.submit();
}
}, 100)00)
Thanks for the swift response on both of these questions (on a bank holiday no less!). Yeah the intermedite page seems like a reasonable stop gap for now, didn't think of that.
Emulate BeginPaymentForm serverside
Hi guys,
I only need a single page as part of my checkout flow; to capture the billing information and accept terms. I want to be able to capture the billing information via a postback (as per the demos) but then immediately send the user to Stripe to take the payment.
Is this possible? And if so, how what do I need to do?
Also as an additional - has anybody managed to use Stripe Elements yet? Would I need to create a new payment provider for this?
Any help is greatly appreciated.
TIA! Phil
Hey Philip,
We can't entirely emulate BeginPaymentForm on the server side as depending on the payment provider being used, some of them return javascript that needs to be executed so we can't just return a URL to navigate to.
If you know the payment gateway, and you know it returns a URL and you want to bypass everything Vendr does, you can call
order.InitializeTransaction()
to give the order an order number before redirecting to the known providers URL.My generally recommended approach though if you want it to work for any payment gateway is to do what we do on the Vendr.net site and introduce an interim page after the single page checkout that displays a brief message "Redirecting to payment gateway" then on that page, render the BeginPaymentForm and use some javascript to automatically submit it. This is ultimately the JS that we use for auto submitting the form.
Hope this helps
Matt
Hi Matt,
Thanks for the swift response on both of these questions (on a bank holiday no less!). Yeah the intermedite page seems like a reasonable stop gap for now, didn't think of that.
Thanks!
is working on a reply...