action squareup_create_loyalty_account { label: "CreateLoyaltyAccount" description: "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." provider: squareup method: POST path: "/v2/loyalty/accounts" encoding: json input: { type: "object" description: "A request to create a new loyalty account." required: ["idempotency_key", "loyalty_account"] properties: { idempotency_key: { type: "string" description: "A unique string that identifies this `CreateLoyaltyAccount` request. \nKeys can be any valid string, but must be unique for every request." } loyalty_account: { type: "object" description: "Describes a loyalty account. For more information, see\n[Manage Loyalty Accounts Using the Loyalty API](https://developer.squareup.com/docs/loyalty-api/overview)." required: ["program_id"] properties: { balance: { type: "integer" description: "The available point balance in the loyalty account. If points are scheduled to expire, they are listed in the `expiring_point_deadlines` field.\n\nYour 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." } created_at: { type: "string" description: "The timestamp when the loyalty account was created, in RFC 3339 format." } customer_id: { type: "string" description: "The Square-assigned ID of the [customer](https://developer.squareup.com/reference/square_2021-08-18/objects/Customer) that is associated with the account." } enrolled_at: { type: "string" description: "The timestamp when enrollment occurred, in RFC 3339 format." } expiring_point_deadlines: { type: "array" description: "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. \n\nThe total number of points in this field equals the number of points in the `balance` field." items: { type: "object" description: "Represents a set of points for a loyalty account that are scheduled to expire on a specific date." required: ["points", "expires_at"] properties: { expires_at: { type: "string" description: "The timestamp of when the points are scheduled to expire, in RFC 3339 format." } points: { type: "integer" description: "The number of points scheduled to expire at the `expires_at` timestamp." } } } } id: { type: "string" description: "The Square-assigned ID of the loyalty account." } lifetime_points: { type: "integer" description: "The total points accrued during the lifetime of the account." } mapping: { type: "object" description: "Represents the mapping that associates a loyalty account with a buyer. \n\nCurrently, a loyalty account can only be mapped to a buyer by phone number. For more information, see \n[Loyalty Overview](https://developer.squareup.com/docs/loyalty/overview)." properties: { created_at: { type: "string" description: "The timestamp when the mapping was created, in RFC 3339 format." } id: { type: "string" description: "The Square-assigned ID of the mapping." } phone_number: { type: "string" description: "The phone number of the buyer, in E.164 format. For example, \"+14155551111\"." } } } program_id: { type: "string" description: "The Square-assigned ID of the [loyalty program](https://developer.squareup.com/reference/square_2021-08-18/objects/LoyaltyProgram) to which the account belongs." } updated_at: { type: "string" description: "The timestamp when the loyalty account was last updated, in RFC 3339 format." } } } } } output: { type: "object" description: "A response that includes loyalty account created." properties: { errors: { type: "array" description: "Any errors that occurred during the request." items: { type: "object" description: "Represents an error encountered during a request to the Connect API.\n\nSee [Handling errors](https://developer.squareup.com/docs/build-basics/handling-errors) for more information." required: ["category", "code"] properties: { category: { type: "string" description: "The high-level category for the error." } code: { type: "string" description: "The specific code of the error." } detail: { type: "string" description: "A human-readable description of the error for debugging purposes." } field: { type: "string" description: "The name of the field provided in the original request (if any) that\nthe error pertains to." } } } } loyalty_account: { type: "object" description: "Describes a loyalty account. For more information, see\n[Manage Loyalty Accounts Using the Loyalty API](https://developer.squareup.com/docs/loyalty-api/overview)." required: ["program_id"] properties: { balance: { type: "integer" description: "The available point balance in the loyalty account. If points are scheduled to expire, they are listed in the `expiring_point_deadlines` field.\n\nYour 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." } created_at: { type: "string" description: "The timestamp when the loyalty account was created, in RFC 3339 format." } customer_id: { type: "string" description: "The Square-assigned ID of the [customer](https://developer.squareup.com/reference/square_2021-08-18/objects/Customer) that is associated with the account." } enrolled_at: { type: "string" description: "The timestamp when enrollment occurred, in RFC 3339 format." } expiring_point_deadlines: { type: "array" description: "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. \n\nThe total number of points in this field equals the number of points in the `balance` field." items: { type: "object" description: "Represents a set of points for a loyalty account that are scheduled to expire on a specific date." required: ["points", "expires_at"] properties: { expires_at: { type: "string" description: "The timestamp of when the points are scheduled to expire, in RFC 3339 format." } points: { type: "integer" description: "The number of points scheduled to expire at the `expires_at` timestamp." } } } } id: { type: "string" description: "The Square-assigned ID of the loyalty account." } lifetime_points: { type: "integer" description: "The total points accrued during the lifetime of the account." } mapping: { type: "object" description: "Represents the mapping that associates a loyalty account with a buyer. \n\nCurrently, a loyalty account can only be mapped to a buyer by phone number. For more information, see \n[Loyalty Overview](https://developer.squareup.com/docs/loyalty/overview)." properties: { created_at: { type: "string" description: "The timestamp when the mapping was created, in RFC 3339 format." } id: { type: "string" description: "The Square-assigned ID of the mapping." } phone_number: { type: "string" description: "The phone number of the buyer, in E.164 format. For example, \"+14155551111\"." } } } program_id: { type: "string" description: "The Square-assigned ID of the [loyalty program](https://developer.squareup.com/reference/square_2021-08-18/objects/LoyaltyProgram) to which the account belongs." } updated_at: { type: "string" description: "The timestamp when the loyalty account was last updated, in RFC 3339 format." } } } } } }