POST /v2/loyalty/accounts

Creates a loyalty account. To create a loyalty account, you must provide the program_id and a mapping with the phone_number of the buyer.

Servers

Request headers

Name Type Required Description
Content-Type String Yes The media type of the request body.

Default value: "application/json"

Request body fields

Name Type Required Description
idempotency_key String Yes

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

loyalty_account Object Yes

Describes a loyalty account. For more information, see Manage Loyalty Accounts Using the Loyalty API.

loyalty_account.id String No

The Square-assigned ID of the loyalty account.

loyalty_account.customer_id String No

The Square-assigned ID of the customer that is associated with the account.

loyalty_account.lifetime_points Integer No

The total points accrued during the lifetime of the account.

loyalty_account.expiring_point_deadlines[] Array No

The schedule for when points expire in the loyalty account balance. This field is present only if the account has points that are scheduled to expire.

The total number of points in this field equals the number of points in the balance field.

loyalty_account.expiring_point_deadlines[].points Integer Yes

The number of points scheduled to expire at the expires_at timestamp.

loyalty_account.expiring_point_deadlines[].expires_at String Yes

The timestamp of when the points are scheduled to expire, in RFC 3339 format.

loyalty_account.balance Integer No

The available point balance in the loyalty account. If points are scheduled to expire, they are listed in the expiring_point_deadlines field.

Your application should be able to handle loyalty accounts that have a negative point balance (balance is less than 0). This might occur if a seller makes a manual adjustment or as a result of a refund or exchange.

loyalty_account.program_id String Yes

The Square-assigned ID of the loyalty program to which the account belongs.

loyalty_account.created_at String No

The timestamp when the loyalty account was created, in RFC 3339 format.

loyalty_account.enrolled_at String No

The timestamp when enrollment occurred, in RFC 3339 format.

loyalty_account.mapping Object No

Represents the mapping that associates a loyalty account with a buyer.

Currently, a loyalty account can only be mapped to a buyer by phone number. For more information, see Loyalty Overview.

loyalty_account.mapping.id String No

The Square-assigned ID of the mapping.

loyalty_account.mapping.created_at String No

The timestamp when the mapping was created, in RFC 3339 format.

loyalty_account.mapping.phone_number String No

The phone number of the buyer, in E.164 format. For example, "+14155551111".

loyalty_account.updated_at String No

The timestamp when the loyalty account was last updated, in RFC 3339 format.

How to start integrating

  1. Add HTTP Task to your workflow definition.
  2. Search for the API you want to integrate with and click on the name.
    • This loads the API reference documentation and prepares the Http request settings.
  3. Click Test request to test run your request to the API and see the API's response.