forked from tomaj/omnipay-tatra
-
Notifications
You must be signed in to change notification settings - Fork 1
/
testserver.php
43 lines (29 loc) · 1.03 KB
/
testserver.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
use Omnipay\Omnipay;
require_once __DIR__ . '/vendor/autoload.php';
$gateway = Omnipay::create('TatraPay');
// $gateway = Omnipay::create('CardPay');
$gateway->setMid(1111);
// $gateway->setSharedSecret('11111111');
// $gateway->setSharedSecret('1111111111111111111111111111111111111111111111111111111111111111');
$gateway->setSharedSecret('11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111');
$gateway->setTestMode(true);
$response = $gateway->completePurchase([
'amount' => '10.00',
'currency' => 'EUR',
'VS' => '123456',
'CS' => '0321',
'rurl' => 'http://localhost:4444/testserver.php',
])->send();
if ($response->isSuccessful()) {
// Payment was successful
echo "OK - {$response->getVs()}";
} elseif ($response->isRedirect()) {
// Redirect to offsite payment gateway
echo($response->getRedirectUrl() . "\n");
//$response->redirect();
} else {
echo "FAIL!";
// Payment failed
echo $response->getMessage();
}