Docs
Top Up

Top Up

Add data to existing eSIM profiles

Top Up eSIM

Add additional data to an existing eSIM profile.

Top Up Profile

Endpoint: POST /api/v1/open/esim/topup

Request Parameters

NameTypeRequiredDescriptionExample
transactionIdStringRequiredYour unique transaction IDtopup_123456
iccidStringRequiredTarget eSIM ICCID8901234567890123456
packageCodeStringRequiredTop-up package codeTH_TOPUP_1
priceIntegerOptionalPackage price * 10,00035000
amountIntegerOptionalTotal amount * 10,00035000

Example Request

curl --location --request POST 'https://your-api-domain.com/api/v1/open/esim/topup' \
--header 'RT-AccessCode: YOUR_ACCESS_CODE' \
--header 'RT-SecretKey: YOUR_SECRET_KEY' \
--header 'Content-Type: application/json' \
--data '{
    "transactionId": "topup_123456",
    "iccid": "8901234567890123456",
    "packageCode": "TH_TOPUP_1",
    "price": 35000,
    "amount": 35000
}'

Response Parameters

NameTypeDescription
successBooleantrue = succeeded, false = failed
errorCodeStringError code when failed
errorMsgStringError message
obj.orderNoStringTop-up order number
obj.statusStringTop-up status

Example Success Response

{
    "errorCode": null,
    "errorMsg": null,
    "success": true,
    "obj": {
        "orderNo": "TOP20240115123456",
        "transactionId": "topup_123456",
        "iccid": "8901234567890123456",
        "status": "SUCCESS",
        "addedVolume": 1073741824,
        "newExpiredTime": "2024-02-15 00:00:00"
    }
}

Finding Top-Up Packages

Before topping up, query available top-up packages for the ICCID:

curl --location --request POST 'https://your-api-domain.com/api/v1/open/package/list' \
--header 'RT-AccessCode: YOUR_ACCESS_CODE' \
--header 'RT-SecretKey: YOUR_SECRET_KEY' \
--header 'Content-Type: application/json' \
--data '{
    "type": "TOPUP",
    "iccid": "8901234567890123456"
}'

Or query by the original package code:

curl --location --request POST 'https://your-api-domain.com/api/v1/open/package/list' \
--header 'RT-AccessCode: YOUR_ACCESS_CODE' \
--header 'RT-SecretKey: YOUR_SECRET_KEY' \
--header 'Content-Type: application/json' \
--data '{
    "type": "TOPUP",
    "packageCode": "TH_1_7"
}'

Top-Up Compatibility

  • Country plans: Can be topped up with same country top-up packages
  • Regional plans: Can be topped up with same region top-up packages
  • Check supportTopUpType: 2 = Top-up supported, 1 = No top-up available
// Check if package supports top-up
const package = packageList.find(p => p.packageCode === 'TH_1_7');
if (package.supportTopUpType === 2) {
    // Top-up is available for this package
}

Error Handling

ICCID Not Found

{
    "errorCode": "310403",
    "errorMsg": "The ICCID does not exist in the order",
    "success": false,
    "obj": null
}

Top-Up Not Supported

{
    "errorCode": "310243",
    "errorMsg": "The package does not exist",
    "success": false,
    "obj": null
}

Insufficient Balance

{
    "errorCode": "200007",
    "errorMsg": "Insufficient account balance",
    "success": false,
    "obj": null
}

Best Practices

  1. Check compatibility first - Query available top-up packages before attempting
  2. Use unique transactionId - Prevents duplicate top-ups
  3. Verify current status - Only top-up active profiles
  4. Notify customers - Send confirmation after successful top-up