1

Does anyone know how to integrate eway payment gateway to a normal php website ?

I have conected but it is showing the error when I am writing the code in this link :https://www.eway.com.au/developers/sdk/php

Its showing the error which is given below : Error: eWAY library has encountered a problem connecting to Rapid

<?php

     require_once 'lib/eway-rapid-php-master/include_eway.php';


    // eWAY Credentials
    $apiKey = 'F9802AS8MHb/rAm6UyRbT2d5eHjOZWhff++jtFOtMU';
  $apiPassword = 'V6E';
  $apiEndpoint = 'Sandbox';

  // Create the eWAY Client
  $client = \Eway\Rapid::createClient($apiKey, $apiPassword, $apiEndpoint);


 // Transaction details - these would usually come from the application
  $transaction = [
    'Customer' => [
    'FirstName' => 'John',
    'LastName' => 'Smith',
    'Street1' => 'Level 5',
    'Street2' => '369 Queen Street',
    'City' => 'Sydney',
    'State' => 'NSW',
    'PostalCode' => '2000',
    'Country' => 'au',
    'Email' => 'demo@example.org',
],
// These should be set to your actual website (on HTTPS of course)
'RedirectUrl' => "http://$_SERVER[HTTP_HOST]" . dirname($_SERVER['REQUEST_URI']) . '/response.php',
'CancelUrl' => "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]",
'TransactionType' => \Eway\Rapid\Enum\TransactionType::PURCHASE,
'Payment' => [
    'TotalAmount' => 1000,
]
];

// Submit data to eWAY to get a Shared Page URL
$response = $client->createTransaction(\Eway\Rapid\Enum\ApiMethod::RESPONSIVE_SHARED, $transaction);


// Check for any errors
if (!$response->getErrors()) {
     $sharedURL = $response->SharedPaymentUrl;
 } else {
foreach ($response->getErrors() as $error) {
    echo "Error: ".\Eway\Rapid::getMessage($error)."<br>";
}
die();
 }


 echo '<a href="'.$sharedURL.'">Pay with our secure payment page</a>';
?>

I have written the code as shown above.

lena
  • 143
  • 1
  • 13
  • Please check this link http://stackoverflow.com/questions/6028713/eway-payment-gateway – madankundu Oct 07 '16 at 11:05
  • this is good staring point.https://www.eway.com.au/developers/sdk/php but you need to check api details that you sent. I think this is the error – madankundu Oct 07 '16 at 11:07
  • the api details are correct.. – lena Oct 07 '16 at 11:34
  • Looks like you've encountered a connection issue. You can try enabling logging as described in [this Gist](https://gist.github.com/incarnate/bfddd8fc31281bacb8d4) to get the root error - [documented here](https://eway.io/api-v3/?php#sdk-response-codes). – John C Oct 10 '16 at 23:18

1 Answers1

0

I realize you've sorted it by now or given up Lena but please find code is like below

$apiEndpoint = '\Eway\Rapid\Client::MODE_SANDBOX';
Nensi Kasundra
  • 1,980
  • 6
  • 21
  • 34
Steven
  • 1
  • 1