Pre-Auth / Post-Auth Payment

Pre-Authorization

To create a pre-authorization, you can send a request to the payment service with the transaction_type parameter set to PreAuth using 3D Secure. See: Payment with 3D Secure

Pre-Authorization & 3D Secure

The pre-authorization process with 3D Secure is applicable for normal 3D Secure flows as well. When the end user verifies with the received OTP code, the Pre Auth is completed as 3D Secure. The 3D Secure Pre Auth transaction needs to be completed first through the 3D Complete service, and then the pre-authorization closure service should be used.

Post-Authorization

For a successfully created pre-authorization payment, you can complete the payment using the confirmPayment service.

The HTTP method, endpoint, headers, and request details are provided below.

Method API Endpoint Content-Type
POST /api/confirmPayment application/json

HASH KEY GENERATION

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;
}

Sample Codes

{
  "merchant_key": "$2y$10$w/ODdbTmfubcbUCUq/ia3OoJFMUmkM1UVNBiIQIuLfUlPmaLUT1he",
  "invoice_id": "9a197ed9-cfaf-4456-b0fc-da74a95f461c",
  "status": 1,
  "hash_key": "36a50210c8b2f19e:11629:eHBA0moN...",
  "total": 100.44
}