Registrar un movimiento de puntos o sellos
Ledger
POST /v1/loyalty/memberships/{id}/ledger
Accrue, redeem, or correct points and stamps. Updates the balance and the customer’s wallet card.
POST
Registrar un movimiento de puntos o sellos
Records a movement against a membership. This is the endpoint your point of sale calls: it moves the balance, writes the audit entry, and pushes the new number to the card in the customer’s wallet.
Whether the movement touches points or stamps is decided by the program, not by this call. You never pass a metric.
How
Endpoint
Required scope
loyalty:write
Headers
Path parameters
Body
How kind maps to the balance
Example request
Response
201 Created
400 Bad Request
kind outside the allowed set, a non-numeric amount, a field over its length limit, or a property the endpoint does not accept.
401 Unauthorized
Missing, invalid, revoked, or expired token.403 Forbidden
The token does not have theloyalty:write scope.
404 Not Found
No membership with that id in your company.502 Bad Gateway
The loyalty service is unreachable.Operational notes
- This call is not idempotent. There is no deduplication on
ref. A retry after a network timeout may double-count, so record the returned entry_idand check the ledger before retrying. - The balance never goes below zero. Redeeming more than the customer has clamps to
0and succeeds — it does not fail. If you need to reject an unaffordable redemption, check the balance first and decide on your side. - Nothing validates a redemption against a reward. Loyalty has no reward catalogue:
redeemjust subtracts. What the customer receives is your business logic. - The wallet card updates on its own. After the movement, the pass in Apple or Google Wallet is refreshed with the new balance. You do not need to call the notify endpoint for that — notify is for sending a message, not for syncing a number.
- On a
stampsprogram,amountis a stamp count. Sendingamount: 1adds one stamp. Sending120adds 120 stamps, which is almost certainly not what you meant — the program type is what you should branch on. - Tiers are recomputed on every movement, against the point balance and the program’s thresholds.
Authorizations
Personal Access Token con prefijo kbai_pk_. Generar desde el portal con permiso developer.manage_tokens.
Path Parameters
Body
application/json
earn suma, redeem resta, adjust respeta el signo de amount para correcciones
Available options:
earn, redeem, adjust Magnitud del movimiento. En earn y redeem se toma el valor absoluto; en adjust se respeta el signo
Example:
120
De dónde vino el movimiento. Por defecto manual
Example:
"pos-sucursal-centro"
Referencia externa, por ejemplo el número de boleta
Example:
"boleta-99120"
Example:
"Compra de 12.000 en tienda"
Response
201 - application/json