Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test sample code fails ? #21

Open
sjnlabs2013 opened this issue May 10, 2021 · 3 comments
Open

test sample code fails ? #21

sjnlabs2013 opened this issue May 10, 2021 · 3 comments

Comments

@sjnlabs2013
Copy link

`<?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();
}`

@dpDesignz
Copy link

What's the error that you're getting? A lot more information will be required to troubleshoot your issue. Do be aware that to use Direct connection you also need to be PCI-DDS compliant.

You may also want to clean up you code sample. Try surrounding your code with code tags (3 back ticks ` followed by "PHP" at the beginning and end of your code) 😄

@sjnlabs2013
Copy link
Author

sjnlabs2013 commented May 11, 2021

no errors (browser)
no php error logs
no transactions in the portal

thanks for the tip

@dpDesignz
Copy link

no errors (browser)
no php error logs
no transactions in the portal

thanks for the tip

It might pay to put some echos in your code to see what line it is failing on. It may be further up the chain. Also, are you sure that your sandbox credentials are loaded? test and 123123 won't return you anything. It needs to be the details from your developer sandbox account.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants