Website Paypal Connection with Php - paypal

Im trying to connect my website with paypal and i have the index page where i am getting the order price,
the order name and then i refer them to the process.php using get for processing.Howevever,on running the process.php file i am getting this error
Error : Security header is not valid
Array
(
[TIMESTAMP] => 2014%2d10%2d07T17%3a22%3a00Z
[CORRELATIONID] => 37359d983e7a
[ACK] => Failure
[VERSION] => 109%2e0
[BUILD] => 13243702
[L_ERRORCODE0] => 10002
[L_SHORTMESSAGE0] => Security%20error
[L_LONGMESSAGE0] => Security%20header%20is%20not%20valid
[L_SEVERITYCODE0] => Error
)
How can i solve this error.Please Assist

This error comes in when :
You are using the wrong credentials ( make sure you have not copied any white spaces in apiusername. password and the signature .
You are using the wrong endpoints . Meaning you are using test credentials in live mode or vice versa .

Related

Php PEAR and outlook.office365.com imap

I am trying to connect to outlook application of office365 using the php PEAR framework. Below are the details of imap
IMAP Host: outlook.office365.com
IMAP Port: 993
Encryption: SSL
IMAP Username: (my Office365 username)
IMAP Password: (my Office365 password)
But i am unable to establish connection to it. Firewall for the port 993 is already opened from the server i am trying. Can someone help me where i am going wrong.
Error:
(
[0] => Array
(
[code] => 1
[params] =>
[package] => Mail_IMAPv2
[level] => error
[time] => 1543397738.02
[context] => Array
(
[file] => /app/lib/PEAR/Mail/IMAPv2.php
[line] => 713
[function] => connect
[class] => Mail_IMAPv2
)
[message] => Unable to build a connection to the specified mail server.
)
)
Our old Imap connection looks like this
imap://{$user}:{$pass}#hostname:port/{$Folder}#notls
We have replaced this format using php inbuilt function
imap_open("{hostname:port/imap/ssl/novalidate-cert/authuser=$user/user=$user}", $user ,$pass);
It is working for us now.

Uber API issue : Getting error while using this code. SSL certificate self signed certificate in certificate chain

I am new to Uber API, I just started exploring the Uber API's.
I have downloaded the complete Uber API repository from https://github.com/stevenmaguire/uber-php/issues/17
I have downloaded the complete repository using the composer. It shows that all dependencies were downloaded successfully. but when I am using the API, I am getting this error
Blockquote"SSL certificate problem: self signed certificate in certificate chain"
Please help me in this, I have raised this issue 8 days back on the Github no one is replied.
Here is my code
Thanks in Advance.
Rakesh
Here is my code`
<?php
require __DIR__ . '/vendor/autoload.php';
$client = new Stevenmaguire\Uber\Client(array(
'access_token' => '********',
'server_token' => '********',
'use_sandbox' => false, // optional, default false
'version' => 'v1.2', // optional, default 'v1.2'
'locale' => 'en_US', // optional, default 'en_US'
));
$products = $client->getProducts(array(
'latitude' => '41.85582993',
'longitude' => '-87.62730337'
));
var_dump($products);
?>
`

PayPal Rest API Curl SSL : unable to get local issuer certificate

I am working on PayPal Express checkout restapi service.
I complated successfully at sandbox mode but when trying go online curl returns "unable to get local issuer certificate" error. At sandbox i dont get this error.
What i tried!
I tried bind cert file (Latest one from mozilla) in php.ini and curl parameter but nothing change.
Currently my code like this
//Building our NVP string
$request = http_build_query($requestParams + $params);
//cURL settings
$curlOptions = array (
CURLOPT_URL => https://api-3t.paypal.com/nvp,
CURLOPT_VERBOSE => 1,
CURLOPT_SSL_VERIFYPEER => 1,
CURLOPT_SSL_VERIFYHOST => 2,
CURLOPT_CAINFO =>'certs/cacert.pem', //CA cert file
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => $request
);
$ch = curl_init();
curl_setopt_array($ch,$curlOptions);
Where i am failing ?
Note: I already got API Signature for LIVE from
https://www.paypal.com/us/cgi-bin/webscr?cmd=_get-api-signature
I fixed problem.
Mozilla's certs is failing on live edition.
When i used Facebook's cert it fixed.

ERRORCODE0: 10501 while connecting to paypal do direct

How does one resolve the following error when trying to connect to the paypal sandbox account
[TIMESTAMP] => 2013-05-03T15:13:47Z
[CORRELATIONID] => c51f05505c8b5
[ACK] => Failure
[VERSION] => 76.0
[BUILD] => 5715372
[L_ERRORCODE0] => 10501
[L_SHORTMESSAGE0] => Invalid Configuration
[L_LONGMESSAGE0] => This transaction cannot be processed due to an invalid merchant configuration.
[L_SEVERITYCODE0] => Error
[AMT] => 200.00
[CURRENCYCODE] => USD
As far as I can tell from reading all the other issues here, the only possible solution is to post on stackoverflow and wait for someone to magically fix it for you.
The 10501 error happens when you are trying to use an API call that you do not have permission on.
If you are using the facilitator account in the sandbox, it probably doesn't have the PayPal API access enabled on it.
Make a different business sandbox account, and use the API credentials generated from that account, and you should be good to go.

Paypal Sandbox Test Tool IPN Simulator in Localhost

How to use Instant Payment Notification Simulator in local machine? What will be provided in IPN handler URL? I don't have access to our router.
Thanks
You can test on localhost using ngrok.
Simply run ngrok locally then paste test url that ngrok gives you (something like http://1bc7d09d.ngrok.com/)
It provides a tunnel to your localhost.
Paypal's IPN simulator will not work with localhost. However, you can simulate the simulator :-). To do this you need to install a browser plugin/extension such as poster for firefox or Advanced Rest Client for google chrome.
Open the app and put in your url you are listening on for IPN responses:
http://localhost/ipn
Put the following as your POST data and submit the request:
residence_country=US&invoice=abc1234&address_city=San+Jose&first_name=John&payer_id=TESTBUYERID01&mc_fee=0.44&txn_id=421462822&receiver_email=seller%40paypalsandbox.com&custom=xyz123+CUSTOMHASH&payment_date=12%3A40%3A25+27+Aug+2013+PDT&address_country_code=US&address_zip=95131&item_name1=something&mc_handling=2.06&mc_handling1=1.67&tax=2.02&address_name=John+Smith&last_name=Smith&receiver_id=seller%40paypalsandbox.com&verify_sign=AFcWxV21C7fd0v3bYYYRCpSSRl31AgAAjEU7A5rthY2aP4j1jOIrjuGx&address_country=United+States&payment_status=Completed&address_status=confirmed&business=seller%40paypalsandbox.com&payer_email=buyer%40paypalsandbox.com&notify_version=2.4&txn_type=cart&test_ipn=1&payer_status=unverified&mc_currency=USD&mc_gross=12.34&mc_shipping=3.02&mc_shipping1=1.02&item_number1=AK-1234&address_state=CA&mc_gross1=9.34&payment_type=instant&address_street=123%2C+any+street
UPDATE: I just started using another option that is easier, https://localtunnel.me. To install and run the module do the following. It will show your public URL. All requests to that public URL will be forwarded to your localhost.
npm install -g localtunnel
lt --port 80
You cannot test IPN on your localhost, as IPN is all about PayPal's server initiating a server-side POST to a URL you define.
As a result, your IPN script must be accessible by the outside world (or you can use a tunnel such as ngrok.me/localtunnel.me).
You can simulate PayPal's IPN post by running the script below I made on your localhost (you'll need curl installed). As long as your listener is pointed to the sandbox it should validate. Change your listener to the live paypal and it should fail to validate.
<?php
// SIMULATE PAYPAL IPN LOCALLY
//
// Sometimes you need to test on your local host and this can be difficult due
// to IP routing issues. Use this code on your local machine to simulate the
// same process that the sandbox IPN simulator does when posting to your URL.
//
// Run this code in command line or via the browser. It will post IPN data just
// like Paypal would. If the code you've written to process your IPN data
// posts back to the sandbox, it should come back as valid.
// Put the full url to test in $paypal_url, include file extensions if necessary
$paypal_url = 'http://localhost/paypal_ipn/process'; // IPN listener to test
//example posted data from paypal IPN
$test = 'residence_country=US&invoice=abc1234&address_city=San+Jose&first_name=John&payer_id=TESTBUYERID01&mc_fee=0.44&txn_id=421462822&receiver_email=seller%40paypalsandbox.com&custom=xyz123+CUSTOMHASH&payment_date=12%3A40%3A25+27+Aug+2013+PDT&address_country_code=US&address_zip=95131&item_name1=something&mc_handling=2.06&mc_handling1=1.67&tax=2.02&address_name=John+Smith&last_name=Smith&receiver_id=seller%40paypalsandbox.com&verify_sign=AFcWxV21C7fd0v3bYYYRCpSSRl31AgAAjEU7A5rthY2aP4j1jOIrjuGx&address_country=United+States&payment_status=Completed&address_status=confirmed&business=seller%40paypalsandbox.com&payer_email=buyer%40paypalsandbox.com&notify_version=2.4&txn_type=cart&test_ipn=1&payer_status=unverified&mc_currency=USD&mc_gross=12.34&mc_shipping=3.02&mc_shipping1=1.02&item_number1=AK-1234&address_state=CA&mc_gross1=9.34&payment_type=instant&address_street=123%2C+any+street';
/*
* More detailed breakout of the raw data
_POST EXAMPLE ARRAY FROM PAYPAL:
Array
(
[residence_country] => US
[invoice] => abc1234
[address_city] => San Jose
[first_name] => John
[payer_id] => TESTBUYERID01
[mc_fee] => 0.44
[txn_id] => 421462822
[receiver_email] => seller#paypalsandbox.com
[custom] => xyz123 CUSTOMHASH
[payment_date] => 12:40:25 27 Aug 2013 PDT
[address_country_code] => US
[address_zip] => 95131
[item_name1] => something
[mc_handling] => 2.06
[mc_handling1] => 1.67
[tax] => 2.02
[address_name] => John Smith
[last_name] => Smith
[receiver_id] => seller#paypalsandbox.com
[verify_sign] => AFcWxV21C7fd0v3bYYYRCpSSRl31AgAAjEU7A5rthY2aP4j1jOIrjuGx
[address_country] => United States
[payment_status] => Completed
[address_status] => confirmed
[business] => seller#paypalsandbox.com
[payer_email] => buyer#paypalsandbox.com
[notify_version] => 2.4
[txn_type] => cart
[test_ipn] => 1
[payer_status] => unverified
[mc_currency] => USD
[mc_gross] => 12.34
[mc_shipping] => 3.02
[mc_shipping1] => 1.02
[item_number1] => AK-1234
[address_state] => CA
[mc_gross1] => 9.34
[payment_type] => instant
[address_street] => 123, any street
)
*/
//#
// PayPal IPN processor in PHP
// fake paypal post to test scripts
//#
//----------------------------------------------------------
// Create FAKE post from PayPal.
//----------------------------------------------------------
$req = $test; // use test data
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $paypal_url);
curl_setopt($ch,CURLOPT_POST, substr_count($req,'&')+1);
curl_setopt($ch,CURLOPT_POSTFIELDS, $req);
//execute post
$result = curl_exec($ch);
//close connection
curl_close($ch);
?>
I do test on localhost. You can use a service like dyn.com or noip.com or point a subdomain to your local address if it's static.
/ngrok http -host-header=yourwebsite.com 80
will tunnel to localhost with the right host header