Loyalty API
Write CallRedeemOffer1
Spend a customer's points on a reward from ListOffers1, such as a free product, gift or discount. Deducts the points and returns the coupon code or redemption status.
| Kind | Write API call |
|---|---|
| Method | POST |
| URL | https://app.bubblehouse.com/api/v2023061/<shop>/RedeemOffer1 |
| Authentication | Customer Token |
Endpoint requests redemption of an offer and will deduct points cost from the customer's loyalty points. If the customer has enough points, the offer will be redeemed and the customer's points will be deducted. If the customer doesn't have enough points, the endpoint will return an error.
A store can limit how many pending in-store rewards a customer holds (see the in_store destination in RedeemDestination1). Under a limit, redeeming an in-store offer the customer already holds returns the existing pending redemption without spending points, even though pts_spent reports its original cost; reload the balance rather than subtracting it. Refusals under that limit return HTTP 200 with success false and a message to show the customer; no points are spent.
Input
-
A customer to operate upon, when using a shop token.
If you're using a customer token and decide to pass this field (which we do not recommend), it must match the customer from the token.
-
offer_idstring requiredUnique ID of the offer in the Bubblehouse system, returned by ListOffers1.
-
Destination to add the redeemed object to. Use when instructed by Bubblehouse team.
-
extrasJSON object optionalExtra information to store in the change object. Talk to Bubblehouse team about your use cases before using this.
-
subscription_idstring optionalPlatform subscription id to receive this reward when the reward is sent to a subscription.
Use the same id you send on UpdateSubscriptions1. The subscription must already be active for this customer. A miss returns success false and "Subscription not found." and does not spend points.
When the reward is not sent to a subscription, this field is ignored. When it is omitted, Bubblehouse keeps its automatic subscription choice.
Example:
"SUB-1001"
Output
-
successbool requiredWhether the redemption was successful or not.
-
messagestring optionalAn optional message describing the result of the redemption.
-
offer_titlestring optionalThe title of the redeemed offer.
-
pts_spentinteger optionalThe number of points spent to redeem the offer.
-
coupon_codestring optionalThe coupon code associated with the redeemed offer, if any.
-
change_bhidstring optionalBubblehouse ID of the redemption change; needed to cancel a pending redemption through Unredeem1.
-
redemption_statusstring optionalStatus of the redemption after this call, e.g. pending.
-
channelstring optionalSet to retail when the offer was redeemed for in-store use; absent otherwise.
Specific Errors
| Status | Error | Reason & Examples |
|---|---|---|
| 422 | minimum_completed_purchases_not_met |
The customer has not completed the minimum number of purchases required to redeem points or offers. |
API-wide Errors
| Status | Error | Reason & Examples |
|---|---|---|
| 404 | customer_identity_partially_mismatches_matched_customer |
A customer has been matched by one of the fields of the customer identity ('customer' input parameter), but some non-empty fields do not match Bubblehouse data on that customer. |
| 404 | no_customers_match_customer_identity |
The customer identity ('customer' input parameter) does not match a known customer. |
| 404 | empty_customer_identity |
All fields of the customer identity ('customer' input parameter) have been empty when using a shop token. You need to either specify a non-empty value for one of the customer identity fields, or use a customer token. |
| 400 | missing_customer_identity |
The customer identity ('customer' input parameter) has not been specified when using a shop token. You need to either specify a non-empty value for one of the customer identity fields, or use a customer token. |
| 403 | customer_identity_does_not_match_token |
API call is using a customer token, but the customer identity in API params does not match the customer from the token. |
Global Errors
| Status | Error | Reason & Examples |
|---|---|---|
| 429 | rate_limit_exceeded |
Your usage is over the rate limit. Ensure that you're not making duplicate calls, and contact our team for a rate limit increase. For example: |
| 400 | inaccessible_global_api_version |
The global API version you are trying to use is not enabled on your account. |
| 400 | invalid_global_api_version |
The global API version you are trying to use has never existed. |
| 400 | obsolete_global_api_version |
The global API version you are trying to use is no longer supported. |
| 401 | invalid_token |
The provided authentication token is invalid or has expired. For example: |