In PreAuth Payment, a transaction is created as Pending in the system. To make this transaction Failed or Completed, this API should be called using request parameters given below.
Method | URL | Content-Type |
---|---|---|
POST | application/json |
Type | Params | Data Type | Condition |
---|---|---|---|
HEADER | Authorization | string | Mandatory |
HEADER | Accept | string | Mandatory |
KEY | invoice_id | string | Mandatory |
KEY | merchant_key | string | Mandatory |
KEY | status | string | Mandatory |
KEY | hash_key | string | Mandatory |
Authorization is a header key which defines verification that the connection attempt is allowed. The method should be “Bearer”
Bearer
eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6Im
RlMGVlZGFiZjdhZDhkODYzYTgyMzQ4Nzk5NTFkYzFlMDZkZ
TUxYjU0NWRjYmU3MzRjMmQ1OGNkMWFlOWE4YjliZTkyMjd
lZGVmZDdlMDliIn0.eyJhdWQiOiIxNSIsImp0aSI6ImRlMGVlZGF
iZjdhZDhkODYzYTgyMzQ4Nzk5NTFkYzFlMDZkZTUxYjU0NWR
jYmU3MzRjMmQ1OGNkMWFlOWE4YjliZTkyMjdlZGVmZDdlMD
liIiwiaWF0IjoxNTczNzUyNDcyLCJuYmYiOjE1NzM3NTI0NzIsImV
4cCI6MTYwNTM3NDg3Miwic3ViIjoiMSIsInNjb3BlcyI6W119.mDtd
zcv15p8SnYjZYJUJrhdskO5NohXbkcAxKWWZ72lNtrg86RZ1yxQwf
QlRu6IPoa1rfG3M4jfsNeH
Accept
Accept determines what type of representation is desired at client side. The value should be “application/json”
invoice_id
invoice_id is a unique order id sent by merchant
merchant_key
merchant_key is the unique key of the merchant provided by Paybull.
status
status can be 1 or 2 (1=approve, 2 = Cancel)
hash_key
hash_key is a unique key that should be generated using input value. The method for generating hash_key given below
function generateConfrimPaymentHashKey($merchant_key, $invoice_id, $status, $app_secret)
{
$data = $merchant_key . '|' . $invoice_id . '|' . $status;
$iv = substr(sha1(mt_rand()), 0, 16);
$password = sha1($app_secret);
$salt = substr(sha1(mt_rand()), 0, 4);
$saltWithPassword = hash('sha256', $password . $salt);
$encrypted = openssl_encrypt(
"$data", 'aes-256-cbc', "$saltWithPassword", null, $iv
);
$msg_encrypted_bundle = "$iv:$salt:$encrypted";
$msg_encrypted_bundle = str_replace('/', '__', $msg_encrypted_bundle);
return $msg_encrypted_bundle;
}
{
"status_code": 105,
"status_description": " The transaction is not Approved",
"transaction_status": "Pending",
"order_id": "162435924998223",
"invoice_id": "50781624359247
}
{
"status_code": 100,
"status_description": "An order has been taken place for this invoice id: 33491162435928”,
"transaction_status": "Completed",
"order_id": "162435932934307",
"invoice_id": "33491162435928"
}