Skip to content

Check (e-Vouchers)

Reserve a voucher for purchase.

Endpoint: POST /transaction/check

Request

bash
curl -X POST https://api.paynet.one/transaction/check \
  -H "Content-Type: application/json" \
  -d '{
    "auth": {
      "id": 123,
      "key": 1706360400000,
      "hash": "a1b2c3d4e5f6..."
    },
    "product": "slk100",
    "external_transaction_id": "voucher-12345",
    "fields": {
      "customer": "[email protected]",
      "account": "[email protected]",
      "amount": 100
    }
  }'
php
<?php
$url = 'https://api.paynet.one/transaction/check';
$key = time() * 1000;

$data = [
    'auth' => [
        'id' => 123,
        'key' => $key,
        'hash' => md5(123 . $token . $key)
    ],
    'product' => 'slk100',
    'external_transaction_id' => 'voucher-12345',
    'fields' => [
        'customer' => '[email protected]',
        'account' => '[email protected]',
        '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.paynet.one/transaction/check', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    auth: { id: 123, key, hash },
    product: 'slk100',
    external_transaction_id: 'voucher-12345',
    fields: {
      customer: '[email protected]',
      account: '[email protected]',
      amount: 100
    }
  })
});

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

url = 'https://api.paynet.one/transaction/check'
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
    },
    'product': 'slk100',
    'external_transaction_id': 'voucher-12345',
    'fields': {
        'customer': '[email protected]',
        'account': '[email protected]',
        'amount': 100
    }
})

print(response.json())

Request Fields

FieldTypeRequiredDescription
productstringYesService ID (e.g., slk100, itunes_aed_100)
external_transaction_idstringRecommendedYour unique transaction ID
fields.customerstringNoCustomer identifier (email or phone)
fields.accountstringNoSame as customer for vouchers
fields.amountnumberYesVoucher amount (must match product)
simulationbooleanNoSet true for test transactions

Fixed Amount Products

Most vouchers have fixed amounts (e.g., slk100 = 100 AED). The amount in your request must match the product's amount.

Response

json
{
  "transaction": {
    "id": "abc-123-def-456",
    "external_transaction_id": "voucher-12345",
    "state": -1,
    "time": "2024-01-27 12:00:00",
    "account": "[email protected]",
    "amount": 100,
    "amount_currency": "AED",
    "price": 100,
    "price_currency": "AED"
  }
}

Response Fields

FieldTypeDescription
transaction.idstringPaynet transaction ID
transaction.stateinteger-1 = reserved
transaction.amountnumberVoucher face value
transaction.pricenumberYour cost (with commission)

Next Step

Proceed to Confirm to purchase the voucher.

Paynet API Documentation