Tranzila payment gateway : Not Authorized error message in response - php

Trying to integrate tranzila payment gateway in my php project and testing with dummy credit card numbers on localhost before go live.I get php code from tranzila official document.
code given below
`
$tranzila_api_host = 'secure5.tranzila.com';
$tranzila_api_path = '/cgi-bin/tranzila71u.cgi';
// Prepare transaction parameters
$query_parameters['supplier'] = 'TERMINAL_NAME'; // 'TERMINAL_NAME' should be replaced by actual terminal name
$query_parameters['sum'] = '45'; // Transaction sum
$query_parameters['currency'] = '1'; // Type of currency 1 NIS, 2 USD, 978 EUR, 826 GBP, 392 JPY
$query_parameters['ccno'] = '12312312'; // Test card number
$query_parameters['expdate']= '0820'; // Card expiry date: mmyy
$query_parameters['myid'] = '12312312'; // ID number if required
$query_parameters['mycvv'] = '123'; // number if required
$query_parameters['cred_type'] = '1'; // This field specifies the type of transaction, 1 - normal transaction, 6 - credit, 8 - payments
// $query_parameters['TranzilaPW'] = 'TranzilaPW' ;
$query_string = '' ;
foreach($query_parameters as $name => $value) {
$query_string .= $name.'='.$value.'&' ;
}
$query_string = substr($query_string , 0 , - 1 ) ; // Remove trailing '&'
// Initiate CURL
$cr = curl_init();
curl_setopt($cr,CURLOPT_URL ,"https://$tranzila_api_host$tranzila_api_path");
curl_setopt($cr,CURLOPT_POST,1);
curl_setopt($cr,CURLOPT_FAILONERROR,true);
curl_setopt($cr,CURLOPT_POSTFIELDS,$query_string) ;
curl_setopt($cr,CURLOPT_RETURNTRANSFER,1);
curl_setopt($cr,CURLOPT_SSL_VERIFYPEER,0);
// Execute request
$result = curl_exec($cr);
$error = curl_error($cr);
if(!empty($error)){
die( $error );
}
curl_close ($cr);
// Preparing associative array with response data
$response_array = explode('&',$result);
$response_assoc = array();
if(count($response_array) > 1){
foreach($response_array as $value){
$tmp = explode('=',$value);
if (count($tmp) > 1 ){
$response_assoc [$tmp[0]] = $tmp[1];
}
}
}
// Analyze the result string
if(!isset($response_assoc['Response'])){
die($result."\n");
/**
* When there is no 'Response' parameter it either means
* that some pre-transaction error happened (like authentication
* problems), in which case the result string will be in HTML format,
* explaining the error, or the request was made for generate token only
* (in this case the response string will only contain 'TranzilaTK'
* parameter)
*/
}else if($response_assoc['Response'] !== '000'){
die($response_assoc['Response']."\n");
// Any other than '000' code means transaction failure
// (bad card, expiry, etc ..)
}else{
die("Success \n");
}
`
Here i replaced supplier with my original supplier name which i can't show here for security reasons.When run this code with actual supplier i got 'Not Authorized' error.

Related

PHP Bitwasp, signing a bitcoin-cash transaction

I try to sign test bitcoin-cash transaction, and then broadcast.
For bitwasp version 0.0.35.0, the code is:
$utxoOwnerPrivateKey = 'MyPrIvAtEKey';//public key is "16Dbmp13CqdLVwjXrd6amF48t7L8gYSGBj", note - the real private key is another
$utxo = '5e44cdab9cb4a4f1871f2137ab568bf9ef2760e52816971fbaf0198f19e28378';
$utxoAmount = 598558;
$reciverPublicKey = '1EjCxux1FcohsBNGzY9KdF59Dz7MYHQyPN';
$fee = 1000;
$addressCreator = new \Btccom\BitcoinCash\Address\AddressCreator();
$networkObject = \Btccom\BitcoinCash\Network\NetworkFactory::bitcoinCash();
$keyPairInput = \BitWasp\Bitcoin\Key\PrivateKeyFactory::fromWif($utxoOwnerPrivateKey, null, $networkObject);
$outpoint = new \BitWasp\Bitcoin\Transaction\OutPoint(\BitWasp\Buffertools\Buffer::hex($utxo, 32), 0);
$transaction = \BitWasp\Bitcoin\Transaction\TransactionFactory::build()
->spendOutPoint($outpoint)
->payToAddress($utxoAmount - $fee, $addressCreator->fromString($reciverPublicKey, $networkObject) )
->get();
echo "Unsigned transaction: " . $transaction->getHex() . '<BR><BR>';
$signScript = \BitWasp\Bitcoin\Script\ScriptFactory::scriptPubKey()->payToPubKeyHash($keyPairInput->getPublicKey()->getPubKeyHash());
$txOut = new \BitWasp\Bitcoin\Transaction\TransactionOutput($utxoAmount - $fee, $signScript);
$signer = new \BitWasp\Bitcoin\Transaction\Factory\Signer($transaction);
$signatureChecker = \Btccom\BitcoinCash\Transaction\Factory\Checker\CheckerCreator::fromEcAdapter( \BitWasp\Bitcoin\Bitcoin::getEcAdapter() ); // for version 0.0.35
$signer->setCheckerCreator( $signatureChecker ); // for version 0.0.35
$input = $signer->input(0, $txOut);
$signatureType = \Btccom\BitcoinCash\Transaction\SignatureHash\SigHash::ALL | \Btccom\BitcoinCash\Transaction\SignatureHash\SigHash::BITCOINCASH;
$input->sign($keyPairInput, $signatureType);
$signed = $signer->get();
echo "Witness serialized transaction: " . $signed->getHex() . '<BR><BR>';
echo "Base serialized transaction: " . $signed->getBaseSerialization()->getHex() . '<BR><BR>';
echo "Script validation result: " . ($input->verify() ? "yes\n" : "no\n"). '<BR><BR>';
die();
In this case I get the result:
Script validation result: no
Trying to broadcast the BCH transaction gives an error:
An error occured:
16: mandatory-script-verify-flag-failed (Signature must be zero for failed CHECK(MULTI)SIG operation). Code:-26
I think, it means, that signature is wrong. If we remove the flag $signatureType (keep this default), then Script validation result will be yes, but broadcasting will give an error:
16: mandatory-script-verify-flag-failed (Signature must use SIGHASH_FORKID). Code:-26
I think, it means - transaction signed as in bitcoin network, must to be signed by bitcoin-cash rules. Maybe I'm wrong. But bitcoin transaction signing is fine. Bitwasp has no manuals, how to sign a bitcoin-cash transactions, I have the same code for bitwasp v.0.0.34.2 (without addon "btccom/bitwasp-bitcoin-bch-addon", using $signer->redeemBitcoinCash(true); function) but it gives the same result.
It is interesting that in code of bitcoin-cash signer it takes the inner variable amount and include it in hash:
$hasher = new V1Hasher($this->transaction, $this->amount);
But for bitcoin bitwasp doesn't take the amount, presumably it takes an amount from the transaction.
Help me please to sign the transaction, bitwasp has only bitcoin examples, not bitcoin-cash. It is very difficult to find any informaion about php altcoins signing without third-party software. Regards.
This code to sign a bitcoin-cash transaction with PHP bitwasp v.0.0.35 library is works!
$unspendedTx = '49343e0a4ef29b819f87df1371c6f8eafa1f235074a27fb6aa5f4ab4c48e5c16';
$utxOutputIndex = 0;
$utxoPrivateKey = 'MyPrIvAtEKey';
$utxoAmount = 300000;
$reciverPublicKey = '1E8XaWNsCWyVaZaWTLh8uBdAZjLQqwWmzM';
$fee = 1000;
$networkObject = \Btccom\BitcoinCash\Network\NetworkFactory::bitcoinCash();
$outpoint = new \BitWasp\Bitcoin\Transaction\OutPoint(\BitWasp\Buffertools\Buffer::hex($unspendedTx, 32), $utxOutputIndex /* index of utxo in transaction, generated it */);
$destination = \BitWasp\Bitcoin\Script\ScriptFactory::scriptPubKey()->payToPubKeyHash( (new \Btccom\BitcoinCash\Address\AddressCreator())->fromString($reciverPublicKey)->getHash() );
$transaction = \BitWasp\Bitcoin\Transaction\TransactionFactory::build()
->spendOutPoint($outpoint)
->output($utxoAmount - $fee, $destination)
->get();
echo "Unsigned transaction: " . $transaction->getHex() . '<BR><BR>';
$keyPairInput = \BitWasp\Bitcoin\Key\PrivateKeyFactory::fromWif($utxoPrivateKey, null, $networkObject);
$txOut = new \BitWasp\Bitcoin\Transaction\TransactionOutput($utxoAmount, \BitWasp\Bitcoin\Script\ScriptFactory::scriptPubKey()->payToPubKeyHash( $keyPairInput->getPubKeyHash() ) );
$signer = new \BitWasp\Bitcoin\Transaction\Factory\Signer($transaction);
$signatureChecker = \Btccom\BitcoinCash\Transaction\Factory\Checker\CheckerCreator::fromEcAdapter( \BitWasp\Bitcoin\Bitcoin::getEcAdapter() ); // for version 0.0.35
$signer->setCheckerCreator( $signatureChecker ); // for version 0.0.35
$input = $signer->input(0, $txOut);
$signatureType = \Btccom\BitcoinCash\Transaction\SignatureHash\SigHash::ALL | \Btccom\BitcoinCash\Transaction\SignatureHash\SigHash::BITCOINCASH;
$input->sign($keyPairInput, $signatureType);
$signed = $signer->get();
echo "Transaction: " . $signed->getHex() . '<BR><BR>';
die();
I had broadcasted this PHP-generated test transaction, see link to tx. Problaly the problem was in
->payToAddress($utxoAmount - $fee, $addressCreator->fromString($reciverPublicKey, $networkObject) )
Maybe payToAddress has a bug, because "hand" script creation gives another transaction. Second:
$txOut = new \BitWasp\Bitcoin\Transaction\TransactionOutput($utxoAmount - $fee, $signScript);
We must to create tx input(previous output) without the fee.
Used libraries ( composer.json ):
{
"require" : {
"php" : ">=7.0",
"bitwasp/bitcoin": "0.0.35.0",
"btccom/bitwasp-bitcoin-bch-addon" : "0.0.2"
}
}
Hope, this will help for all altcoin api creators on PHP.

how to get list of all products amazon MWS

can you explain how to get all product list, while i submit requestReport (_GET_MERCHANT_LISTINGS_ALL_DATA_)
I got the following request:
<?xml version="1.0"?>
<RequestReportResponse xmlns="http://mws.amazonaws.com/doc/2009-01-01/">
<RequestReportResult>
<ReportRequestInfo>
<ReportType>_GET_MERCHANT_LISTINGS_ALL_DATA_</ReportType>
<ReportProcessingStatus>_SUBMITTED_</ReportProcessingStatus>
<EndDate>2016-11-02T12:12:30+00:00</EndDate>
<Scheduled>false</Scheduled>
<ReportRequestId>50148017107</ReportRequestId>
<SubmittedDate>2016-11-02T12:12:30+00:00</SubmittedDate>
<StartDate>2016-11-02T12:12:30+00:00</StartDate>
</ReportRequestInfo>
</RequestReportResult>
<ResponseMetadata>
<RequestId>05d33eb0-dbaf-42d0-88c1-794605d55980</RequestId>
</ResponseMetadata>
</RequestReportResponse>
Then how can i get the list of all products?
It's all spelled out right here: http://docs.developer.amazonservices.com/en_US/reports/index.html
Basically, you submit a request with a RequestReport operation, check the status of the request with GetReportRequestList. When complete, you'll get a GeneratedReportId, and you'll use that to call GetReportList and/or GetReport with the report id to get the report data.
Since you've already submitted a report request, use the ReportRequestId that you have received and call GetReportRequestList. http://docs.developer.amazonservices.com/en_US/reports/Reports_GetReportRequestList.html
That will tell you the status and let you know when it's done and well as giving you a GeneratedReportId
Since you're using PHP, download the SDK for PHP and most of the work is already done for you. https://developer.amazonservices.com/doc/bde/reports/v20090101/php.html/154-1105707-5344447
Example script: get your own products from amazon
Composer require: cpigroup/php-amazon-mws
This script does 3 steps:
request a report
(returns ReportRequestId)
list the report and get the report id
(returns ReportId)
(calling this until we find our requested report)
load the report
(and save ofc)
Its not pretty, but does the job.
And you can change it the way you need it.
/**
* How to at stack:
* https://stackoverflow.com/questions/40379883/how-to-get-list-of-all-products-amazon-mws
*
* Docu at amazon:
* https://docs.developer.amazonservices.com/en_US/reports/Reports_ReportType.html#ReportTypeCategories__ListingsReports
*
* We need to call the api (min) 3 times:
* 1. request a report (returns ReportRequestId)
* 2. list the report and get the report id (returns ReportId)
* (calling this until we find our requested report)
* 3. load the report (returns report data)
*/
// If got id already, then set here:
$reportRequestId = null;
$reportId = null;
// Set the report type to request.
#$reportType = '_GET_MERCHANT_LISTINGS_DATA_LITE_';
$reportType = '_GET_MERCHANT_LISTINGS_DATA_';
// This method sets the start and end times for the report request.
// If this parameter is set, the report will only contain data that was updated
// between the two times given.
// If these parameters are not set, the report will only contain the most recent data.
$reportTimeFrom = null;#'2015-01-01'; // null or string
$reportTimeTo = null;#'2021-08-28'; // null or string
// This method sets the list of marketplace IDs to be sent in the next request.
// If this parameter is set, the report will only contain data relevant to the marketplaces listed.
$marketPlaces = null; // null, string or array of strings
// $marketPlaces = [
// // 'A1PA6795UKMFR9', // amazon_de
// // 'A13V1IB3VIYZZH', // amazon_fr
// // 'A1F83G8C2ARO7P', // amazon_uk
// // 'A1RKKUPIHCS9HS', // amazon_es
// // 'APJ6JRA9NG5V4', // amazon_it
// ];
// For w/e reason we must provide a sales channel.
// But we get all (or the $marketPlaces restricted) products anyway.
// And - tested - amazon_de or _fr ... does not change the response.
// So this does not matter. Just leave it amazon_de.
$salesChannel = 'amazon_de';
// Set file name where to save the report.
$filenamePrefix = '';
if (is_string($marketPlaces)) {
$filenamePrefix = "{$marketPlaces}_";
} elseif (is_array($marketPlaces)) {
$filenamePrefix = implode('_', $marketPlaces) . '_';
}
$destinationFile = __DIR__ . "/{$filenamePrefix}products.csv";
// Set the path to the config file.
$configPath = 'config/amazon/amazon_config.php';
// =====================================================================
// 1. Report Request.
// =====================================================================
if ($reportRequestId === null and $reportId === null) {
echo "Got no report request id and no report id - do a new report request ....\r\n";
$api = new \AmazonReportRequest(
$salesChannel,
false, // mock param
null, // mock param
$configPath
);
$api->setThrottleStop();
$api->setReportType($reportType);
if ($reportTimeFrom !== null and $reportTimeTo !== null) {
$api->setTimeLimits($reportTimeFrom, $reportTimeTo);
}
$api->setShowSalesChannel(true);
if ($marketPlaces !== null) {
$api->setMarketplaces($marketPlaces);
}
$api->requestReport(); // Actual api call.
$response = $api->getResponse();
// Example response:
// [
// 'ReportRequestId' => '111111111111',
// 'ReportType' => '_GET_MERCHANT_LISTINGS_DATA_LITE_',
// 'StartDate' => '2021-08-27T17:17:52+00:00',
// 'EndDate' => '2021-08-27T17:17:52+00:00',
// 'Scheduled' => 'false',
// 'SubmittedDate' => '2021-08-27T17:17:52+00:00',
// 'ReportProcessingStatus' => '_SUBMITTED_',
// ];
if (!isset($response['ReportRequestId'])) {
echo "Missing report request response[ReportRequestId].\r\n";
exit(1);
}
$reportRequestId = $response['ReportRequestId'];
echo var_export($response, true) . PHP_EOL; // debug
echo "ReportRequestId: '{$reportRequestId}' --OK.\r\n";
echo "\r\n";
}
// =====================================================================
// 2. Report List.
// =====================================================================
if ($reportRequestId !== null and $reportId === null) {
echo "Got a report request id '{$reportRequestId}' (no report id) - list the report request ...\r\n";
$api = new \AmazonReportList(
$salesChannel,
false, // mock param
null, // mock param
$configPath
);
$api->setThrottleStop();
// Search for the exact report we requested above (by report request id and type).
$api->setRequestIds($reportRequestId);
$api->setReportTypes($reportType);
do {
$api->fetchReportList(); // Actual api call.
$list = $api->getList();
// Example list:
// [
// [
// 'ReportId' => '22222222222222222',
// 'ReportType' => '_GET_MERCHANT_LISTINGS_DATA_LITE_',
// 'ReportRequestId' => '111111111111',
// 'AvailableDate' => '2021-08-27T17:18:11+00:00',
// 'Acknowledged' => 'false',
// ],
// ];
// Search our report request in the list.
foreach ($list as $row) {
if (!isset($row['ReportRequestId'])) {
echo "Missing report list row[ReportRequestId].\r\n";
exit(1);
}
if ((string)$row['ReportRequestId']
=== (string)$reportRequestId
) {
// Found our report request.
// Get the report id.
if (!isset($row['ReportId'])) {
echo "Missing report list row[ReportId].\r\n";
exit(1);
}
$reportId = $row['ReportId'];
echo var_export($row, true) . PHP_EOL; // debug
break 2; // Break out of foreach AND do loop.
} else {
echo "Different report request '{$row['ReportRequestId']}' --SKIP.\r\n";
}
}
if ($reportId === null) {
$waitSec = 4;
echo "Could not find report with request id '{$reportRequestId}'. --RETRY in {$waitSec} sec.\r\n";
// See https://docs.developer.amazonservices.com/en_US/reports/Reports_RequestReport.html
// Throttling
// Maximum request quota Restore rate Hourly request quota
// 15 requests One request every minute 60 requests per hour
for ($i = 0; $i < $waitSec; $i++) {
echo ".";
sleep(1);
}
echo "\r\n";
}
} while ($reportId === null);
echo "ReportId: '{$reportId}' --OK.\r\n";
echo "\r\n";
}
// =====================================================================
// 3. Load Report by id.
// =====================================================================
if ($reportId !== null) {
echo "Load Report by id '{$reportId}' ...\r\n";
$api = new \AmazonReport(
$salesChannel,
null, // report id (optional)
false, // mock param
null, // mock param
$configPath
);
$api->setThrottleStop();
$api->setReportId($reportId);
$api->fetchReport(); // Actual api call.
$r = file_put_contents($destinationFile, $api->getRawReport());
if ($r === false) {
echo "Cannot save report to file '{$destinationFile}'.\r\n";
} else {
echo "Report saved to file '{$destinationFile}'.\r\n";
}
}
echo "Finished.\r\n";
Example output:
// Got no report request id and no report id - do a new report request ....
// array (
// 'ReportRequestId' => '111111111111',
// 'ReportType' => '_GET_MERCHANT_LISTINGS_DATA_',
// 'StartDate' => '2014-12-31T23:58:00+00:00',
// 'EndDate' => '2021-08-26T23:58:00+00:00',
// 'Scheduled' => 'false',
// 'SubmittedDate' => '2021-08-27T18:25:53+00:00',
// 'ReportProcessingStatus' => '_SUBMITTED_',
// )
// ReportRequestId: '111111111111' --OK.
//
// Got a report request id '111111111111' (no report id) - list the report request ...
// Could not find report with request id '111111111111'. --RETRY in 15 sec.
// ...............
// array (
// 'ReportId' => '22222222222222222',
// 'ReportType' => '_GET_MERCHANT_LISTINGS_DATA_',
// 'ReportRequestId' => '111111111111',
// 'AvailableDate' => '2021-08-27T18:26:07+00:00',
// 'Acknowledged' => 'false',
// )
// ReportId: '22222222222222222' --OK.
//
// Load Report by id '22222222222222222' ...
// Report saved to file 'tmp/_test.log'.
// Finished.
Have fun =)

Best approach to process batch API Request Lavel 5

EDIT : Already fixed the error Creating default object from empty value . My question now is just suggestions how to make this process better.
I am making a tool that sends batch API request to a certain URL. I am using https://github.com/stil/curl-easy for batch API request That API will validate the phone numbers I am sending and return a result. That API can support maximum 20 request per second, supposed I have 50,000 API request, what is the best and fastest way to process things?
The current process is, I query to my database for the number of records I have which is the number of phone numbers. Then I make a loop with the number of phone numbers. Inside a single iteration, I will query 13 records from the database then pass it to the queue and process it, when the processing is finished I will query again to the database and update the fields for the the phone number based on the API response. My problem is that I think I have a logic error on my loop when I run this the processing will stop for sometime and gives me:
Creating default object from empty value
I guess that is because of my loop here's my code.
public function getParallelApi()
{
$numItems = DB::connection('mysql')->select("SELECT COUNT(ID) AS cnt FROM phones WHERE status IS NULL");
for($y = 0; $y < $numItems[0]->cnt; $y++)
{
$queue = new \cURL\RequestsQueue;
// Set default options for all requests in queue
$queue->getDefaultOptions()
->set(CURLOPT_TIMEOUT, 5)
->set(CURLOPT_RETURNTRANSFER, true)
->set(CURLOPT_SSL_VERIFYPEER, false);
// This is the function that is called for every completed request
$queue->addListener('complete', function (\cURL\Event $event) {
$response = $event->response;
$json = $response->getContent(); // Returns content of response
$feed = json_decode($json, true);
$phone_number = $feed['msisdn'];
if(isset($phone_number))
{
$status = "";$remarks = "";$network = ""; $country = "";$country_prefix = "";
if(isset($feed['status']))
{
$status = $feed['status'];
}
if(isset($feed['network']))
{
$network = $feed['network'];
}
if(isset($feed['country']))
{
$country = $feed['country'];
}
if(isset($feed['country_prefix']))
{
$country_prefix = $feed['country_prefix'];
}
if(isset($feed['remark']))
{
$remarks = $feed['remark'];
}
$update = Phone::find($phone_number);
$update->network = $network;
$update->country = $country;
$update->country_prefix = $country_prefix;
$update->status = $status;
$update->remarks = $remarks;
$update->save();
}
});
// Get 13 records
$phone = DB::connection('mysql')->select("SELECT * FROM phones WHERE status IS NULL LIMIT 13");
foreach ($phone as $key => $value)
{
$request = new \cURL\Request($this->createCurlUrl($value->msisdn));
// var_dump($this->createCurlUrl($value->msisdn)); exit;
// Add request to queue
$queue->attach($request);
}
// Process the queue
while ($queue->socketPerform()) {
$queue->socketSelect();
}
sleep(2);
$y += 13; // Move to the next 13 records
}
Session::flash('alert-info', 'Data Updated Successfully!');
return Redirect::to('upload');
}
Since the maximum is 20 request per seconds I'm just doing it 13 request per second just to be sure I won't clog their server. I am adding sleep(2); to pause a bit so that I can make sure that the queue is fully processed before moving on.

php - PayPal Express Checkout Item name and number

Why isn't the item name and number not being submitted with the DoExpressCheckout?
Here is what I am sending:
// Single-item purchase
$nvps["METHOD"] = "SetExpressCheckout";
$nvps["RETURNURL"] = "http://www.domain.com/angelpaypal/test/success.php"; // server
$nvps["CANCELURL"] = "http://www.domain.com/angelpaypal/test/fail.php"; // server
$nvps["PAYMENTREQUEST_0_PAYMENTACTION"] = "Sale";
$nvps["PAYMENTREQUEST_0_NOTIFYURL"] = "http://www.domain.com/includes/ipn/paypal/config/ipn-listener.php";
$nvps["PAYMENTREQUEST_0_AMT"] = "$Price";
$nvps["PAYMENTREQUEST_0_CURRENCYCODE"] = "USD";
$nvps["PAYMENTREQUEST_0_ITEMAMT"] = "$Price";
$nvps["L_PAYMENTREQUEST_0_NAME0"] = "$Desc";
$nvps["L_PAYMENTREQUEST_0_NUMBER0"] = "$Item";
$nvps["L_PAYMENTREQUEST_0_AMT0"] = "$Price";
$nvps["L_PAYMENTREQUEST_0_QTY0"] = "1";
$nvps["L_PAYMENTREQUEST_0_ITEMCATEGORY0"] = "Digital"; // specific to Digital Goods
Below is the response:
TOKEN = EC-7RN61912TS2838617
SUCCESSPAGEREDIRECTREQUESTED = false
TIMESTAMP = 2014-03-07T19:16:39Z
CORRELATIONID = b65c4f8669542
ACK = Success
VERSION = 109.0
BUILD = 9917844
INSURANCEOPTIONSELECTED = false
SHIPPINGOPTIONISDEFAULT = false
PAYMENTINFO_0_TRANSACTIONID = 3PF8162359151561E
PAYMENTINFO_0_TRANSACTIONTYPE = expresscheckout
PAYMENTINFO_0_PAYMENTTYPE = instant
PAYMENTINFO_0_ORDERTIME = 2014-03-07T19:16:39Z
PAYMENTINFO_0_AMT = 5.00
PAYMENTINFO_0_FEEAMT = 0.45
PAYMENTINFO_0_TAXAMT = 0.00
PAYMENTINFO_0_CURRENCYCODE = USD
PAYMENTINFO_0_PAYMENTSTATUS = Completed
PAYMENTINFO_0_PENDINGREASON = None
PAYMENTINFO_0_REASONCODE = None
PAYMENTINFO_0_PROTECTIONELIGIBILITY = Ineligible
PAYMENTINFO_0_PROTECTIONELIGIBILITYTYPE = None
PAYMENTINFO_0_SECUREMERCHANTACCOUNTID = KEPBS3TF5VPSL
PAYMENTINFO_0_ERRORCODE = 0
PAYMENTINFO_0_ACK = Success
As yuo can see, I am specifying item name and number, although in the response above, I don't see these fields - I want to use them in the IPN (NOTIFYURL) I've added
What you've shown here is SetExpressCheckout. Setting the items here will only make them show up on the PayPal review page during checkout. It will not carry all the way through to the final transaction unless you include those same itemizes details in the DoExpressCheckoutPayment request.
DECP is the end all, be all. Whatever gets sent with that is what ends up in the final PayPal details.

DIBS recurring payment, no error message, not working at all

I am using the following code to work, but it is not working
require('DIBSFunctions.php');
//Define input variables (here simply static variables)
$Merchant = "123456";
$OrderID = "AHJ798123AH-BH";
$Currency = "208"; //DKK
$Amount = "30000"; //In smallest possible unit 30000 Øre = DKK 300
$CardNo = "5019100000000000"; //DIBS test Dankort values
$ExpMon = "06"; //DIBS test Dankort value
$ExpYear = "13"; //DIBS test Dankort value
$CVC = "684"; //DIBS test Dankort value
$MD5['K1'] = "~.(S96%u|(UV,~ifxTt.DAKSNb&SKAHD"; //K1 and K2 MUST be gathered through
$MD5['K2'] = "qJuH6vjXHLSDB*%¤&/hbnkjlBHGhjJKJ"; //ones DIBS admin-webinterface.
//Call function DIBSAuth to authorise payment
$RES = DIBSAuth($Merchant,$Amount,$Currency,$CardNo,$ExpMon,$ExpYear,$CVC,$OrderID,$MD5);
echo '<pre>';
print_r($RES);
//Check the response (the DIBS API returns the variable transact on success)
if ( $RES['transact'] != "" )
{
printf ("Authorisation successful! TransaktionID = %s",$RES['transact']);
//Call function DIBSCapt to capture payment
$RES2 = DIBSCapt($Merchant, $Amount, $RES['transact'], $OrderID);
if ( $RES2['status'] == "ACCEPTED" )
{
printf ("Transaction completed");
} else {
printf ("Capture failed!");
}
} else {
printf ("Authorisation failed");
}
This is the code output
Array
(
[reason] => 2
[status] => DECLINED
)
Authorisation failed
require('DIBSFunctions.php');
this file contains the username and password, I am providing it. e.g.
function http_post($host, $path, $data, $auth="") {
$auth['username'] = '123456';
$auth['password'] = '987656656';
//rest of the code
}
if someone wants to see the file 'DIBSFunctions.php' it can be downloadable from here http://tech.dibspayment.com/toolbox/downloads/dibs_php_functions/
i contact to the technical support and got the answer below:
The problem you are experiencing is due to the fact that you are trying to send us real card numbers (test or live). This form of integration requires a PCI certification of your systems.
Most customers use a so called hosted solution, where you use our payment windows. Please refer to tech.dibs.dk for documentation.

Categories