Add a container element to your checkout page and run the script returned by walletCheckout. The script reports the transient token through two channels — use whichever fits your integration.1 · Container element#
<div id="walletCheckout"></div>
2 · Inject the returned script#
3 · Receive the transient token#
Option A — CustomEvent (bubbles up from the container):#
document.getElementById('walletCheckout')
.addEventListener('sipay:wallet-token', (e) => {
const { transientToken, paymentType } = e.detail; // paymentType: 'apple_pay' | 'google_pay'
submitToYourServer(transientToken);
});
Option B — global callback (define before the script runs):#
window.sipayWalletTokenHandler = function (transientToken, paymentType) {
submitToYourServer(transientToken);
};
Forward the transientToken to your own server, then call walletPay server-to-server. Never call walletPay directly from the browser — your bearer token and app_secret must stay server-side.