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

You are viewing an old version of the API
Create loyalty account BETA

Creates a loyalty account.

For more information, see Create a loyalty account.

Required permissions: LOYALTY_WRITE

Request Body

Name Description
loyalty_account
LoyaltyAccount

Required

The loyalty account to create.

idempotency_key
string

Required

A unique string that identifies this CreateLoyaltyAccount request. Keys can be any valid string, but must be unique for every request.

Max Length 128 Min Length 1

Response Fields

Name Description
errors
Error [ ]

Any errors that occurred during the request.

loyalty_account
LoyaltyAccount

The newly created loyalty account.

Error Descriptions

INVALID_PHONE_NUMBER

The provided phone number is invalid.

Examples

You are viewing an old version of the API
POST /v2/loyalty/accounts
cURL
  • cURL
  • Ruby
  • Python
  • C#
  • Java
  • PHP
curl https://connect.squareup.com/v2/loyalty/accounts \
  -X POST \
  -H 'Square-Version: 2020-06-25' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "loyalty_account": {
      "mappings": [
        {
          "type": "PHONE",
          "value": "+14155551234"
        }
      ],
      "program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd"
    },
    "idempotency_key": "ec78c477-b1c3-4899-a209-a4e71337c996"
  }'
Response JSON
{
  "loyalty_account": {
    "id": "79b807d2-d786-46a9-933b-918028d7a8c5",
    "mappings": [
      {
        "id": "66aaab3f-da99-49ed-8b19-b87f851c844f",
        "type": "PHONE",
        "value": "+14155551234",
        "created_at": "2020-05-08T21:44:32Z"
      }
    ],
    "program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd",
    "balance": 0,
    "lifetime_points": 0,
    "created_at": "2020-05-08T21:44:32Z",
    "updated_at": "2020-05-08T21:44:32Z"
  }
}

Share Feedback

Thanks for visiting the Square API documentation. What's on your mind?