Docs/Protocol reference/Redeem action

Redeem action

A developer-focused reference for constructing and signing a burn that adds tokenized points back into the brand account.

When to use#

Redeem when a customer adds tokenized points back into the brand account.

A redemption burns the exact signed tokenized amount from the selected expiry bucket after validation succeeds. deadline can limit how long the signed redemption remains executable. The brand should credit or restore points in the brand account only after the burn receipt is indexed and finalized, and should process each receipt exactly once.

Fields#

FieldTypeRequiredMeaning
issueraddressexternal signingBrand wallet that signs the redemption. Omit together with the issuer signature for enabled API signing.
loyaltyIdbytes32yesBrand-scoped program ID.
amountuint256 stringyesTokenized loyalty amount to burn and reconcile offchain. Must be greater than zero.
expiresAtuint256 stringyesThe exact bucket to burn. Use 0 for non-expiring balances.
deadlineuint256 stringyesLast Unix timestamp when the redemption can be submitted. Use 0 for no execution deadline.
noncebytes32yesUnique per issuer. Replays are rejected.
chainIduint256 stringyesExpected chain ID. Loyfin uses Base 8453.
verifyingContractaddressyesThe Loyfin factory that will execute the action.
operationHashbytes32optionalBrand reference hash for correlating this action with an internal database row. Defaults to zero bytes when omitted.
datahex bytesoptionalBrand-defined fulfillment data. Defaults to 0x. Max 2048 bytes.

Example#

RedemptionActionjson
{
  "redemption": {
    "issuer": "0x1111111111111111111111111111111111111111",
    "loyaltyId": "0x4242424242424242424242424242424242424242424242424242424242424242",
    "amount": "250",
    "expiresAt": "0",
    "deadline": "1790965800",
    "nonce": "0x7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b",
    "chainId": "8453",
    "verifyingContract": "0x3333333333333333333333333333333333333333",
    "operationHash": "0x9999999999999999999999999999999999999999999999999999999999999999",
    "data": "0x"
  },
  "signature": "0xababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab",
  "from": "0x2222222222222222222222222222222222222222"
}