ENSC Business API
Business DashboardWebsite
  • Introduction
    • Use Cases
    • Configurations
  • Ready To Integrate?
  • Getting Started
    • Security
      • Generating Keys
      • Encrypting / Decrypting Request
  • Integrations
    • Contract Address
    • Enums
    • Authorization
    • Endpoints
      • Get Bank Lists
      • Token Balance
      • Token Approval
      • Mint
      • Mint Allocation
      • Redeem
      • Transfer
      • Withdraw
      • Verify Payout/Withdrawal
  • Libraries/SDKs
    • Client Libraries
Powered by GitBook
On this page
  1. Integrations
  2. Endpoints

Redeem

If this entity information is missing, the endpoint returns a 401 Unauthorized error.

PreviousMint AllocationNextTransfer

Last updated 2 months ago

POST /redeem

This endpoint initiates a token redemption process by generating an unsigned redeem transaction. It performs several checks: validating input parameters, verifying the recipient's token , resolving the bank account details, and sending a notification email. The unsigned transaction details are then returned to the client for signing and broadcasting.

Headers

Name
Value

Content-Type

application/json

Authorization

Bearer <api_key>

Body

Name
Type
Description

recipient

string

The wallet address of the user (must be a valid EVM address).

amount

number

The amount of tokens to redeem.

assetType

string

The type of asset to redeem. Must be one of the enums (e.g., "ENSC", "USDC", "USDT", "LSK").

payoutEmail

string

Email address to which the payout reference pvRef will be sent (Required only if assetType is ENSC. For non‑ENSC assets, this field is omitted.).

bank

string

The local Nigerian bank code gotten from the get-banks endpoint (Conditionally Required: Required only if assetType is ENSC (e.g., '058', '044').

accountNumber

string

The bank account number (Required only if assetType is ENSC (e.g., '0123456789', '0690000032').

Example 1

{
  "recipient": "0xRecipientAddressABC123",
  "amount": 100,
  "assetType": "ENSC",
  "payoutEmail": "user@example.com",
  "bank": "058",
  "accountNumber": "0123456789"
}
{
  "status": 200,
  "message": "Transaction processed successfully",
  "data": {
    "to": "0xDexContractAddressDEF456",
    "value": 0,
    "gasLimit": "0x186a0",
    "gasPrice": "0x4a817c800",
    "nonce": "5",
    "data": "0xEncodedRedeemFunctionCallForENSC",
    "pvRef": "PV-ABCD1234",
    "txStatus": "PENDING",
    "payout": {
      "accountName": "Resolved Account Name",
      "bank": "058",
      "accountNumber": "0123456789"
    }
  }
}

Example 2

{
  "recipient": "0xRecipientAddressABC123",
  "amount": 50,
  "assetType": "USDC"
}
{
  "status": 200,
  "message": "Transaction processed successfully",
  "data": {
    "to": "0xDexContractAddressDEF456",
    "value": 0,
    "gasLimit": "0x186a0",
    "gasPrice": "0x4a817c800",
    "nonce": "8",
    "data": "0xEncodedRedeemFunctionCallForUSDC"
  }
}

Common Error Responses

{
  "status": 401,
  "error": "Unauthorized",
  "message": "Unauthorized: Missing entity data"
}
{
  "status": 400,
  "error": "Invalid Request",
  "message": "payoutEmail is required"
}
{
  "status": 400,
  "error": "Invalid Request",
  "message": "Invalid recipient address"
}
{
  "status": 400,
  "error": "Invalid Asset",
  "message": "Provided asset type is not whitelisted"
}
{
  "status": 400,
  "error": "Invalid Request",
  "message": "Insufficient allowance to spend from user token balance"
}
{
  "status": 400,
  "error": "Bank Account Resolution Failed",
  "message": "Unable to resolve bank account details"
}
allowance