Anonymous wrote:
Full Code:
require DIR . ‘/vendor/autoload.php’;
// Your SBPay token
const SBPAY_TOKEN = ‘xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx’;
// Your SBPay secret
const SBPAY_SECRET = ‘xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx’;
// Your SBPay merchant
const SBPAY_MERCHANT = ‘oncallfysioterapi’;
// SBPay host
const SBPAY_HOST = ‘https://app.sbpay.me/api/’;
// Host for your demo page
const HOST = ‘https://demo-custom-processor.com/’;
// request will come from SBPay with payment details in $_POST.
// You need to validate the request and then process it.
$client = new \SBPay\SBPayClient(
SBPAY_TOKEN, SBPAY_SECRET,
SBPAY_MERCHANT, SBPAY_HOST
);
$order = $client->payments()->approveOrder(
1263, ‘custom’, ‘’,
‘’, ‘’, ‘custom’
);
print_r($order); exit;
print_r($order); exit;
try {
// Validate request that comes from SBPay
$client->payments()->validateCustomPaymentProcessorRequest($_POST);
} catch (\SBPay\Exceptions\Exception $e) {
// handle exception. Just show error message for demo purposes
die($e->getMessage());
}