http://www.humtumdesi.com/p/tests/payeezy_php_curl.php
Request JSON Payload :{"merchant_ref":"Astonishing-Sale","transaction_type":"authorize","method":"credit_card","amount":"1200","currency_code":"USD","credit_card":{"type":"visa","cardholder_name":"John Smith","card_number":"4788250000028291","exp_date":"1218","cvv":"123"}}
Authorization :
NWQ0ZjNmZjg1NDc0NmE3M2E3MTBlOWY5Y2ZjMWFlZGUyNjc5MmM5OWQ3ODdkYzBiMzZiODk1MjBiZjk1ZmRhZA==
Response is: Array JSON response is: {"correlation_id":"228.1463886786678","transaction_status":"approved","validation_status":"success","transaction_type":"authorize","transaction_id":"ET104730","transaction_tag":"83743766","method":"credit_card","amount":"1200","currency":"USD","cvv2":"M","token":{"token_type":"FDToken","token_data":{"value":"9147329026428291"}},"card":{"type":"visa","cardholder_name":"John Smith","card_number":"8291","exp_date":"1218"},"bank_resp_code":"100","bank_message":"Approved","gateway_resp_code":"00","gateway_message":"Transaction Normal"}
How i send "line_item" multiple products with price? Any example!
"level3": { " alt_tax_amount": "{number}", "alt_tax_id": "{string}", "discount_amount": "{number}", "duty_amount": "{number}", "freight_amount": "{number}", "ship_from_zip": "{string}", "ship_to_address": { "city": "{string}", "state": "{string}", "zip": "{string}", "country": "{string}", "email": "{string}", "name": "{string}", "phone": "{string}", "address_1": "{string}", "customer_number": "{string}" }, "line_items": [{ "description": "{string}", "quantity": "{string}", "commodity_code": "{string}", "discount_amount": "{number}", "discount_indicator": "{string}", "gross_net_indicator": "{string}", "line_item_total": "{number}", "product_code": "{string}", "tax_amount": "{number}", "tax_rate": "{number}", "tax_type": "{string}", "unit_cost": "{number}", "unit_of_measure": "{string}" }] }Thanks for your kind help.
Below this code where i send values for " level3", please give me an example.
$serviceURL = 'https://api-cert.payeezy.com/v1/transactions';
$apiKey = "rYUzmitpFkIUp9fEcLiuG9lLLTlbEVG8";
$apiSecret = "1469bcb4082add9952ab8b34e5a55b0dfd12f6fb3ab4ae87f924204212496846";
$token = "fdoa-375b611a61aecb5b4aa823ad5e922057375b611a61aecb5b";
$nonce = strval(hexdec(bin2hex(openssl_random_pseudo_bytes(4, $cstrong))));
$timestamp = strval(time()*1000); //time stamp in milli seconds
$payload = getPayload(setPrimaryTxPayload());
function processInput($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return strval($data);
}
function setPrimaryTxPayload(){
$card_holder_name = $card_number = $card_type = $card_cvv = $card_expiry = $currency_code = $merchant_ref="";
$card_holder_name = processInput("John Smith");
$card_number = processInput("4788250000028291");
$card_type = processInput("visa");
$card_cvv = processInput("123");
$card_expiry = processInput("1218");
$amount = processInput("1200");
$currency_code = processInput("USD");
$merchant_ref = processInput("Astonishing-Sale");
$primaryTxPayload = array(
"amount"=> $amount,
"card_number" => $card_number,
"card_type" => $card_type,
"card_holder_name" => $card_holder_name,
"card_cvv" => $card_cvv,
"card_expiry" => $card_expiry,
"merchant_ref" => $merchant_ref,
"currency_code" => $currency_code,
);
return $primaryTxPayload;
}
/**
* Payeezy
*
* Generate Payload
*/
function getPayload($args = array())
{
$args = array_merge(array(
"amount"=> "",
"card_number" => "",
"card_type" => "",
"card_holder_name" => "",
"card_cvv" => "",
"card_expiry" => "",
"merchant_ref" => "",
"currency_code" => "",
"transaction_tag" => "",
"split_shipment" => "",
"transaction_id" => "",
), $args);
$data = "";
$data = array(
'merchant_ref'=> $args['merchant_ref'],
'transaction_type'=> "authorize",
'method'=> 'credit_card',
'amount'=> $args['amount'],
'currency_code'=> strtoupper($args['currency_code']),
'credit_card'=> array(
'type'=> $args['card_type'],
'cardholder_name'=> $args['card_holder_name'],
'card_number'=> $args['card_number'],
'exp_date'=> $args['card_expiry'],
'cvv'=> $args['card_cvv'],
)
);
return json_encode($data, JSON_FORCE_OBJECT);
}
echo "<br><br> Request JSON Payload :" ;
echo $payload ;
echo "<br><br> Authorization :" ;
$data = $apiKey . $nonce . $timestamp . $token . $payload;
$hashAlgorithm = "sha256";
### Make sure the HMAC hash is in hex -->
$hmac = hash_hmac ( $hashAlgorithm , $data , $apiSecret, false );
### Authorization : base64 of hmac hash -->
$hmac_enc = base64_encode($hmac);
echo "<br><br> " ;
echo $hmac_enc;
echo "<br><br>" ;
$curl = curl_init('https://api-cert.payeezy.com/v1/transactions');
$headers = array(
'Content-Type: application/json',
'apikey:'.strval($apiKey),
'token:'.strval($token),
'Authorization:'.$hmac_enc,
'nonce:'.$nonce,
'timestamp:'.$timestamp,
);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $payload);
curl_setopt($curl, CURLOPT_VERBOSE, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$json_response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
$response = json_decode($json_response, true);
echo "<br><br> " ;
if ( $status != 201 ) {
die("Error: call to URL $serviceURL failed with status $status, response $json_response, curl_error " . curl_error($curl) . ", curl_errno " . curl_errno($curl));
}
curl_close($curl);
echo "Response is: ".$response."\n";
echo "JSON response is: ".$json_response."\n";
The code you have is just a hello world example of how to code to our APIs using PHP. You really should be using the code from our github repository - https://github.com/payeezy/payeezy_direct_API/tree/master/payeezy_php. It has more information on how to pass level 3 fields.
Thanks for help.
From your information we found that we can send line items using level3 section.
but we can't understand what will be the array structure when passing multiple line items.
Are there any separator to separate each line items from cart.
"level3": {
" alt_tax_amount": "{number}",
"alt_tax_id": "{string}",
"discount_amount": "{number}",
"duty_amount": "{number}",
"freight_amount": "{number}",
"ship_from_zip": "{string}",
"ship_to_address": {
"city": "{string}",
"state": "{string}",
"zip": "{string}",
"country": "{string}",
"email": "{string}",
"name": "{string}",
"phone": "{string}",
"address_1": "{string}",
"customer_number": "{string}"
},
"line_items": [{
"description": "{string}",
"quantity": "{string}",
"commodity_code": "{string}",
"discount_amount": "{number}",
"discount_indicator": "{string}",
"gross_net_indicator": "{string}",
"line_item_total": "{number}",
"product_code": "{string}",
"tax_amount": "{number}",
"tax_rate": "{number}",
"tax_type": "{string}",
"unit_cost": "{number}",
"unit_of_measure": "{string}"
}]
}
we are using php.
Please also help us regarding -
1. Address object for AVS Check- is it can be tested from sandbox mode.If yes then from where we can activated the options.
2. When a successful payment has been made in test/sandbox mode any email not firing from gateway side with payment details. does payeezy provide such facility?
Thanks in advance.
Rahul,
Within the line items object, you will need to comma separate each item.
1. Yes, you can test AVS in sandbox mode. Here is how -
AVS
In order to simulate an AVS response in the demo/test environment, you can set the first character of the address value to the desired AVS response code.
For example, setting the address value to "N123 Main St" for a transaction would simulate the AVS response code "N". If the transaction is processed under a terminal that has the "No match" AVS filter checked, the transaction will be declined due to failed AVS verification.
2. Payeezy does not send email notifications for API based transactions. However, you have the option to set up a webhook URL. We will POST to this URL whenever there is an event on your account.
How to check CVV/CVV2 response after payment via payeezy?
Are there any parameter in response array?
my response array looks like below -
Array ( [correlation_id] => 232.1467870564526 [transaction_status] => approved [validation_status] => success [transaction_type] => authorize [transaction_id] => 04724D [transaction_tag] => 1491575924 [method] => credit_card [amount] => 100 [currency] => USD [avs] => Y [token] => Array ( [token_type] => FDToken [token_data] => Array ( [value] => 0699687917248291 ) ) [card] => Array ( [type] => Visa [cardholder_name] => John Smith [card_number] => 8291 [exp_date] => 1216 ) [bank_resp_code] => 100 [bank_message] => Approved [gateway_resp_code] => 00 [gateway_message] => Transaction Normal )
Array ( [correlation_id] => 233.1467870262674 [transaction_status] => approved [validation_status] => success [transaction_type] => authorize [transaction_tag] => 1491567079 [method] => credit_card [amount] => 100 [currency] => USD [avs] => S [token] => Array ( [token_type] => FDToken [token_data] => Array ( [value] => 0699687917248291 ) ) [card] => Array ( [type] => Visa [cardholder_name] => John Smith [card_number] => 8291 [exp_date] => 1216 ) [bank_resp_code] => 591 [bank_message] => Invalid CC Number [gateway_resp_code] => 00 [gateway_message] => Transaction Normal )
From here which here parameters return the CVV/CVV2 response?
Please respond..
Thanks.
Rahul - Was CVV part of the request payload? If yes, you should see the field CVV2 in the response.