Methods
cashAppPay.js
JS
JavaScript
const paymentRequest = payments.paymentRequest({
countryCode: 'US',
currencyCode: 'USD',
total: { amount: '5.79', label: 'Total', pending: false },
});
const options = {
redirectURL: window.location.href,
referenceId: 'my-distinct-reference-id',
};
const cashAppPay = await payments.cashAppPay(paymentRequest, options);
cashAppPay.addEventListener('ontokenization', (event) => {
const { tokenResult } = event.detail;
const tokenStatus = tokenResult.status;
if (tokenStatus === 'OK') {
const token = tokenResult.token;
}
});
await cashAppPay.attach('#cashAppPay');