Loyalty API
Write CallCart2
Evaluates a cart for loyalty: spendable balance, redemption constraints, estimated points, and (when mutating) coupon effects.
| Kind | Write API call |
|---|---|
| Method | POST |
| URL | https://app.bubblehouse.com/api/v2023061/<shop>/Cart2 |
| Authentication | Customer TokenShop Token |
Send the current cart as an Order2. Bubblehouse returns the customer's balance and redemption constraints as if no pending provisional redemption existed, plus an estimate of points after checkout.
preset selects a Cart2 configuration. Unknown values return unknown_preset.
Mutating Cart2 uses provisional coupons. desired_redemption_pts is the total to have redeemed after this call, including any Bubblehouse coupon already on the cart. It is not how many extra points to add. Send 0 to clear.
After you apply cart_changes_to_apply.add_coupons, call Cart2 again with the same desired_redemption_pts and those coupon codes on the cart. cart_changes_to_apply is empty: same pending, same code. Do not add the new coupon's points on top of the total.
Example at the default 1 point = 10 cents: cart $20, no codes, desired_redemption_pts 50 returns a $5 coupon. Apply that code. The cart remaining to pay is $15. Call again with desired_redemption_pts 50 (not 100) and that code on discount_codes, sending $15 as amount_subtotal and amount_spent. No coupon changes.
Input
-
presetstring requiredCart2 preset name.
Public presets:
cart(custom checkout; mutates whendesired_redemption_ptsis set orcan_apply_cart_effectsis true),pdp(product-page estimate, never mutates), andreadonly(estimate only, never mutates).Bubblehouse may add specific per-client presets.
-
Customer to evaluate. Omitted or unknown customers are treated as empty.
-
Market and locale context when not provided on the cart.
-
The current cart, using the same Order2 shape as UpdateOrders4.
-
desired_redemption_ptsinteger optionalTotal points that should be redeemed against this cart after the call, including any Bubblehouse coupon already applied.
This is the whole redemption, not an increment. If 50 points are already pending and you still want 50, send 50 again with the coupon code on the cart. Cart2 returns no add/remove coupon effects.
Send 0 to clear the pending coupon.
-
can_apply_cart_effectsboolean optionalTrue when the caller is ready to apply returned cart changes.
Output
-
Undocumented. Omitted for public presets.
-
Coupon and line-item effects for the caller to apply to their cart.
-
Customer balance as if no pending provisional redemption existed.
-
Redemption min/max/buckets for the whole pending total.
-
Current provisional pending redemption after this call.
-
Estimated order points and balance after checkout.
Specific Errors
| Status | Error | Reason & Examples |
|---|---|---|
| 400 | unknown_preset |
The preset name is missing or is not a known builtin or configured preset. |
| 422 | cart_not_mutating |
desired_redemption_pts does not match the current pending redemption, and this Cart2 preset cannot change redemptions. |
| 422 | invalid_request_data |
The request is missing a required field or contains invalid values. |
| 422 | insufficient_points |
Attempting to redeem more points than the customer has. |
| 422 | points_disabled |
You have not enabled points in the admin portal. |