Non-Secure Payment

The Payment API is used to send order and credit card details to the Paybull payment integration system. The merchant's website should receive the payment status immediately without loading the payment page. Based on the API success status, the shopping cart and order status should be updated accordingly.

If the return from the Token API (is_3d) is 1, the merchant's website needs to display a checkbox for the user to choose between 2D or 3D.

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

HASH KEY CREATION

function generateHashKey($total, $installment, $currency_code, $merchant_key, $invoice_id, $app_secret)
{
    $data = $total . '|' . $installment . '|' . $currency_code . '|' . $merchant_key . '|' . $invoice_id;

    $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 CODE

payment_status = 1 Completed ,payment_status = 0 Failed

{
    "cc_holder_name":"John Dao",
    "cc_no":"5406675406675403",
    "expiry_month":"12",
    "expiry_year":"26",
    "cvv":"000",
    "currency_code":"TRY", 
    "installments_number": 1,
    "invoice_id":"1693558087",
    "invoice_description":" INVOICE TEST DESCRIPTION",
    "total":10,
    "merchant_key":"$2y$10$w/ODdbTmfubcbUCUq/ia3OoJFMUmkM1UVNBiIQIuLfUlPmaLUT1he",
    "items":[{"name":"Item3","price":10.00,"quantity":1,"description":"item3 description"}],
    "name" : "John",
    "surname" : "Dao",
    "hash_key" : "b8101ce330960fa7:8a81:YI9VbGOhKoFeEJ37Jha2XjXMs6Gq3750YoNlhze530mLhtbRZKjf3T__Ww0yD3PhAHv90PtyNG3RWXy__AIZyBzLqX8BBVAf4idqc1tPn98mAP5rcVPwqenMtSrDL8QE6t",
    "cancel_url" : "cancel_url",
    "return_url" : "return_url"
}