有谁知道如何将eway支付网关集成到一个普通的php网站?
我已经进行了验证,但在此链接中编写代码时显示错误:https://www.eway.com.au/developers/sdk/php
它显示如下所示的错误:错误: eWAY库在连接到快速时遇到问题
<?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>';
?>我已经编写了如上所示的代码。
发布于 2021-09-16 06:04:46
我知道你现在已经把它整理好了,或者放弃了Lena,但请找出如下代码
$apiEndpoint = '\Eway\Rapid\Client::MODE_SANDBOX';https://stackoverflow.com/questions/39915499
复制相似问题