-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
`<?php
error_reporting(1);
require_once DIR.'/vendor/autoload.php';
require_once DIR.'/config.php';
//defined('APIKEY') or define('APIKEY', 'test');
//defined('APIPASS') or define('APIPASS', '123123');
try {
$apiKey = APIKEY;
$apiPassword = APIPASS;
$apiEndpoint = \Eway\Rapid\Client::MODE_SANDBOX; //string(7) "sandbox"
$client = \Eway\Rapid::createClient($apiKey, $apiPassword, $apiEndpoint);
$transaction = [
'Customer' => [
'CardDetails' => [
'Name' => 'Harry Smith',
'Number' => '4444333322221111',
'ExpiryMonth' => '12',
'ExpiryYear' => '25',
'CVN' => '123',
]
],
'Payment' => [
'TotalAmount' => 1000,
],
'TransactionType' => \Eway\Rapid\Enum\TransactionType::PURCHASE,
];
$response = $client->createTransaction(\Eway\Rapid\Enum\ApiMethod::DIRECT, $transaction);
if ($response->TransactionStatus) {
echo 'Payment successful!<br/>ID: ' . $response->TransactionID;
} else {
echo 'Payment Failed!<br/>Errors: ' . $response->Errors. '<hr/>';
}
} catch (Exception $ex) {
echo 'Exception: '.$ex->getMessage();
}`
Metadata
Metadata
Assignees
Labels
No labels