问题
I have followed the document site https://eway.io/api-v3/
to integrate the Payment system into my PHP application. And I run the command composer require eway/eway-rapid-php
from terminal in the application. After that I load autoload.php
.
Now I want to send customer into eWay payment site for choose payment method(paypal, CC) as well as paypal/CC information. So that customer can feel that they are paying by eWay payment gateway. I have the following code into my controller method ::
$apiKey = '5XwiMIQ3EBkSlP5XwiMIQ3EBkSlP5XwiMIQ3EBkSlP...................';
$apiPassword = '12222......';
$apiEndpoint = \Eway\Rapid\Client::MODE_SANDBOX; // Use \Eway\Rapid\Client::MODE_PRODUCTION when you go live
$client = \Eway\Rapid::createClient($apiKey, $apiPassword, $apiEndpoint);
$transaction = [
'RedirectUrl' => 'http://www.eway.com.au',
'CancelUrl' => "http://www.eway.com.au",
'TransactionType' => \Eway\Rapid\Enum\TransactionType::PURCHASE,
'Payment' => [
'TotalAmount' => 1000,
]
];
$response = $client->createTransaction(\Eway\Rapid\Enum\ApiMethod::RESPONSIVE_SHARED, $transaction);
Its returning the "Error connecting to Rapid gateway"
| error code S9992
Also I followed the url https://github.com/eWAYPayment/eway-rapid-php
Do I miss anything ? Would you please help me out ? Thanks in Advanced.
回答1:
Most of the time a S9992
connection error is due to an incorrect CA bundle, which prevents SSL verification from working correctly. There are a number of questions with solutions already on SO, like this one.
You can confirm the issue by enabling logging in the eWAY PHP SDK, this gist has some examples.
回答2:
I have had the exact same Eway S9992 issue using XAMPP on Mac OSX. I managed to fix the issue by downloading the latest CA bundle from here:
https://curl.haxx.se/ca/cacert.pem
Saving it to my /Applications/XAMPP/etc/ folder then editing my XAMPP/etc/php.ini file and updating the path to the openssl.cafile:
openssl.cafile=/Applications/XAMPP/etc/cacert.pem
Restarted Apache and it worked a treat!
来源:https://stackoverflow.com/questions/36787341/how-do-integrate-eway-payment-system-in-php