Gift cards

Take a Gift Card 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);

GiftCard

An object with the methods to create and set up a Gift Cards payment.

Created by calling the payments.giftCard() method.

Methods

giftCard.js
JS
JavaScript

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

const giftCard = await payments.giftCard();

await giftCard.attach('#gift-card');

const form = document.querySelector('#gift-card-payment');

form.addEventListener('submit', async (event) => {

   event.preventDefault();

   const result = await giftCard.tokenize(); // the gift card nonce

});