8 posts / 0 new
Last post
rahulvijaywargi...
payeezy direct API php curl

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!


rohitrajagopal3538
Re: payeezy direct API php curl

Level III

The following properties are used to populate additional information about the transaction, including shipping details and line item information.

  1. Visa
  2. Mastercard
    "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}"
    }]
    }
    
Property name Type Description
level3 (optional) object JSON object that holds the level3 transaction fields that would be required if this object is populated.
level3. alt_tax_amount(optional) string Total amount of alternate tax associated with this transaction.
level3. alt_tax_id(optional) string Tax ID number for the alternate tax associated with this transaction.
level3.discount_amount(optional) number Tax value included in total amount, only applicable to merchants passing level 2 (Corporate Credit Card - Level II) data. For Canadian merchants this field is the GST amount.
level3. duty_amount(optional) number Total charges for any import and/or export duties included in this transaction.
level3. freight_amount(optional) number Total freight or shipping and handling charges.
level3. ship_from_zip(optional) string The zip/postal code of the location from which the goods were shipped.
level3.ship_to_address(optional) object Shipping address associated with the transaction.
level3.ship_to_address.city (optional) string The City of the “ship to” location.
level3.ship_to_address.state (optional) string The State of the “ship to” location.
level3.ship_to_address.zip (optional) string The Zip/postal code of the “ship to” location.
level3.ship_to_address.country (optional) string The ISO-assigned code of the country to which the goods were shipped.
level3.ship_to_address.name (optional) string The Accountholder’s name associated with the transaction.
level3.ship_to_address.email (optional) string The Accountholder’s email address associated with the transaction.
level3.ship_to_address.phone (optional) string The Accountholder’s phone number associated with the transaction. Ex:AAAEEENNNNXXXX where: AAA = Area Code, EEE = Exchange, NNNN = Number, XXXX = Extension
level3.ship_to_address.address_1 (optional) string The Street Address of the “ship to” location.
level3.ship_to_address.customer_number(optional) string Purchase order or other number used by merchant’s customer to track the order.
level3. line_items(optional) array of object JSON object
level3.line_itemsdescription (optional) string Item description.
level3.line_itemsquantity (optional) string Number of units of the item purchased
level3.line_itemscommodity_code(optional) string The commodity code used to classify the item purchased. For a complete list of Commodity Codes "click here"
level3.line_itemsdiscount_amount(optional) number The discounted amount for the line item.
level3.line_itemsdiscount_indicator(optional) string Indicator for whether a discount is present on the item or not. 1 – Discounted0 – Not Discounted
level3.line_itemsgross_net_indicator(optional) string Indicates whether tax is included in the total amount or not.1 – Tax included0 – Tax Excluded
level3.line_itemsline_item_total(optional) number The amount of the item. Normally calculated as price multiplied by quantity.
level3.line_itemsproduct_code(optional) string The UPC product code for the line item.
level3.line_itemstax_amount (optional) number Tax amount in dollars and cents.
level3.line_itemstax_rate (optional) number Tax rate applied to the item
level3.line_itemstax_type (optional) string Type of tax being applied.
level3.line_itemsunit_cost (optional) number The per unit cost of the line item.
level3.line_itemsunit_of_measure(optional) string The unit of measure, or unit of measure code used for this item

rahulvijaywargi...
Re: payeezy direct API php curl

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


rohitrajagopal3538
Re: payeezy direct API php curl

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.


rahulvijaywargi...
Re: payeezy direct API php curl

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.


rohitrajagopal3538
Re: payeezy direct API php curl

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. 

 


rahulvijaywargi...
Re: payeezy direct API php curl

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.


rohitrajagopal3538
Re: payeezy direct API php curl

Rahul - Was CVV part of the request payload? If yes, you should see the field CVV2 in the response.