forked from wayforpay/php-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreturnUrl.php
36 lines (31 loc) · 1.07 KB
/
returnUrl.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
<?php
/*
* This file is part of the WayForPay project.
*
* @link https://github.com/wayforpay/php-sdk
*
* @author Vladislav Lyshenko <[email protected]>
* @copyright Copyright 2019 WayForPay
* @license https://opensource.org/licenses/MIT
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once __DIR__ . '/../vendor/autoload.php';
use WayForPay\SDK\Credential\AccountSecretTestCredential;
use WayForPay\SDK\Exception\WayForPaySDKException;
use WayForPay\SDK\Handler\ServiceUrlHandler;
// Use test credential or yours
$credential = new AccountSecretTestCredential();
//$credential = new AccountSecretCredential('account', 'secret');
try {
$handler = new ServiceUrlHandler($credential);
$response = $handler->parseRequestFromGlobals();
if ($response->getReason()->isOK()) {
echo "Success";
} else {
echo "Error: " . $response->getReason()->getMessage();
}
} catch (WayForPaySDKException $e) {
echo "WayForPay SDK exception: " . $e->getMessage();
}