eWAYPayment / eway-rapid-php

Eway Rapid PHP library
https://www.eway.com.au
MIT License
14 stars 24 forks source link

test sample code fails ? #21

Open sjnlabs2013 opened 3 years ago

sjnlabs2013 commented 3 years ago

`<?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 commented 3 years ago

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 commented 3 years ago

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

thanks for the tip

dpDesignz commented 3 years ago

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.