【问题标题】:How to integrate eway payment gateway to a php website?如何将 eway 支付网关集成到 php 网站?
【发布时间】:2016-10-07 10:52:12
【问题描述】:

有人知道如何将eway支付网关集成到普通的php网站吗?

我已经连接,但是当我在此链接中编写代码时显示错误:https://www.eway.com.au/developers/sdk/php

它显示了下面给出的错误: 错误:eWAY 库在连接到 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>';
?>

我已经编写了如上所示的代码。

【问题讨论】:

标签: php


【解决方案1】:

我知道您现在已经对其进行了排序或放弃了 Lena,但请找到如下代码

$apiEndpoint = '\Eway\Rapid\Client::MODE_SANDBOX';

【讨论】:

    猜你喜欢
    • 2017-01-19
    • 2011-08-27
    • 2023-04-08
    • 1970-01-01
    • 2016-06-16
    • 2013-02-27
    • 2013-10-19
    • 1970-01-01
    • 2014-06-03
    相关资源
    最近更新 更多