Redemption API

About Redemption

The Redemption API enables you to expend (or "burn") end-user asset (called an Award in the user and admin dashboards), while logging what they were redeemed for, such as a discount on a purchase. Functional use cases include:

  1. Redeeming store credits during the check out flow

  2. Redeeming loyalty points for perks, like an upgrade to a first-class seat

Although the Master Award Control -> Burn API also offers the option to effectively delete assets from the Village Ledger, the Redemption API is the preferred method for use cases in which users are trading their assets for something else, because it allows you to log what they were redeeming those asset for.

To see more about real-world Redemption use cases, check out our Guides->.

Important: in order to be redeemed using the Redemption API, awards need to be created as 'non-monetary award' types. Status & Badges cannot be burned/redeemed.

Endpoint

POST/networks/YOUR_NETWORK_ID/redemption

Where 'YOUR_NETWORK_ID' is replaced with your actual Network ID.

API Field Overview

Body Fields

Metadata

Examples

Body

// Example Redemption Body
{
    "user": "johnny.redemption@villagelabs.co",
    "asset_short_id": "POINT",
    "amount": "100.00",
    "metadata": {
        "reference_id": "dpi_Ylo2Cfr8US8u1JIdAl2eZvKB",
        "redemption_timestamp": 1664900628,
        "redeemed_for": "discount",
        "redeemed_for_amount": "15%",
        "description": "Standard 100 token for 15% discount redemption."
    }
}

By Language

# Remember to replace 'Bearer YOUR_API_KEY' and 'YOUR_NETWORK_ID' with your actual API key and Network ID

import requests
import json

url = "https://api-ledger.villagelabs.net/networks/YOUR_NETWORK_ID/redemption"

headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer YOUR_API_KEY"
}

data = {
    "user": "johnny.redemption@villagelabs.co",
    "asset_short_name": "POINT",
    "amount": "100.00",
    "metadata": {
        "reference_id": "dpi_Ylo2Cfr8US8u1JIdAl2eZvKB",
        "redemption_timestamp": 1664900628,
        "redeemed_for": "discount",
        "redeemed_for_amount": "15%",
        "description": "Standard 100 token for 15% discount redemption."
    }
}

response = requests.post(url, headers=headers, data=json.dumps(data))

print(response.json())

Last updated