Skip to content

Confirm (Direct Recharge)

Execute the transaction after successful check.

Endpoint: POST /transaction/confirm

Request

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

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

$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/confirm', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    auth: { id: 123, key, hash },
    external_transaction_id: 'order-12345',
    fields: {
      amount: 50
    }
  })
});

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

url = 'https://api.paynet.one/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': 'order-12345',
    'fields': {
        'amount': 50
    }
})

print(response.json())

Request Fields

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

*Provide either external_transaction_id or transaction_id

Response (Success)

json
{
  "transaction": {
    "id": "abc-123-def-456",
    "external_transaction_id": "order-12345",
    "state": 1,
    "time": "2024-01-27 12:00:05",
    "service": {
      "id": "et-mc",
      "name": "Etisalat Wasel Prepaid"
    },
    "account": "971550000000",
    "amount": 50,
    "amount_currency": "AED",
    "price": 50,
    "price_currency": "AED"
  },
  "receipt": {
    "header": "Etisalat",
    "subheader": "Wasel Prepaid",
    "info": "Merchant: PAYNET, Terminal ID: 123",
    "instruction": "",
    "promo": "",
    "footer": "Customer Service: 800 1234"
  }
}

Response (Pending)

If the transaction is still processing:

json
{
  "transaction": {
    "id": "abc-123-def-456",
    "external_transaction_id": "order-12345",
    "state": 0,
    "time": "2024-01-27 12:00:05",
    "service": {
      "id": "et-mc",
      "name": "Etisalat Wasel Prepaid"
    }
  }
}

Pending State

If state is 0 (pending) or 6 (pending by turnover), you must call Find until you receive a final state.

Response Fields

FieldTypeDescription
transaction.stateinteger1 = success, 0 = pending, 2 = failed
transaction.pricenumberAmount deducted from your wallet
transaction.amountnumberAmount credited to customer
transaction.errorstringError message if state = 2
receiptobjectReceipt information to display to customer

Next Step

If state is not final (0 or 6), proceed to Find to poll for the result.

Paynet API Documentation