Skip to content

Confirm (e-Vouchers) ​

Purchase the voucher after successful check.

Endpoint: POST /transaction/confirm

Request ​

bash
curl -X POST https://API-ENDPOINT/transaction/confirm \
  -H "Content-Type: application/json" \
  -d '{
    "auth": {
      "id": 123,
      "key": 1706360400001,
      "hash": "b2c3d4e5f6a1..."
    },
    "external_transaction_id": "voucher-12345",
    "fields": {
      "amount": 100
    }
  }'
php
<?php
$url = 'https://API-ENDPOINT/transaction/confirm';
$key = time() * 1000;

$data = [
    'auth' => [
        'id' => 123,
        'key' => $key,
        'hash' => md5(123 . $token . $key)
    ],
    'external_transaction_id' => 'voucher-12345',
    'fields' => [
        'amount' => 100
    ]
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
javascript
const key = Date.now();
const hash = md5(`123${token}${key}`);

const response = await fetch('https://API-ENDPOINT/transaction/confirm', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    auth: { id: 123, key, hash },
    external_transaction_id: 'voucher-12345',
    fields: {
      amount: 100
    }
  })
});

const data = await response.json();
console.log(data);
python
import requests
import hashlib
import time

url = 'https://API-ENDPOINT/transaction/confirm'
key = int(time.time() * 1000)
hash_value = hashlib.md5(f"123{token}{key}".encode()).hexdigest()

response = requests.post(url, json={
    'auth': {
        'id': 123,
        'key': key,
        'hash': hash_value
    },
    'external_transaction_id': 'voucher-12345',
    'fields': {
        'amount': 100
    }
})

print(response.json())

Request Fields ​

FieldTypeRequiredDescription
external_transaction_idstringYes*Your transaction ID from check
transaction_idstringYes*Paynet transaction ID from check
fields.amountnumberYesVoucher amount

*Provide either external_transaction_id or transaction_id

Response ​

Success ​

json
{
  "transaction": {
    "id": "abc-123-def-456",
    "external_transaction_id": "voucher-12345",
    "state": 1,
    "time": "2024-01-27 12:00:05",
    "service": {
      "id": "slk100",
      "name": "Salik Recharge Card - AED 100"
    },
    "account": "[email protected]",
    "amount": 100,
    "amount_currency": "AED",
    "price": 100,
    "price_currency": "AED"
  },
  "info": {
    "reference": "1234567890",
    "number": "5678-1234-9012-3456",
    "serial": "SN123456789"
  },
  "receipt": {
    "header": "Salik",
    "subheader": "Recharge Card",
    "info": "Merchant: PAYNET",
    "instruction": "Enter the PIN at salik.ae or Salik app",
    "footer": "Customer Service: 800 72545"
  }
}

Pending ​

If the voucher is still being fetched:

json
{
  "transaction": {
    "id": "abc-123-def-456",
    "external_transaction_id": "voucher-12345",
    "state": 0,
    "time": "2024-01-27 12:00:05",
    "service": {
      "id": "slk100",
      "name": "Salik Recharge Card - AED 100"
    }
  }
}

Pending State

If state is 0, the info object will be empty. Call Find to get the PIN once the transaction completes.

Response Fields ​

FieldTypeDescription
transaction.stateintegerSee Transaction States
transaction.amountnumberVoucher face value
transaction.amount_currencystringVoucher currency
transaction.pricenumberAmount deducted from your wallet
transaction.price_currencystringYour wallet currency
transaction.errorstringError message if state = 2
infoobjectPIN data (see below)
receiptobjectReceipt information to display to customer

Next Step ​

If state is not final (0 or 6), call Find to get the PIN code. See Transaction States for all possible values.

Paynet API Documentation