Loyalty API
RedeemPoints1
Creates a discount code to redeem the customer's loyalty points.
Method | POST |
---|---|
Kind | Write |
URL | https://app.bubblehouse.com/api/v2023061/<shop>/RedeemPoints1 |
Authentication | Customer TokenShop TokenPartner Token for CustomerPartner Token for Shop |
You have a choice of making this call from your server using a shop token and specifying a customer ID, or making this call from a web browser/app using a customer token you have generated on the server.
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.
pts
integerrequiredThe number of points to redeem.
no_coupon
booleanoptionalWhen true, deducts points but does not generate a discount code.
Use this when the caller has already created and applied their own internal coupon or discount in their system. The points will be deducted from the customer's balance, but no Shopify discount code will be created or returned.
This is primarily used by partner integrations that manage their own coupon systems and only need Bubblehouse to track the point redemption.
The current cart subtotal amount.
Provide this value when the redemption is happening in the context of a purchase (e.g., checkout, POS) to enable minimum order value validation. If the shop has configured a minimum order value for point redemptions, this value will be checked against that threshold.
This parameter is optional and can be omitted for non-purchase contexts (e.g., converting points to gift cards, subscription discounts).
Output
code
stringrequiredThe discount code that was created for this redemption.
When
no_coupon
is true, this will be an empty string since no discount code is generated.pts
integerrequiredThe number of points that were redeemed.
The monetary value of the points that were redeemed.
The ID of the point balance change record created by this redemption.
This ID can be used later to undo or reference this specific point redemption. It will be a valid Bubblehouse ID when points are successfully redeemed, or zero when no change was made (though this should not normally happen for successful redemptions).
remove_coupon_codes
array of stringsoptionalList of coupon codes that should be removed from the customer's cart.
This is used in provisional redemption scenarios where previously applied codes need to be replaced.
Specific Errors
Status | Error | Reason & Examples |
---|---|---|
{} | ||
{} | ||
{} | ||
{} | ||
{} |
API-wide Errors
Status | Error | Reason & Examples |
---|---|---|
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. {"id":"missing_customer_identity"} |
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. {"id":"empty_customer_identity"} |
404 | no_customers_match_customer_identity | The customer identity ('customer' input parameter) does not match a known customer. {"id":"no_customers_match_customer_identity"} |
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. {"id":"customer_identity_partially_mismatches_matched_customer"} |
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. {"id":"customer_identity_does_not_match_token"} |
Global Errors
Status | Error | Reason & Examples |
---|---|---|
401 | invalid_token | The provided authentication token is invalid or has expired. {"id":"invalid_token","message":"The token has expired"} |
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. {"id":"rate_limit_exceeded","message":"You are over the read limit per second for this customer"} |
400 | obsolete_global_api_version | The global API version you are trying to use is no longer supported. {"id":"obsolete_global_api_version"} |
400 | invalid_global_api_version | The global API version you are trying to use has never existed. {"id":"invalid_global_api_version"} |
400 | inaccessible_global_api_version | The global API version you are trying to use is not enabled on your account. {"id":"inaccessible_global_api_version"} |