I develop a paypal pro in magento.
my paypal code look below:
$api_username = 'sdk-three_api1.sdk.com';
$api_password = 'QFZCWN5HZM8VBG7Q';
$api_signature = 'A.d9eRKfd1yVkRrtmMfCFLTqa6M9AyodL0SJkhYztxUi8W9pCXF6.4NI';
$api_version = '57.0';
$api_endpoint = 'https://api-3t.sandbox.paypal.com/nvp';
$request_params = array
(
'METHOD' => 'DoDirectPayment',
'USER' => $api_username,
'PWD' => $api_password,
'SIGNATURE' => $api_signature,
'VERSION' => $api_version,
'PAYMENTACTION' => 'Sale',
'IPADDRESS' => $_SERVER['REMOTE_ADDR'],
'CREDITCARDTYPE' => $params['creditCardType'],
'ACCT' => $params['creditCardNumber'],
'EXPDATE' => $params['expDateMonth'].$params['expDateYear'],
'CVV2' => $params['cvv2Number'],
'FIRSTNAME' => 'Tester',
'LASTNAME' => 'Testerson',
'STREET' => '707 W. Bay Drive',
'CITY' => 'Largo',
'STATE' => 'FL',
'COUNTRYCODE' => 'US',
'ZIP' => '33770',
'AMT' => $plan_data['amount'],
'CURRENCYCODE' => 'USD',
'DESC' => 'Testing Payments Pro'
);
$nvp_string = '';
foreach($request_params as $var=>$val)
{
$nvp_string .= '&'.$var.'='.urlencode($val);
}
//var_dump($nvp_string); die;
$curl = curl_init();
curl_setopt($curl, CURLOPT_VERBOSE, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_URL, $api_endpoint);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $nvp_string);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSLVERSION, 3);
curl_setopt($curl, CURLOPT_SSL_CIPHER_LIST, 'SSLv3');
//curl_setopt($curl, CURLOPT_SSL_CIPHER_LIST, 'TLSv1');
$result = curl_exec($curl);
if (curl_errno($curl))
{
echo "CURL send a error during perform operation: ".curl_error($curl);
}
else
{
curl_close($curl);
}
// Parse the API response
$nvp_response_array = parse_str($result);
var_dump($result);
But i getting an error like
error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake
failure
And if i not added this two line
curl_setopt($curl, CURLOPT_SSLVERSION, 3);
curl_setopt($curl, CURLOPT_SSL_CIPHER_LIST, 'SSLv3');
then give me an error like
error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
Any help?
There was some updates to Sandbox recently, updates that will need to be applied on Live at a later time, this post will help you
Related
I am trying to retrieve information from an API. The API requires authentication in order to access it. I have the tried the following, but it says that the Authentication has failed. I already confirmed that the credentials are correct, so that is not the problem. Any suggestions?
$pro = '0000000000';
$userName = 'userName';
$password = 'password';
$userPass = $userName.':'.$password;
$host = 'https://wardtlctools.com/wardtrucking/webservices/imaging';
$post = array(
'User' => array(
'UserName' => $userName,
'Password' => $password
),
'Reference' => array(
'RefNo' => $pro,
'RefType' => 'WARDPRO',
'DelMethod' => 'Link',
'Documents' => array(
'DocType' => 'BL',
'DocType' => 'DR'
)
)
);
$ch = curl_init($host);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_USERPWD, $userPass);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$return = curl_exec($ch);
curl_close($ch);
print_r($return);
This is the documentation from the provider's website.
Hi I implement PayPal DoDirectPayment in my website, I want to required expire date And CVV but payment taking without those with this warning "This transaction was approved. However, the Card Security Code provided had too few, too many, or invalid character types but, as per your account option settings, was not required in the approval process"
I'm using PHP.
My Code is
$api_endpoint = 'https://api-3t.sandbox.paypal.com/nvp';
$request = array
(
'METHOD' => 'DoDirectPayment',
'USER' => 'sell3_api1.pay.com',
'PWD' => '75DQHCABLDFSDF',
'SIGNATURE' => 'AFcWxV21C7fd0asdasdCpasdsdAtxzafSFsaKZ3unSUBjX9r-',
'VERSION' => '55.0',
'PAYMENTACTION' => 'Sale',
'FIRSTNAME' => $current_user->user_login,
'LASTNAME' => '.',
'IPADDRESS' => $_SERVER['REMOTE_ADDR'],
'ACCT' => $acct,
'CREDITCARDTYPE'=>
'EXPDATE' => $month.$year,
'CVV2' => $cvv,
'AMT' => $amt,
'CURRENCYCODE' => 'USD',
);
$nvp_string = '';
foreach ($request as $key => $value) {
$nvp_string .= '&'.$key.'='.urlencode($value);
}
$curl = curl_init();
curl_setopt($curl, CURLOPT_VERBOSE, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_URL, $api_endpoint);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $nvp_string);
$result = curl_exec($curl);
curl_close($curl);
parse_str($result);
How can I solve It.
I'm using Paypal Express Checkout method for my shopping cart. the paypal payment is working correctly.
i used the correct TRANSACTIONID from my sandbox account after the transaction but the given code always returns the error Transaction id is invalid.
$request_params = array
(
'METHOD' => 'DoAuthorization',
'USER' => $api_username,
'PWD' => $api_password,
'VERSION' => $api_version,
'TRANSACTIONID'=>$payment['transaction_id'],
'AMT' => $order['sub_total'],
'CURRENCYCODE' => 'USD',
);
$nvp_string = '';
foreach ($request_params as $var => $val)
{
$nvp_string .= '&' . $var . '=' . urlencode($val);
}
$certFile = 'C:\xampp\htdocs\my_project\certificate\cert_key_pem.txt';
$curl = curl_init();
curl_setopt($curl, CURLOPT_VERBOSE, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
curl_setopt($curl, CURLOPT_URL, $api_endpoint);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSLCERT, $certFile);
curl_setopt($curl, CURLOPT_POSTFIELDS, $nvp_string
$result = curl_exec($curl);
curl_close($curl);
$result_array = $this->NVPToArray($result);
echo "<pre>"; print_r($result_array); die();
the array gives the value as below
Array
(
[TIMESTAMP] => 2015-08-10T07:45:36Z
[CORRELATIONID] => deb2f549572b0
[ACK] => Failure
[VERSION] => 85.0
[BUILD] => 000000
[L_ERRORCODE0] => 10609
[L_SHORTMESSAGE0] => Invalid transactionID.
[L_LONGMESSAGE0] => Transaction id is invalid.
[L_SEVERITYCODE0] => Error
)
if you have any idea about such type of errors on Paypal Express Checkout DoAuthorization then please help me. thanks
I did everything right, all seem legit, but i don't see any payments made by my dummy user to the merchant:
Is it something in my code:
creating plan:
$req = array(
'USER' => 'bennyrefaelov-facilitator_api1.gmail.com',
'PWD' => 'YWKQ3M3NXBTZQ78U',
'SIGNATURE' => 'AFcWxV21C7fd0v3bYYYRCpSSRl31AuVEFUpBu6N8yXkmFksuwwSiQOW8',
'VERSION' => '98.0',
'METHOD' => 'SetExpressCheckout',
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Mark',
'REQCONFIRMSHIPPING'=>'0',
'NOSHIPPING'=>'1',
'ALLOWNOTE'=>'0',
'SOLUTIONTYPE'=>'Sole',
'LANDINGPAGE'=>'Billing',
'BRANDNAME'=>'MisterSurvey',
'PAYMENTREQUEST_0_AMT'=>'100.00',
'MAXAMT' => '100.00',
'L_BILLINGAGREEMENTDESCRIPTION0' => 'Pay up',
'PAYMENTREQUEST_0_TAXAMT'=>'0',
'PAYMENTREQUEST_0_ITEMAMT'=>'100.00',
'L_BILLINGTYPE0' => 'RecurringPayments',
'PAYMENTREQUEST_0_DESC'=>'An awesome package',
'PAYMENTREQUEST_0_CUSTOM'=>'This is just for fun',
'PAYMENTREQUEST_0_CURRENCYCODE'=>'USD',
'L_PAYMENTREQUEST_0_NUMBER0'=>'itemid1',
'L_PAYMENTREQUEST_0_NAME0'=>'MyItem1',
'L_PAYMENTREQUEST_0_DESC0'=>'basic package',
'L_PAYMENTREQUEST_0_QTY0'=>'1',
'L_PAYMENTREQUEST_0_AMT0'=>'100.00',
'L_PAYMENTREQUEST_0_TAXAMT0'=>'0',
'RETURNURL'=>'http://mistersurveylocal.com:8080/#/pricing',
'CANCELURL'=>'http://mistersurveylocal.com:8080/#/'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api-3t.sandbox.paypal.com/nvp');
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($req));
$return = curl_exec($ch);
curl_close($ch);
excute plan (after user agrees)
$token = Input::get('token');
$payerId = Input::get('payerId');
$req = array(
'USER' => 'bennyrefaelov-facilitator_api1.gmail.com',
'PWD' => 'YWKQ3M3NXBTZQ78U',
'SIGNATURE' => 'AFcWxV21C7fd0v3bYYYRCpSSRl31AuVEFUpBu6N8yXkmFksuwwSiQOW8',
'VERSION' => '98.0',
'METHOD' => 'CreateRecurringPaymentsProfile',
'TOKEN'=>$token,
'payerid'=>$payerId,
'PROFILESTARTDATE' =>date('Y-m-d\TH:i:s\Z'),
'TOTALBILLINGCYCLES'=>'12',
'DESC'=>'Pay up',
'BILLINGPERIOD'=>'Month',
'BILLINGFREQUENCY'=>'1',
'AMT'=>'100',
'CURRENCYCODE'=>'USD',
'COUNTRYCODE'=>'US',
'MAXFAILEDPAYMENTS'=>'3'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api-3t.sandbox.paypal.com/nvp');
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($req));
$return = curl_exec($ch);
curl_close($ch);
return urldecode($return);
It says it's active, and verified, and the start date is at this moment, why there is no payment made?
is there something missing?
I had the exact same problem. As it turns out, it was an issue with the Sandbox being very slow. After 2 days of troubleshooting and debugging, all the transactions completed and I received all IPN messages related to them.
It's unfortunate, but the solution is simply to wait for them to process. Hopefully live will be much faster.
Currently using PHP + cURL to test the NVP SetExpressCheckout Paypal feature (sandbox mode) on xampp,
no matter what I do, I receive the following error:
Error Code 10002 : Authentication/Authorization Failed. You do not have permission to make this API call.
$nvp = array(
'METHOD' => 'SetExpressCheckout',
'VERSION' => '98',
'USER' => $user,
'PWD' => $pwd,
'SIGNATURE' => $signature,
'RETURNURL' => $returnurl,
'CANCELURL' => $cancelurl,
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
'PAYMENTREQUEST_0_AMT' => '20.00',
'PAYMENTREQUEST_0_CURRENCYCODE' => $currency,
'REQCONFIRMSHIPPING' => '0',
'NOSHIPPING' => '1',
'ALLOWNOTE' => '0',
'LOCALECODE' => 'US'
'L_PAYMENTREQUEST_0_NAME0' = 'A product name';
'L_PAYMENTREQUEST_0_AMT0' = '20.00';
'L_PAYMENTREQUEST_0_QTY0' = '1';
'L_PAYMENTREQUEST_0_ITEMCATEGORY0' = 'Digital';
);
$request = 'https://api-3t.sandbox.paypal.com/nvp?' . http_build_query($nvp);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $request);
curl_setopt($curl, CURLOPT_VERBOSE, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$response = urldecode(curl_exec($curl));
curl_close($curl);
The weird thing is if I type curl request(the same as $request variable) in the browser I get the SUCCESS and token from the endpoint,
I don't know if it has something to do with the curl itself or if it's something else, I tried to completely
disable my firewall but the error persists...
Your array is malformed.
'L_PAYMENTREQUEST_0_NAME0' = 'A product name';
That's a good way to start debugging