Cash App Pay

Take a Cash App Pay payment

Usage

Code playground

index.html

Payments

Returned by Square.payments(appId, locationId).

Use this object to instantiate Payment methods. Learn more on the Payments page.

Methods

payments.js
JS
JavaScript

const payments = Square.payments(appId, locationId);

CashAppPay

Create a CashAppPay method instance

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');