• Example searches: “transaction”, “CreateOrder”, “/v2/locations”, “inventory”, “delete customer”

You are viewing an old version of the API
Retrieve gift card from nonce

POST /v2/gift-cards/from-nonce

Retrieves a gift card using a secure payment token that represents the gift card.


Permissions
GIFTCARDS_READ
Try in API Explorer
Name Description
nonce
string

Required

The payment token of the gift card to retrieve. Payment tokens are generated by the Web Payments SDK or In-App Payments SDK.

Min Length 1

Response Fields

Name Description
errors
Error [ ]

Any errors that occurred during the request.

gift_card
GiftCard

The retrieved gift card.

Examples

You are viewing an old version of the API
POST /v2/gift-cards/from-nonce
cURL
  • cURL
  • Ruby
  • Python
  • C#
  • Java
  • PHP
  • Node.js
curl https://connect.squareup.com/v2/gift-cards/from-nonce \
  -X POST \
  -H 'Square-Version: 2022-09-21' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "nonce": "cnon:7783322135245171"
  }'
Response JSON
{
  "gift_card": {
    "id": "gftc:6944163553804e439d89adb47caf806a",
    "type": "DIGITAL",
    "gan_source": "SQUARE",
    "state": "ACTIVE",
    "balance_money": {
      "amount": 5000,
      "currency": "USD"
    },
    "gan": "7783320001001635",
    "created_at": "2021-05-20T22:26:54.000Z"
  }
}

Error Descriptions

400 Bad request CARD_TOKEN_USED

The provided card token (nonce) was already used to process the payment or refund.

>
400 Bad request
{
  "errors": [
    {
      "code": "CARD_TOKEN_USED",
      "category": "INVALID_REQUEST_ERROR"
    }
  ]
}