Skip to content

Send Gifts

Gift vouchers are prepaid cards that hold a specific monetary value. They can be used as a form of payment for goods or services at any merchants that work with Telesend.

Sending Gifts requires three steps

  1. Generating Voucher
  2. Redeeming Voucher
  3. Partially Redeeming Voucher
  4. Transfer Gifts to Another Person

1. Generate Vouchers

Endpoint

sh
> POST ${BASE_URL}/topup-transactions/generate-voucher
  • First step to use a voucher is to generate it so it would be redeemable by users.

  • To generate a voucher a "denominated gift amount" and a merchant id is needed. Denominated gifts are a centeralized gift amounts that are defined by our system and can be configured from your side for each merchant. You can find the available merchants and their identifiers using the merchants endpoint.

Denominated Gifts

  • Denominated Gifts hold the amount information a single voucher can hold after it is generated and they are defined centerally by Telesend.
  • Each Denominated Gift holds information about its given amount and its status.
  • The selling price for each of the denominated gifts can be negotiated between you and your merchants. You can see below to see how you can define these selling prices.
  • Gift denomination id is required to be provided in your body request. and you can get the list of denominated gifts using.

Endpoint

sh
> GET /client/gift-denominations

Response Schema

ts
{
success: boolean;
message: string;
statusCode: number;
data: [
  {
    id: number,
    status: 'ACTIVE' | 'INACTIVE', 
    amountEtb: number, 
   }
 ]
}

Defining Selling Price for Denominated Gifts

You can define selling prices (USD) for each denominated Gift Amount (ETB) for each merchant. This information will be saved and centeralized in Telesend.

POST /client/partner-gift-denomination-prices

{
    'denominationId': 'the denomination of the gift (gift-denomiations see above #1)', 
    'sellingPriceUsd': '124',
}

The body for generating voucher can vary based on your usecase of the voucher. The available ways are listed below.

1.1. Vouchers

In these kind of Vouchers, the end owner of the voucher is known at the time of Generation and can't be used by any phone number other than the voucher sent to. These types of vouchers need to be verified by user before they are utilized. /check initiateing redeem/

NAMETypeDescriptionRequiredDefault Value
denominationIdnumberID of the denominated Gift.Yes-
merchantIdnumberId of MerchantYes
msisdnstringThe phone number of the user who will claim the voucher/gift.Yes-
exchangeRatestringUSD -> ETB Exchange Rate used for this saleYes-
currencystringThe original currency used to buy the airtimeYes-
originatingCountrystringFrom where country is this request comingYes-
foreignCurrencyAmountstringAmount in USD representing the sale price of the gift in USDYes-

1.2. Vouchers that can be redeemed by a different merchant.

Although specifying a merchant is necessary when generating vouchers, there are some scenarios where we would want the redeemed merchant to be different than the initial specified merchant. This feature has to be enabled on time of generating (It is disabled by default).

Payloads

Note: add this payload to the above request body

NAMETypeDescriptionRequiredDefault Value
isRestrictedbooleanIndicates whether the voucher can be transferred to another merchant.Notrue

Sample Request

sh
$  curl -H 'Content-Type: application/json' \
        -H 'x-api-token: ACCESS_TOKEN' \
        -d '{
              "denominationId": 7,
              "merchantId": 1,
              "msisdn": "251911234567",
            }' \
        "BASE_URL/generate-voucher"
Typescript
import * as axios from "axios";

const data = {
  denominationId: 7,
  merchantId: 1,
  msisdn: "251911234567",
};

axios
  .post("BASE_URL/generate-voucher", data, {
    headers: {
      "Content-Type": "application/json",
      "x-api-token": "ACCESS_TOKEN"
    },
  })
  .then((response) => {
    console.log("Success:", response.data);
  })
  .catch((error) => {
    console.error(
      "Error:",
      error.response ? error.response.data : error.message,
    );
  });

Response Schema

Success Schema

ts
{
  success: boolean;
  message: string;
  statusCode: number;
  data: {
    voucher: {
      id: string;
      voucherCode: string;
      amount: string;
    }
  }
}

Error Schema

ts
{
  statusCode: number;
  success: boolean;
  message: string;
  data: any;
}

Error Types

MessageStatus CodeSuccess_Addtional Note_
Either merchantId or merchantIdentifier should be Specified400false-
No Price defined for the product404false-
You have no access to this product. please contact Admins.404false-
You do not have adequate amount of money405false-

2. Initiate Redeem /Optional/

This part is necessary if the voucher is not annoynomous. If you dont know what annoynomous vouchers are please refer to #1.1 above.

If a voucher is not annoynomous, we need to verify if the owner is the one who initiated the redeem. At the time of executing this endpoint a verification code is going to be sent to the user which he can use to initiate the redeem (see #3.)

Endpoint

sh
> POST ${BASE_URL}/topup-transactions/initiate-claim

Payloads

NAMETypeRequiredDescription
voucherCodestringYesVoucher Code that is going to be claimed (found from #1)
amountnumberNo (voucher amount will be used if not specified)The amount of money to start redeeming

Sample Request

sh
$  curl -H 'Content-Type: application/json' \
        -H 'x-api-token: ACCESS_TOKEN' \
        -d '{
              "voucherCode": "VOUCHER123",
              "amount": 500
            }' \
        "BASE_URL/topup-transactions/initiate-claim"
Typescript
import * as axios from "axios";

const data = {
  voucherCode: "VOUCHER123",
  amount: 500
};

axios
  .post("BASE_URL/topup-transactions/initiate-claim", data, {
    headers: {
      "Content-Type": "application/json",
      "x-api-token": "ACCESS_TOKEN"
    },
  })
  .then((response) => {
    console.log("Success:", response.data);
  })
  .catch((error) => {
    console.error(
      "Error:",
      error.response ? error.response.data : error.message,
    );
  });

Response Schema

Success Schema

ts
{
  success: boolean;
  message: string;
  statusCode: number;
  data: "Voucher code has been sent to user Successfully";
}

Error Schema

ts
{
  statusCode: number;
  success: boolean;
  message: string;
  data: any;
}

Error Types

MessageStatus CodeSuccess_Addtional Note_
Voucher is already Redeemed404false-
No voucher with specified code404false-
Specified amount is more than the remaining voucher amount403false-

3. Redeem Vouchers

This is the last step in sending gifts that need to be handled by end user apps. At the time of execution if it is Successful, the specified amount would be transferred to merchants.

sh
> POST ${BASE_URL}/topup-transactions/redeem-gift

Payloads

NAMETypeRequiredDescription
voucherCodenumberYesVoucher Code that is going to be claimed
verificationCodestringNoVerification Code end user got via SMS when initiate-redeem was executed
msisdnstringThe phone number of the user who will claim the voucher/gift.Not required. It will be taken from the original voucher owner specified when generating.

At the time of redeem the vouchers balance is transferred to the merchant while a service fee will be deducted from the voucher's remaining balance according to the merchant's service fee percent.

3.1. Redeeming in a different merchant

In addition to the above payloads (based on ur preferred scenario) you also need to pass merchantId if the money merchant is not the one specified at the time of generation (see #1.3)

Payloads

NAMETypeDescription
merchantIdnumberMerchant Id where the money will be transferred if the request was successful

Sample Request

sh
$  curl -H 'Content-Type: application/json' \
        -H 'x-api-token: ACCESS_TOKEN' \
        -d '{
              "voucherCode": "VOUCHER123",
              "verificationCode": "CODE123"
            }' 
        "BASE_URL/topup-transactions/redeem-gift"
Typescript
import * as axios from "axios";

const data = {
  voucherCode: "VOUCHER123",
  verificationCode: "CODE123",
};

axios
  .post("BASE_URL/topup-transactions/redeem-gift", data, {
    headers: {
      "Content-Type": "application/json",
      "x-api-token": "ACCESS_TOKEN"
    },
  })
  .then((response) => {
    console.log("Success:", response.data);
  })
  .catch((error) => {
    console.error(
      "Error:",
      error.response ? error.response.data : error.message,
    );
  });

Response Schema

Success Schema

ts
{
  success: boolean;
  message: string;
  statusCode: number;
  data: {
    response: string; // success response message
    referenceNumber: string; // telebirr reference number
  }
}

Error Schema

ts
{
  statusCode: number;
  success: boolean;
  message: string;
  data: any;
}

Error Types

MessageStatus CodeSuccess_Addtional Note_
Voucher is already Redeemed404false-
No voucher with specified code404false-
Specified amount is more than the remaining voucher amount403false-
Verification Code is missing403falseIf the voucher is not annoynomous
No Voucher redeem process started for by owner403falseIf the voucher is not annoynomous
The provided verification code is not correct.403falseIf the voucher is not annoynomous
Expiration date has already passed.403falseIf the voucher is not annoynomous
The given voucher is restricted. You cant change merchant using this voucher card403falseIf the voucher is not transferrable to another merchant and you are trying to to claim it in a different merchant
No merchant with given id404falseIf merchantId was specified but it doesnt exist
Telebirr Error: "some error message from telebirr why the claim failed"404false