action squareup_create_loyalty_reward { label: "CreateLoyaltyReward" description: "Creates a loyalty reward. In the process, the endpoint does following:\n\n- Uses the `reward_tier_id` in the request to determine the number of points \nto lock for this reward. \n- If the request includes `order_id`, it adds the reward and related discount to the order. \n\nAfter a reward is created, the points are locked and \nnot available for the buyer to redeem another reward." provider: squareup method: POST path: "/v2/loyalty/rewards" encoding: json input: { type: "object" description: "A request to create a loyalty reward." required: ["idempotency_key", "reward"] properties: { idempotency_key: { type: "string" description: "A unique string that identifies this `CreateLoyaltyReward` request. \nKeys can be any valid string, but must be unique for every request." } reward: { type: "object" description: "Represents a contract to redeem loyalty points for a [reward tier](https://developer.squareup.com/reference/square_2021-08-18/objects/LoyaltyProgramRewardTier) discount. Loyalty rewards can be in an ISSUED, REDEEMED, or DELETED state. For more information, see [Redeem loyalty rewards](https://developer.squareup.com/docs/loyalty-api/overview#redeem-loyalty-rewards)." required: ["loyalty_account_id", "reward_tier_id"] properties: { created_at: { type: "string" description: "The timestamp when the reward was created, in RFC 3339 format." } id: { type: "string" description: "The Square-assigned ID of the loyalty reward." } loyalty_account_id: { type: "string" description: "The Square-assigned ID of the [loyalty account](https://developer.squareup.com/reference/square_2021-08-18/objects/LoyaltyAccount) to which the reward belongs." } order_id: { type: "string" description: "The Square-assigned ID of the [order](https://developer.squareup.com/reference/square_2021-08-18/objects/Order) to which the reward is attached." } points: { type: "integer" description: "The number of loyalty points used for the reward." } redeemed_at: { type: "string" description: "The timestamp when the reward was redeemed, in RFC 3339 format." } reward_tier_id: { type: "string" description: "The Square-assigned ID of the [reward tier](https://developer.squareup.com/reference/square_2021-08-18/objects/LoyaltyProgramRewardTier) used to create the reward." } status: { type: "string" description: "The status of a loyalty reward." } updated_at: { type: "string" description: "The timestamp when the reward was last updated, in RFC 3339 format." } } } } } output: { type: "object" description: "A response that includes the loyalty reward 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." } } } } reward: { type: "object" description: "Represents a contract to redeem loyalty points for a [reward tier](https://developer.squareup.com/reference/square_2021-08-18/objects/LoyaltyProgramRewardTier) discount. Loyalty rewards can be in an ISSUED, REDEEMED, or DELETED state. For more information, see [Redeem loyalty rewards](https://developer.squareup.com/docs/loyalty-api/overview#redeem-loyalty-rewards)." required: ["loyalty_account_id", "reward_tier_id"] properties: { created_at: { type: "string" description: "The timestamp when the reward was created, in RFC 3339 format." } id: { type: "string" description: "The Square-assigned ID of the loyalty reward." } loyalty_account_id: { type: "string" description: "The Square-assigned ID of the [loyalty account](https://developer.squareup.com/reference/square_2021-08-18/objects/LoyaltyAccount) to which the reward belongs." } order_id: { type: "string" description: "The Square-assigned ID of the [order](https://developer.squareup.com/reference/square_2021-08-18/objects/Order) to which the reward is attached." } points: { type: "integer" description: "The number of loyalty points used for the reward." } redeemed_at: { type: "string" description: "The timestamp when the reward was redeemed, in RFC 3339 format." } reward_tier_id: { type: "string" description: "The Square-assigned ID of the [reward tier](https://developer.squareup.com/reference/square_2021-08-18/objects/LoyaltyProgramRewardTier) used to create the reward." } status: { type: "string" description: "The status of a loyalty reward." } updated_at: { type: "string" description: "The timestamp when the reward was last updated, in RFC 3339 format." } } } } } }