Create consumption by email
Records a purchase using the member's email, even if they do not have a Loybox account yet.
POST/v1/consumptions/emailCommerce API key
Records a new consumption using the member's email. This is the one to use at an online checkout, where you already have the email and asking the member for a code would be redundant.
It works even if the member has no account
If the email does not match any Loybox account, the consumption is created anyway and an email automatically goes out inviting them to register. When they register, the points from that purchase are already waiting for them.
It is how the program starts accruing value before the member joins.
Body
client_emailstringrequiredEmail of the member who made the purchase.
amountintegerrequiredThe purchase amount, in whole units of the commerce's currency.
Example
curl -X POST https://loybox-public-api-752998171300.southamerica-west1.run.app/v1/consumptions/email \
-H "Authorization: Bearer $LOYBOX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"client_email": "ana@example.com",
"amount": 1750
}'// 201 Created
{
"message": "Consumption created successfully"
}Errors
| Code | When |
|---|---|
400 | The consumption could not be created. |
403 | The client exists but is not eligible to have consumptions. |
404 | The client does not exist. |
422 | A body field is missing, or the email is not a valid format. See Validation errors. |