Join the program
Subscribes the user to the commerce's loyalty program and returns the welcome reward.
Subscribes the user to the commerce's loyalty program. If the commerce configured a
welcome reward, it comes back in welcome_benefit or welcome_points.
Verifying the code already subscribes the user
Verifying a code already leaves the user subscribed, so this endpoint is mostly for re-joining after opting out.
Headers
X-Commerce-IdintegerheaderrequiredId of the commerce integrating the API. Every response is scoped to this commerce.
It carries no body.
Response
messagestringrequiredThe operation's result.
welcome_benefitBenefit | nullThe welcome benefit, if the commerce configured one and the user just joined. See Benefit.
welcome_pointsinteger | nullWelcome points, if the commerce configured points instead of a benefit.
curl -X POST https://loybox-public-api-752998171300.southamerica-west1.run.app/v1/me/subscription \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "X-Commerce-Id: 87"// 200 OK
{
"message": "Subscribed successfully",
"welcome_benefit": {
"id": "b_4c81",
"type": "free_product",
"description": "Café de regalo",
"cost": 0,
"expiration": null,
"benefit_type": "welcome",
"color": "#f1a10d",
"buy_limit": 1,
"prize": null,
"tiendanube_coupon": null
},
"welcome_points": null
}The two welcome fields are mutually exclusive: one or the other comes back,
depending on what the commerce configured. If it configured nothing, both come back
null.
This is a good moment to show a welcome screen: if welcome_benefit came, the
reward; if welcome_points came, the points they just earned.
Errors
| Code | When |
|---|---|
401 | The access token is missing, expired, or does not belong to an end user. |
404 | The commerce does not exist. |
422 | The X-Commerce-Id header is missing. |