0

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

It's 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?

vvvvv
  • 25,404
  • 19
  • 49
  • 81
S.Reza
  • 345
  • 4
  • 18
  • have you googled the error code? What did you find at https://github.com/eWAYPayment/eway-rapid-php? Is your api key right? Have you set up your details on the service and have you checked that you have the rights to connect? – weaveoftheride Apr 22 '16 at 07:18
  • @AndrewWelch : I googled the error but nothing found for myself. API is is right. I have set the service to get the service. How do I check the rights to connect ? – S.Reza Apr 22 '16 at 07:25

2 Answers2

0

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.

Community
  • 1
  • 1
John C
  • 8,223
  • 2
  • 36
  • 47
0

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!

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
  • I am using Apache instead of XAMPP. May I edit in php.ini file ? – S.Reza May 07 '16 at 13:29
  • Of course, the A in XAMPP stands for Apache, it's just one of the included applications - (Cross-Platform (X), Apache (A), MariaDB (M), PHP (P) and Perl (P)). Just hunt down the location of your php.ini and make the adjustment. – Benjamin Dry May 09 '16 at 00:22