unPLUGDevelopers

Data models

Every object the App API returns and every request body it accepts, field by field. Each model links to the endpoints that use it. The same models are in openapi.yaml, so you can generate types from them.

Model names are what you'll see in the OpenAPI file and in generated code. Fields marked required are always present in responses and must be sent in requests. nullable fields can be null.

Common#

Problem#

RFC 9457 problem details, served as application/problem+json.

  • typestring (uri)Required
    Link to the docs for this error.
  • titlestringRequired
  • statusintegerRequired
  • codeErrorCodeRequired
    Show valuesHide values
    • invalid_request
    • invalid_param
    • missing_param
    • invalid_api_key
    • token_expired
    • missing_scope
    • not_found
    • member_not_found
    • member_deleted
    • external_id_taken
    • phone_in_use
    • idempotency_key_required
    • idempotency_key_reused
    • request_in_progress
    • rate_limited
    • insufficient_points
    • reward_not_found
    • reward_not_applicable
    • reward_expired
    • reward_already_used
    • code_invalid
    • code_expired
    • code_limit_reached
    • redemption_expired
    • redemption_not_reserved
    • one_redemption_per_order
    • order_already_exists
    • refund_exceeds_order
    • location_not_found
    • challenge_not_joinable
    • invalid_state
    • internal_error
    • service_unavailable
  • detailstring
    A sentence about this occurrence.
  • paramstringNullable
    The request field at fault, when there is one.
  • order_idstring (uuid)
    Only on order_already_exists: the order that was already credited.
  • request_idstringRequired
    Same as the Request-Id header.

ErrorCode#

Machine-readable error code. May grow.

One of invalid_request, invalid_param, missing_param, invalid_api_key, token_expired, missing_scope, not_found, member_not_found, member_deleted, external_id_taken, phone_in_use, idempotency_key_required, idempotency_key_reused, request_in_progress, rate_limited, insufficient_points, reward_not_found, reward_not_applicable, reward_expired, reward_already_used, code_invalid, code_expired, code_limit_reached, redemption_expired, redemption_not_reserved, one_redemption_per_order, order_already_exists, refund_exceeds_order, location_not_found, challenge_not_joinable, invalid_state, internal_error, service_unavailable

ReasonCode#

Why a reward or code doesn't apply. May grow.

One of below_minimum_subtotal, wrong_channel, wrong_location, wrong_fulfillment, outside_available_times, item_not_in_cart, tier_required, not_enough_points, per_member_limit_reached, budget_exhausted, not_started, expired, already_used

CursorList#

Cursor-paginated list. ?limit= (1 to 100, default 25) and ?cursor=.

  • dataarray of objectRequired
  • has_morebooleanRequired
    True when another page exists.
  • next_cursorstringRequiredNullable
    Pass as cursor to get the next page.

Address#

  • line1string
  • line2stringNullable
  • citystring
  • regionstring
  • postal_codestring
  • countrystring
    ISO 3166-1 alpha-2.

Program and catalog#

Program#

Used by
  • brand_idstring (uuid)Required
    Your brand.
  • namestringRequired
    The program name guests see, for example Rewards.
  • point_nameobjectRequired
    singular and plural, for example Bean and Beans. Use these in your UI instead of the word "points".
    Show attributesHide attributes
    • singularstringRequired
    • pluralstringRequired
  • earningobjectRequired
    Show attributesHide attributes
    • typestringRequired
      One of spend, visit
    • points_per_dollarinteger
      When type is spend.
    • points_per_visitinteger
      When type is visit.
    • roundingstringRequired
      One of down
    • earn_onstringRequired
      Points are earned on the subtotal after discounts.
      One of subtotal
  • tiersarray of TierRequired
    Tiers from lowest to highest. Each has id, name, min_lifetime_points and, when the tier gives one, upgrade_bonus_points (points added once when a member moves up into it). Tiers are based on lifetime points, so spending points never drops a member's tier.
    Show attributesTier
    • idstring (uuid)Required
    • namestringRequired
    • min_lifetime_pointsintegerRequired
    • upgrade_bonus_pointsinteger
      Points added when a member reaches this tier.
  • default_time_zonestringRequired
    IANA time zone used for anything that has no location, such as birthdays.
  • currencystringRequired
    ISO 4217 code. USD.
  • points_expiryobjectNullableComing soon
    Coming soon { "days_inactive": 365 } when points expire after a period with no activity. Points don't expire at launch, and the field is absent.
    Show attributesHide attributes
    • days_inactiveinteger

Tier#

  • idstring (uuid)Required
  • namestringRequired
  • min_lifetime_pointsintegerRequired
  • upgrade_bonus_pointsinteger
    Points added when a member reaches this tier.

TierRef#

  • idstring (uuid)Required
  • namestringRequired

Location#

Used by
  • idstring (uuid)Required
    Send this as location_id on previews, redemptions and orders.
  • namestringRequired
    For example South Congress.
  • addressAddress
    line1, line2 (or null), city, region, postal_code, country (ISO 3166-1 alpha-2).
    Show attributesAddress
    • line1string
    • line2stringNullable
    • citystring
    • regionstring
    • postal_codestring
    • countrystring
      ISO 3166-1 alpha-2.
  • time_zonestringRequired
    IANA time zone. Reward times and visit days at this location use it.
  • posstring
    The location's point of sale. square.
    One of square
  • pos_location_idstring
    The Square location id. Match it against your own ordering system's location ids.
  • statusstringRequired
    live or not_live. Only offer ordering at live locations.
    One of live, not_live

Reward#

A reward is a discount a member can get. The catalog holds points rewards, which members buy with points at checkout. Rewards given to one member (from a tier, an offer, a birthday or support) have kind: "wallet" and appear only inside that member's wallet, in this same shape.

Used by
  • idstring (uuid)Required
    Send this as reward_id on previews and redemptions.
  • namestringRequired
    For example Free drip coffee.
  • descriptionstring
    Short text for the guest.
  • image_urlstring (uri)Nullable
    HTTPS image URL.
  • kindstringRequired
    points (catalog) or wallet (given to one member). May grow.
    One of points, wallet
  • points_costinteger
    Points the reward costs. Only on points rewards; wallet rewards don't have it.
  • discountDiscountRequired
    Show attributesDiscount
    • typestringRequired
      One of amount, percent, free_item, bogo
    • amount_centsinteger
      For amount.
    • percentnumber
      For percent.
    • itemsarray of object
      Item scope, by Square variation id.
      Show attributesHide attributes
      • pos_item_idstring
      • namestring
    • categoriesarray of object
      Category scope.
      Show attributesHide attributes
      • pos_category_idstring
      • namestring
    • max_itemsinteger
  • rulesRulesRequired
    Show attributesRules
    • min_subtotal_centsinteger
      Integer cents.
      Min 0
    • channelsarray of string
      One of app, web
    • location_idsarray of string (uuid)
    • fulfillmentarray of string
      One of pickup, delivery, curbside, dine_in
    • available_timesarray of AvailableTime
      Show attributesAvailableTime
      • daysarray of string
        Show valuesHide values
        • mon
        • tue
        • wed
        • thu
        • fri
        • sat
        • sun
      • startstring
        Local time, HH:MM.
      • endstring
        Local time, HH:MM.
    • tier_idsarray of string (uuid)
  • starts_atstring (date-time)Nullable
    When the reward becomes available. null means it already is.
  • ends_atstring (date-time)Nullable
    When it stops being available. null means no end date.

An empty array in rules means no limit: "location_ids": [] works at every location. A reward limited to weekday mornings for pickup in the app looks like this:

Discount types#

typeFieldsWhat the guest gets
amountamount_centsA fixed amount off the subtotal, or off the matching items when the reward has an item scope.
percentpercentA percentage off the subtotal, or off the matching items when the reward has an item scope.
free_itemitems or categories, max_itemsUp to max_items matching items free.
bogoitems or categoriesBuy one matching item, get a second matching item free.

The API works out the actual discount on a given cart. Show the discount_cents from a checkout preview rather than calculating it yourself.

Rules#

Empty arrays mean no limit.

  • min_subtotal_centsinteger
    Integer cents.
    Min 0
  • channelsarray of string
    One of app, web
  • location_idsarray of string (uuid)
  • fulfillmentarray of string
    One of pickup, delivery, curbside, dine_in
  • available_timesarray of AvailableTime
    Show attributesAvailableTime
    • daysarray of string
      Show valuesHide values
      • mon
      • tue
      • wed
      • thu
      • fri
      • sat
      • sun
    • startstring
      Local time, HH:MM.
    • endstring
      Local time, HH:MM.
  • tier_idsarray of string (uuid)

Discount#

  • typestringRequired
    One of amount, percent, free_item, bogo
  • amount_centsinteger
    For amount.
  • percentnumber
    For percent.
  • itemsarray of object
    Item scope, by Square variation id.
    Show attributesHide attributes
    • pos_item_idstring
    • namestring
  • categoriesarray of object
    Category scope.
    Show attributesHide attributes
    • pos_category_idstring
    • namestring
  • max_itemsinteger

AvailableTime#

  • daysarray of string
    Show valuesHide values
    • mon
    • tue
    • wed
    • thu
    • fri
    • sat
    • sun
  • startstring
    Local time, HH:MM.
  • endstring
    Local time, HH:MM.

Members and tokens#

Member#

  • idstring (uuid)Required
    unPLUG's id for the member. Store it next to your user record.
  • external_idstringNullable
    Your id for the guest, up to 128 characters. null for a guest who has only earned at the register and isn't linked to your login yet.
    Max Length 128
  • statusstringRequired
    active. The member.deleted webhook carries deleted; after that, calls about the member return 410 member_deleted.
    One of active, deleted
  • first_namestringNullable
  • last_namestringNullable
  • emailstring (email)Nullable
    Saved in lowercase.
  • phonestringNullable
    E.164, for example +15125550142.
  • phone_verifiedboolean
    true when you confirmed the guest owns the number, for example with an SMS code. Only verified phones link to existing members.
  • birthdaystring (date)Nullable
    YYYY-MM-DD.
  • points_balanceintegerRequired
    Points the member has now. Never below zero.
  • lifetime_pointsintegerRequired
    All points ever earned, used for tiers. Spending doesn't lower it.
  • tierTierRefRequired
    id and name of the current tier.
    Show attributesTierRef
    • idstring (uuid)Required
    • namestringRequired
  • next_tierobjectNullable
    id, name and points_needed (lifetime points still to earn). null at the top tier.
    Show attributesHide attributes
    • idstring (uuid)
    • namestring
    • points_neededinteger
  • communication_preferencesobject
    Marketing consent: email_marketing, sms_marketing, push_marketing. See communication preferences.
    Show attributesHide attributes
    • email_marketingboolean
    • sms_marketingboolean
    • push_marketingboolean
  • metadataobject
    Your own string values. Up to 20 keys, 500 characters each. Don't put personal data here.
  • linked_existingboolean
    Only on create: true when an existing member was linked by verified phone.
  • enrolled_atstring (date-time)
    When the guest joined the program.
  • created_atstring (date-time)Required
  • updated_atstring (date-time)Required

MemberCreate#

Used by
  • external_idstringRequired
    Max Length 128
  • first_namestring
  • last_namestring
  • emailstring (email)
  • phonestring
    E.164.
  • phone_verifiedboolean
  • birthdaystring (date)
  • communication_preferencesobject
    Show attributesHide attributes
    • email_marketingboolean
    • sms_marketingboolean
    • push_marketingboolean
  • metadataobject

MemberUpdate#

Used by
  • first_namestring
  • last_namestring
  • emailstring (email)
  • phonestring
    E.164. Secret key only.
  • phone_verifiedboolean
    Secret key only.
  • birthdaystring (date)
    Set once from the app; a secret key can correct it.
  • metadataobject

CommunicationPreferences#

  • email_marketingbooleanRequired
  • sms_marketingbooleanRequired
  • push_marketingbooleanRequired
  • updated_atstring (date-time)Required
  • sourcestringRequired
    Set automatically.
    One of app, web, api, unsubscribe_link

CommunicationPreferencesUpdate#

  • email_marketingboolean
  • sms_marketingboolean
  • push_marketingboolean

MemberTokenRequest#

Send member_id or external_id.

Used by
  • member_idstring (uuid)
  • external_idstring

MemberToken#

Used by
  • tokenstringRequired
    Opaque, starts with mt_.
  • expires_atstring (date-time)Required
  • member_idstring (uuid)Required

HostedTokenResponse#

Coming soon.

  • access_tokenstring
    A member token, mt_....
  • token_typestring
  • expires_ininteger
  • refresh_tokenstring
    Rotates on every use.
  • member_idstring (uuid)

IdentificationCode Coming soon#

Coming soon. Valid for 5 minutes.

  • codestringRequired
  • qr_payloadstringRequired
  • expires_atstring (date-time)Required

Activity and wallet#

ActivityEntry#

  • idstring (uuid)Required
  • typestringRequired
    What happened. See the table below. May grow.
    One of earn, bonus, redeem, adjust, reverse, expire
  • pointsintegerRequired
    Signed change: 62 for an earn, -500 for a redeem.
  • balance_afterintegerRequired
    The member's points_balance right after this entry.
  • descriptionstring
    A short line you can show the guest, for example Visit at South Congress or Free drip coffee.
  • order_idstring (uuid)Nullable
    The order that caused it, for earn, bonus, redeem and reverse.
  • reward_idstring (uuid)Nullable
    The reward bought, for redeem.
  • adjustment_reasonstringNullable
    For adjust: goodwill, correction, migration or other.
    One of goodwill, correction, migration, other
  • created_atstring (date-time)Required
typeMeaningSign
earnPoints from an order, in your app or at the register.+
bonusExtra points from a promotion, a birthday or a tier upgrade.+
redeemPoints spent on a reward, when the order is credited.-
adjustPoints added or removed with a points adjustment.+ or -
reversePoints taken back or returned by a refund.+ or -
expire Coming soonPoints that expired after a period with no activity.-

WalletItem#

  • idstring (uuid)Required
    Send this as wallet_item_id on previews and redemptions.
  • rewardRewardRequired
    The reward, in the same shape as the catalog, with kind: "wallet" and no points_cost. Its rules apply at checkout.
    Show attributesReward
    • idstring (uuid)Required
      Send this as reward_id on previews and redemptions.
    • namestringRequired
      For example Free drip coffee.
    • descriptionstring
      Short text for the guest.
    • image_urlstring (uri)Nullable
      HTTPS image URL.
    • kindstringRequired
      points (catalog) or wallet (given to one member). May grow.
      One of points, wallet
    • points_costinteger
      Points the reward costs. Only on points rewards; wallet rewards don't have it.
    • discountDiscountRequired
      Show attributesDiscount
      • typestringRequired
        One of amount, percent, free_item, bogo
      • amount_centsinteger
        For amount.
      • percentnumber
        For percent.
      • itemsarray of object
        Item scope, by Square variation id.
        Show attributesHide attributes
        • pos_item_idstring
        • namestring
      • categoriesarray of object
        Category scope.
        Show attributesHide attributes
        • pos_category_idstring
        • namestring
      • max_itemsinteger
    • rulesRulesRequired
      Show attributesRules
      • min_subtotal_centsinteger
        Integer cents.
        Min 0
      • channelsarray of string
        One of app, web
      • location_idsarray of string (uuid)
      • fulfillmentarray of string
        One of pickup, delivery, curbside, dine_in
      • available_timesarray of AvailableTime
        Show attributesAvailableTime
        • daysarray of string
          Show valuesHide values
          • mon
          • tue
          • wed
          • thu
          • fri
          • sat
          • sun
        • startstring
          Local time, HH:MM.
        • endstring
          Local time, HH:MM.
      • tier_idsarray of string (uuid)
    • starts_atstring (date-time)Nullable
      When the reward becomes available. null means it already is.
    • ends_atstring (date-time)Nullable
      When it stops being available. null means no end date.
  • sourcestringRequired
    How the member got it. See the table below. May grow.
    One of tier, offer, challenge, journey, support, birthday
  • offer_idstring (uuid)Nullable
    The offer, when source is offer.
  • statusstringRequired
    available, reserved, used or expired.
    One of available, reserved, used, expired
  • issued_atstring (date-time)Required
    When it landed in the wallet.
  • expires_atstring (date-time)Nullable
    After this time it can't be used. null means it doesn't expire.
  • used_atstring (date-time)Nullable
    When an order used it.
  • order_idstring (uuid)Nullable
    The order that used it.

Statuses#

statusMeaningMoves to
availableThe member can use it.reserved when a redemption holds it, expired at expires_at.
reservedHeld by a redemption while the guest pays.used when the order is credited, available when the redemption is canceled or its 15-minute hold expires.
usedAn order used it.available again if the order is fully refunded before expires_at.
expiredPast expires_at without being used.Nothing. Final.

Sources#

sourceWhere it came from
tierA reward that comes with the member's tier.
offerA targeted offer sent to this member. offer_id is set.
birthdayThe program's birthday reward.
journeyAn unPLUG journey, for example a win-back message.
supportGiven by your team in the unPLUG dashboard, or by unPLUG support.
challenge Coming soonCompleting a challenge.

A reward.issued webhook fires when an item lands in a wallet, and reward.expiring fires 3 days before it expires. See Webhook event types.

Checkout and orders#

Cart#

Checkout preview request. Omit member_id for a guest with a code.

Used by
  • member_idstring (uuid)
    The member. Leave it out for a guest checkout with a code. With a member token it is always the token's member.
  • location_idstring (uuid)Required
  • channelstringRequired
    app or web.
    One of app, web
  • fulfillmentstringRequired
    pickup, delivery, curbside or dine_in. May grow.
    One of pickup, delivery, curbside, dine_in
  • currencystringRequired
    USD.
  • subtotal_centsintegerRequired
    The sum of every line (unit price plus modifiers, times quantity), before discounts, tax and tip.
    Min 0
  • itemsarray of CartItemRequired
    The cart lines. See below.
    Show attributesCartItem
    • line_idstringRequired
      Your id for the line, unique within the cart.
    • pos_item_idstring
      Square catalog item variation id.
    • namestringRequired
    • quantityintegerRequired
      Min 1
    • unit_price_centsintegerRequired
      Integer cents.
      Min 0
    • pos_category_idsarray of string
    • modifiersarray of object
      Show attributesHide attributes
      • pos_modifier_idstring
      • namestring
      • price_centsinteger
        Integer cents.
        Min 0
  • codesarray of string
  • reward_idsarray of string (uuid)
  • wallet_item_idsarray of string (uuid)

Cart line#

CartItem#

  • line_idstringRequired
    Your id for the line, unique within the cart.
  • pos_item_idstring
    Square catalog item variation id.
  • namestringRequired
  • quantityintegerRequired
    Min 1
  • unit_price_centsintegerRequired
    Integer cents.
    Min 0
  • pos_category_idsarray of string
  • modifiersarray of object
    Show attributesHide attributes
    • pos_modifier_idstring
    • namestring
    • price_centsinteger
      Integer cents.
      Min 0

Preview#

  • member_idstring (uuid)Nullable
  • points_balanceintegerNullable
  • points_to_earninteger
  • applicablearray of PreviewEntryRequired
    Show attributesPreviewEntry
    • typestringRequired
      One of reward, wallet_item, code
    • reward_idstring (uuid)
    • wallet_item_idstring (uuid)
    • codestring
    • namestringRequired
    • points_costinteger
      For reward.
    • discount_centsinteger
      Applicable entries only.
    • affected_line_idsarray of string
      Applicable entries only.
    • Show valuesHide values
      • below_minimum_subtotal
      • wrong_channel
      • wrong_location
      • wrong_fulfillment
      • outside_available_times
      • item_not_in_cart
      • tier_required
      • not_enough_points
      • per_member_limit_reached
      • budget_exhausted
      • not_started
      • expired
      • already_used
    • messagestring
      Not-applicable entries only. Safe to show guests.
  • not_applicablearray of PreviewEntryRequired
    Show attributesPreviewEntry
    • typestringRequired
      One of reward, wallet_item, code
    • reward_idstring (uuid)
    • wallet_item_idstring (uuid)
    • codestring
    • namestringRequired
    • points_costinteger
      For reward.
    • discount_centsinteger
      Applicable entries only.
    • affected_line_idsarray of string
      Applicable entries only.
    • Show valuesHide values
      • below_minimum_subtotal
      • wrong_channel
      • wrong_location
      • wrong_fulfillment
      • outside_available_times
      • item_not_in_cart
      • tier_required
      • not_enough_points
      • per_member_limit_reached
      • budget_exhausted
      • not_started
      • expired
      • already_used
    • messagestring
      Not-applicable entries only. Safe to show guests.
  • challenge_progressarray of object
    Filled when challenges ship (coming soon).

PreviewEntry#

  • typestringRequired
    One of reward, wallet_item, code
  • reward_idstring (uuid)
  • wallet_item_idstring (uuid)
  • codestring
  • namestringRequired
  • points_costinteger
    For reward.
  • discount_centsinteger
    Applicable entries only.
  • affected_line_idsarray of string
    Applicable entries only.
  • Show valuesHide values
    • below_minimum_subtotal
    • wrong_channel
    • wrong_location
    • wrong_fulfillment
    • outside_available_times
    • item_not_in_cart
    • tier_required
    • not_enough_points
    • per_member_limit_reached
    • budget_exhausted
    • not_started
    • expired
    • already_used
  • messagestring
    Not-applicable entries only. Safe to show guests.

RedemptionRequest#

Send exactly one of reward_id, wallet_item_id or code.

Used by
  • member_idstring (uuid)
  • location_idstring (uuid)Required
  • channelstringRequired
    app or web.
    One of app, web
  • fulfillmentstringRequired
    One of pickup, delivery, curbside, dine_in
  • currencystringRequired
    ISO 4217 code. USD.
  • subtotal_centsintegerRequired
    Integer cents.
    Min 0
  • itemsarray of CartItemRequired
    Show attributesCartItem
    • line_idstringRequired
      Your id for the line, unique within the cart.
    • pos_item_idstring
      Square catalog item variation id.
    • namestringRequired
    • quantityintegerRequired
      Min 1
    • unit_price_centsintegerRequired
      Integer cents.
      Min 0
    • pos_category_idsarray of string
    • modifiersarray of object
      Show attributesHide attributes
      • pos_modifier_idstring
      • namestring
      • price_centsinteger
        Integer cents.
        Min 0
  • reward_idstring (uuid)
  • wallet_item_idstring (uuid)
  • codestring

Redemption#

  • idstring (uuid)Required
    Send it in redemption_ids on the order.
  • statusstringRequired
    One of reserved, captured, canceled, expired, reversed
  • member_idstring (uuid)Nullable
    null for a guest code.
  • reward_idstring (uuid)Nullable
    What was redeemed. One is set.
  • wallet_item_idstring (uuid)Nullable
    What was redeemed. One is set.
  • codestringNullable
    What was redeemed. One is set.
  • discount_centsintegerRequired
    The discount on the cart it was created for.
    Min 0
  • points_costintegerRequired
    Points held, then spent on capture. 0 for wallet items and codes.
  • affected_line_idsarray of string
    Cart lines the discount applies to.
  • order_idstring (uuid)Nullable
    The order that captured it.
  • expires_atstring (date-time)Required
    End of the hold, 15 minutes after creation.
  • created_atstring (date-time)

OrderRequest#

Used by
  • external_order_idstringRequired
    Max Length 128
  • member_idstring (uuid)
  • location_idstring (uuid)Required
  • channelstringRequired
    app or web.
    One of app, web
  • fulfillmentstringRequired
    One of pickup, delivery, curbside, dine_in
  • currencystringRequired
    ISO 4217 code. USD.
  • subtotal_centsintegerRequired
    Integer cents.
    Min 0
  • itemsarray of CartItemRequired
    Show attributesCartItem
    • line_idstringRequired
      Your id for the line, unique within the cart.
    • pos_item_idstring
      Square catalog item variation id.
    • namestringRequired
    • quantityintegerRequired
      Min 1
    • unit_price_centsintegerRequired
      Integer cents.
      Min 0
    • pos_category_idsarray of string
    • modifiersarray of object
      Show attributesHide attributes
      • pos_modifier_idstring
      • namestring
      • price_centsinteger
        Integer cents.
        Min 0
  • placed_atstring (date-time)Required
  • discount_centsintegerRequired
    Integer cents.
    Min 0
  • tax_centsintegerRequired
    Integer cents.
    Min 0
  • tip_centsintegerRequired
    Integer cents.
    Min 0
  • total_centsintegerRequired
    Integer cents.
    Min 0
  • redemption_idsarray of string (uuid)
    One at launch.
    Max Items 1
  • attributionobjectComing soon
    Coming soon.
    Show attributesHide attributes
    • link_idstring

Order#

  • idstring (uuid)Required
    unPLUG's id for the order.
  • external_order_idstringNullable
    Your order id. Unique in your brand, forever.
  • statusstringRequired
    credited, partially_refunded or refunded. See Order statuses.
    One of credited, partially_refunded, refunded
  • member_idstring (uuid)Nullable
    null for a guest order, which earns nothing.
  • location_idstring (uuid)Required
  • channelstringRequired
    app or web for orders you send. Points earned at the register also show up, as orders with in_store. May grow.
    One of app, web, in_store
  • fulfillmentstringNullable
    pickup, delivery, curbside or dine_in.
  • placed_atstring (date-time)
    When the guest placed the order. The earn rate and bonuses in force at this time apply.
  • currencystringRequired
    USD.
  • subtotal_centsintegerRequired
    Sum of the lines, before discounts, tax and tip.
    Min 0
  • discount_centsinteger
    All discounts on the order, including the unPLUG redemption.
    Min 0
  • tax_centsinteger
    Recorded for reports. They never earn.
    Min 0
  • tip_centsinteger
    Recorded for reports. They never earn.
    Min 0
  • total_centsinteger
    What the guest paid: subtotal minus discount, plus tax and tip.
    Min 0
  • itemsarray of CartItem
    The cart lines, same shape as preview.
    Show attributesCartItem
    • line_idstringRequired
      Your id for the line, unique within the cart.
    • pos_item_idstring
      Square catalog item variation id.
    • namestringRequired
    • quantityintegerRequired
      Min 1
    • unit_price_centsintegerRequired
      Integer cents.
      Min 0
    • pos_category_idsarray of string
    • modifiersarray of object
      Show attributesHide attributes
      • pos_modifier_idstring
      • namestring
      • price_centsinteger
        Integer cents.
        Min 0
  • points_earnedintegerRequired
    Points from the earn rate, on the subtotal after discounts, rounded down.
  • bonus_pointsinteger
    Extra points from promotions in force at placed_at.
  • redemptionsarray of object
    [{ "id", "status" }] for each redemption the order used.
    Show attributesHide attributes
    • idstring (uuid)
    • statusstring
  • memberobjectNullable
    { "points_balance", "tier" } right after the order was credited. Only on the create response and the order.credited webhook.
    Show attributesHide attributes
    • points_balanceinteger
    • Show attributesTierRef
      • idstring (uuid)Required
      • namestringRequired
  • created_atstring (date-time)Required
    When unPLUG recorded the order.

RefundRequest#

Used by
  • external_refund_idstringRequired
  • amount_centsinteger
    Part of the subtotal refunded. Send this or full.
    Min 1
  • fullboolean
  • reasonstring

Refund#

  • idstring (uuid)Required
  • order_idstring (uuid)Required
  • external_refund_idstringRequired
    Your refund id.
  • amount_centsintegerRequired
    The part of the subtotal after discounts that was refunded. For a full refund, everything not refunded before.
    Min 0
  • fullbooleanRequired
    true for a full refund.
  • reasonstringNullable
    As you sent it.
  • points_reversedintegerRequired
    Earned points taken back.
  • points_shortfallintegerRequired
    Points that couldn't be taken back because the member had already spent them. The balance stops at zero.
  • order_statusstringRequired
    The order's status after this refund: partially_refunded or refunded.
    One of partially_refunded, refunded
  • member_idstring (uuid)Nullable
    The order's member. null for a guest order.
  • memberobjectNullable
    { "points_balance" } after the refund. null for a guest order.
    Show attributesHide attributes
    • points_balanceinteger
  • created_atstring (date-time)Required

Challenges#

Challenge Coming soon#

Coming soon.

Used by
  • idstring (uuid)Required
    The challenge.
  • namestringRequired
    Shown to guests.
  • descriptionstring
    One or two lines for guests.
  • image_urlstring (uri)Nullable
    HTTPS image for the challenge card.
  • typestringRequired
    visits, streak, spend or menu_discovery.
    One of visits, streak, spend, menu_discovery
  • goalobjectRequired
    target (number to reach) and unit (visits, periods, cents or items). Streaks add period (day or week) and grace_periods. Menu discovery adds item_set: items (pos_item_id, name) or categories (pos_category_id, name). Fields that don't apply are null or empty.
    Show attributesHide attributes
    • targetinteger
    • unitstring
      One of visits, periods, cents, items
    • periodstringNullable
      One of day, week
    • grace_periodsintegerNullable
    • item_setarray of object
  • qualifyingobject
    Which orders count: min_subtotal_cents, channels, location_ids, fulfillment, available_times (same shapes as reward rules; empty lists mean no limit) and max_counted_per_day (default 1).
    Show attributesHide attributes
    • min_subtotal_centsinteger
      Integer cents.
      Min 0
    • channelsarray of string
    • location_idsarray of string (uuid)
    • fulfillmentarray of string
      One of pickup, delivery, curbside, dine_in
    • available_timesarray of AvailableTime
      Show attributesAvailableTime
      • daysarray of string
        Show valuesHide values
        • mon
        • tue
        • wed
        • thu
        • fri
        • sat
        • sun
      • startstring
        Local time, HH:MM.
      • endstring
        Local time, HH:MM.
    • max_counted_per_dayinteger
  • windowobject or objectRequired
    { "kind": "fixed", "starts_at", "ends_at" } for the same dates for everyone, or { "kind": "rolling", "days" } for a window per member that starts when they join.
  • enrollmentstringRequired
    automatic or opt_in.
    One of automatic, opt_in
  • rewardobject or objectRequired
    { "kind": "points", "points" } for bonus points, or { "kind": "reward", "reward_id" } for a catalog reward that lands in the wallet.
  • max_completions_per_memberinteger
    Usually 1.
  • budgetobject
    max_completions across all members, or null for no limit.
    Show attributesHide attributes
    • max_completionsintegerNullable
  • statusstringRequired
    draft, scheduled, live, paused or ended.
    One of draft, scheduled, live, paused, ended
  • versioninteger
    Goes up each time a scheduled or live challenge is edited. Members keep the rules of the version they joined.

MemberChallenge Coming soon#

Coming soon. A member's progress on a challenge. member_id appears in webhooks.

  • challenge_idstring (uuid)Required
    The challenge.
  • member_idstring (uuid)
  • statusstringRequired
    eligible (can join, not joined), enrolled, completed or expired.
    One of eligible, enrolled, completed, expired
  • progressobjectRequired
    current, target and unit. For streaks, periods lists each day or week with starts_at, ends_at and met; it's empty for other types.
    Show attributesHide attributes
    • currentinteger
    • targetinteger
    • unitstring
      One of visits, periods, cents, items
    • periodsarray of object
      Show attributesHide attributes
      • starts_atstring (date-time)
      • ends_atstring (date-time)
      • metboolean
  • window_ends_atstring (date-time)Nullable
    When this member's window ends. For a rolling challenge they haven't joined, null.
  • completed_atstring (date-time)Nullable
    When they completed it, or null.
  • reward_wallet_item_idstring (uuid)Nullable
    The wallet item paid on completion, for catalog rewards. null otherwise.

Devices, messages and app events#

Device#

  • device_idstringRequired
    Your id for this install, up to 128 characters. Use a UUID you generate once and keep in app storage.
  • member_idstring (uuid)Required
    The member signed in on the device.
  • platformstringRequired
    ios or android.
    One of ios, android
  • push_tokenstringNullable
    The push token from Firebase or APNs. null if the app has none yet.
  • token_typestringRequired
    fcm (from the Firebase SDK) or apns (a raw APNs token, iOS only).
    One of fcm, apns
  • app_idstring
    iOS bundle id or Android package name. Must be an app support set up for your brand.
  • push_enabledbooleanRequired
    The OS notification permission. Marketing consent is separate: communication_preferences.push_marketing on the member.
  • app_versionstring
    Your app's version, for example 4.2.0.
  • os_versionstring
    For example 18.1.
  • localestring
    BCP 47 tag, for example en-US.
  • time_zonestring
    IANA name, for example America/Chicago. unPLUG uses it for quiet hours.
  • created_atstring (date-time)
    First registration.
  • updated_atstring (date-time)
    Last change.

DeviceWrite#

  • platformstringRequired
    One of ios, android
  • push_tokenstringNullable
    Null until the app has a token.
  • token_typestring
    Required with push_token.
    One of fcm, apns
  • app_idstringRequired
  • push_enabledbooleanRequired
    OS notification permission.
  • app_versionstring
  • os_versionstring
  • localestring
  • time_zonestring

Message#

A full-screen in-app message. Your app draws it.

  • idstring (uuid)Required
    Same as message_id in the push that carried it.
  • layoutstringRequired
    full_image (the image fills the screen and carries the words) or image_and_text (image on top, then title, body and buttons).
    One of full_image, image_and_text
  • image_urlstring (uri)
    HTTPS image.
  • titlestringNullable
    Heading. For full_image, use it as the image's accessibility label.
  • bodystringNullable
    Text under the title.
  • primaryMessageButtonRequired
    The main button: label, action and url. action is open_screen (a link in your scheme or on your link domain), open_url (https, open in a browser) or close (url is null).
    Show attributesMessageButton
    • labelstring
    • actionstring
      One of open_screen, open_url, close
    • urlstringNullable
  • secondaryMessageButtonNullable
    Second button, same shape, or null.
  • offerobjectNullable
    An offer to show with the message, or null. code is a promo code to show; wallet_item_id is an offer already in the member's wallet; text is one line to show next to it.
    Show attributesHide attributes
    • codestringNullable
    • wallet_item_idstring (uuid)Nullable
    • textstring
  • displayobjectRequired
    never_during: screens where the message must not appear. Always includes checkout.
    Show attributesHide attributes
    • never_duringarray of string
  • created_atstring (date-time)Required
    When unPLUG created it.
  • expires_atstring (date-time)Nullable
    Don't show it after this.

Your app always shows its own close button, whatever the buttons say.

MessageButton#

  • labelstring
  • actionstring
    One of open_screen, open_url, close
  • urlstringNullable

MessageEventRequest#

  • typestringRequired
    One of impression, button_tap, close
  • buttonstring
    One of primary, secondary

PushOpenRequest#

  • message_idstring (uuid)Required
  • opened_atstring (date-time)Required
  • buttonstring
    One of primary, secondary

AppEvent#

  • event_idstring (uuid)Required
  • namestringRequired
  • occurred_atstring (date-time)Required
  • member_idstring (uuid)
  • anonymous_idstring
  • device_idstringRequired
  • session_idstringRequired
  • propertiesobject
    No personal data.

AppEventBatch#

Used by
  • eventsarray of AppEventRequired
    Min Items 1Max Items 100
    Show attributesAppEvent
    • event_idstring (uuid)Required
    • namestringRequired
    • occurred_atstring (date-time)Required
    • member_idstring (uuid)
    • anonymous_idstring
    • device_idstringRequired
    • session_idstringRequired
    • propertiesobject
      No personal data.

AppEventResult#

Used by
  • acceptedinteger
  • duplicatesinteger

Webhooks#

WebhookEndpoint#

  • idstring (uuid)Required
    The endpoint's id.
  • urlstring (uri)Required
    Where events are sent. HTTPS on a public hostname.
  • descriptionstringNullable
    Your label, up to 255 characters.
    Max Length 255
  • event_typesarray of stringRequired
    Types this endpoint gets, or ["*"] for all types, including types added later. See Webhook event types.
  • statusstringRequired
    enabled or disabled. unPLUG sets disabled after 3 days of failed deliveries.
    One of enabled, disabled
  • secretstring
    The signing secret, whsec_ followed by base64. Returned only when you create the endpoint or rotate the secret.
  • created_atstring (date-time)Required
    When the endpoint was created.
  • updated_atstring (date-time)Required
    When the endpoint last changed.

WebhookEndpointCreate#

Used by
  • urlstring (uri)Required
    HTTPS on a public hostname.
  • event_typesarray of stringRequired
    Min Items 1
  • descriptionstring
    Max Length 255

WebhookEndpointUpdate#

  • urlstring (uri)
  • event_typesarray of string
    Min Items 1
  • descriptionstring
    Max Length 255
  • statusstring
    One of enabled, disabled

RotateSecretRequest#

  • expire_current_in_hoursinteger
    Default 24. 0 stops the current secret now.
    Min 0Default 24

Event#

The same object is the body of every webhook and what the event log returns. Payloads for each type are on Webhook event types.

  • idstring (uuid)Required
    The event's id. Same value as the webhook-id header, on every attempt and redelivery.
  • typestringRequired
    For example points.changed. The list may grow.
    Show valuesHide values
    • member.created
    • member.updated
    • member.deleted
    • points.changed
    • tier.changed
    • reward.issued
    • reward.redeemed
    • reward.expiring
    • order.credited
    • order.refunded
    • communication_preferences.updated
    • webhook.test
    • points.expiring
    • challenge.joined
    • challenge.progressed
    • challenge.completed
    • referral.completed
  • created_atstring (date-time)Required
    When the change happened. Use it to order events.
  • api_versionstringRequired
    v1.
  • livemodebooleanRequired
    true in production, false in the sandbox.
  • brand_idstring (uuid)Required
    Your brand.
  • dataobjectRequired
    Show attributesHide attributes
    • objectobjectRequired
      Snapshot of the resource.
    • previous_attributesobjectRequired

Delivery#

One attempt to send one event to one endpoint.

  • idstring (uuid)Required
    The delivery attempt's id.
  • event_idstring (uuid)Required
    The event that was sent.
  • webhook_endpoint_idstring (uuid)Required
    Where it was sent.
  • attemptintegerRequired
    1 for the first attempt, then counting up through the retries.
    Min 1
  • statusstringRequired
    pending, succeeded or failed.
    One of pending, succeeded, failed
  • status_codeintegerNullable
    HTTP status your server returned. Null if there was no response.
  • response_msintegerNullable
    How long your server took to respond, in milliseconds.
  • errorstringNullable
    Why it failed when there was no HTTP status, for example timeout, connection_refused, tls_error or dns_error.
  • attempted_atstring (date-time)Nullable
    When the attempt was made.
  • next_retry_atstring (date-time)Nullable
    When the next retry is scheduled. Null after a success or when retries have run out.

RedeliverRequest#

  • webhook_endpoint_idstring (uuid)

ActivityEntryEvent#

  • idstring (uuid)Required
  • typestringRequired
    May grow. expire is coming soon.
    One of earn, bonus, redeem, adjust, reverse, expire
  • pointsintegerRequired
    Signed.
  • balance_afterintegerRequired
  • descriptionstring
  • order_idstring (uuid)Nullable
  • reward_idstring (uuid)Nullable
  • adjustment_reasonstringNullable
    One of goodwill, correction, migration, other
  • created_atstring (date-time)Required
  • member_idstring (uuid)Required

WalletItemEvent#

  • idstring (uuid)Required
  • rewardRewardRequired
    Show attributesReward
    • idstring (uuid)Required
      Send this as reward_id on previews and redemptions.
    • namestringRequired
      For example Free drip coffee.
    • descriptionstring
      Short text for the guest.
    • image_urlstring (uri)Nullable
      HTTPS image URL.
    • kindstringRequired
      points (catalog) or wallet (given to one member). May grow.
      One of points, wallet
    • points_costinteger
      Points the reward costs. Only on points rewards; wallet rewards don't have it.
    • discountDiscountRequired
      Show attributesDiscount
      • typestringRequired
        One of amount, percent, free_item, bogo
      • amount_centsinteger
        For amount.
      • percentnumber
        For percent.
      • itemsarray of object
        Item scope, by Square variation id.
        Show attributesHide attributes
        • pos_item_idstring
        • namestring
      • categoriesarray of object
        Category scope.
        Show attributesHide attributes
        • pos_category_idstring
        • namestring
      • max_itemsinteger
    • rulesRulesRequired
      Show attributesRules
      • min_subtotal_centsinteger
        Integer cents.
        Min 0
      • channelsarray of string
        One of app, web
      • location_idsarray of string (uuid)
      • fulfillmentarray of string
        One of pickup, delivery, curbside, dine_in
      • available_timesarray of AvailableTime
        Show attributesAvailableTime
        • daysarray of string
          Show valuesHide values
          • mon
          • tue
          • wed
          • thu
          • fri
          • sat
          • sun
        • startstring
          Local time, HH:MM.
        • endstring
          Local time, HH:MM.
      • tier_idsarray of string (uuid)
    • starts_atstring (date-time)Nullable
      When the reward becomes available. null means it already is.
    • ends_atstring (date-time)Nullable
      When it stops being available. null means no end date.
  • sourcestringRequired
    One of tier, offer, challenge, journey, support, birthday
  • offer_idstring (uuid)Nullable
  • statusstringRequired
    One of available, reserved, used, expired
  • issued_atstring (date-time)Required
  • expires_atstring (date-time)Nullable
  • used_atstring (date-time)Nullable
  • order_idstring (uuid)Nullable
  • member_idstring (uuid)Required

DeletedMember#

  • idstring (uuid)Required
  • external_idstringNullable
  • statusstringRequired
  • deleted_atstring (date-time)Required

TierChange#

  • member_idstring (uuid)Required
  • previous_tierTierRefRequired
    Show attributesTierRef
    • idstring (uuid)Required
    • namestringRequired
  • tierTierRefRequired
    Show attributesTierRef
    • idstring (uuid)Required
    • namestringRequired
  • directionstringRequired
    One of up, down

CommunicationPreferencesEvent#

  • email_marketingbooleanRequired
  • sms_marketingbooleanRequired
  • push_marketingbooleanRequired
  • updated_atstring (date-time)Required
  • sourcestringRequired
    Set automatically.
    One of app, web, api, unsubscribe_link
  • member_idstring (uuid)Required

PointsExpiring#

Coming soon.

  • member_idstring (uuid)
  • pointsinteger
  • points_balanceinteger
  • last_activity_atstring (date-time)
  • expires_atstring (date-time)

ReferralCompleted#

Coming soon.

  • idstring (uuid)
  • referrer_member_idstring (uuid)
  • referred_member_idstring (uuid)
  • qualifying_order_idstring (uuid)Nullable
  • completed_atstring (date-time)

WebhookTest#

  • webhook_endpoint_idstring (uuid)
  • messagestring

Test helpers#

TestInStoreOrderRequest#

Used by
  • member_idstring (uuid)Required
  • location_idstring (uuid)Required
  • subtotal_centsintegerRequired
    Integer cents.
    Min 0

TestWalletRequest#

  • reward_idstring (uuid)Required

TestWebhookRequest#

Used by
  • typestringRequired
    Event type. May grow.
    Show valuesHide values
    • member.created
    • member.updated
    • member.deleted
    • points.changed
    • tier.changed
    • reward.issued
    • reward.redeemed
    • reward.expiring
    • order.credited
    • order.refunded
    • communication_preferences.updated
    • webhook.test
    • points.expiring
    • challenge.joined
    • challenge.progressed
    • challenge.completed
    • referral.completed