Use a third-party checkout
Send shoppers from the Zupli drawer to GoKwik, Razorpay or another checkout with optimaio.overrideCheckout. What runs when, and ready-to-use code.
On this page
Many D2C stores, especially in India, use a third-party checkout instead of Shopify’s own. Zupli’s checkout button can hand over to it with optimaio.overrideCheckout, part of the Cart JavaScript SDK. Add the code in JavaScript overrides (Appearance > Advanced settings).
What happens when a shopper clicks checkout
- If a required terms checkbox isn’t ticked, checkout stops there.
- The
checkoutAttemptevent fires. - Zupli records Checkout Started for its analytics. You don’t need to do anything for this.
- Your override runs. If it throws an error straight away, the shopper is sent to Shopify’s
/checkoutinstead.
The override only replaces the Zupli drawer’s checkout button. Your theme’s own checkout buttons and Shop Pay buttons are unchanged. Only one override is kept: if you register two, the last one wins.
GoKwik
document.addEventListener('DOMContentLoaded', () => {
if (!window.optimaio) return;
optimaio.overrideCheckout((cart, discountCodes) => {
if (window.gokwikSdk && window.merchantInfo) {
gokwikSdk.initCheckout(window.merchantInfo);
return;
}
// GoKwik not loaded: fall back to Shopify checkout.
window.location.href = '/checkout';
});
});
Razorpay
document.addEventListener('DOMContentLoaded', () => {
if (!window.optimaio) return;
optimaio.overrideCheckout((cart) => {
const cfg = window.__RAZORPAY_CONFIG__;
if (!cfg || !window.Razorpay) {
window.location.href = '/checkout';
return;
}
const rzp = new Razorpay({
key: cfg.key,
amount: cart.total_price,
currency: cfg.currency,
name: cfg.merchant_name,
description: 'Checkout',
handler: (response) => {
console.log('Payment success', response);
},
});
rzp.open();
});
});
Zupli’s rewards at a third-party checkout
Zupli’s rewards are Shopify automatic discounts, worked out by Shopify itself, not discount codes. discountCodes only holds codes the shopper typed into the cart. Whether your provider honours Shopify’s automatic discounts depends on the provider, so check with them and test it before launch.
Test before launch
- The checkout button opens the provider, on desktop and on a phone.
- Free gifts, discounts and free shipping carry over to the provider’s checkout and the final order.
- If the provider’s script fails to load, shoppers fall back to Shopify’s checkout.
- A test checkout appears under Checkout Started in Analytics.
Was this page helpful?
Thanks for letting us know.
Sorry about that. Tell us what was missing and we'll fix the page.