[insert_php]
use OndraKoupil\Csob\Client, OndraKoupil\Csob\Config, OndraKoupil\Csob\Payment;
require_once(‘./wp-content/themes/bridge/vendor/autoload.php’);

$con­fig = new Config(
“M1E3CB3404”, // ID obchodníka
“./wp-content/themes/bridge/ca/production/rsa_M1E3CB3404.key”, // Sou­kro­mý klíč obchodu
“./wp-content/themes/bridge/ca/mips_platebnibrana.csob.cz.pub”, // Veřej­ný klíč banky
“downtownsuites.cz”, // Název obchodu
“http://www.downtownsuites.cz.uvirt64.active24.cz/thanks”, // Návra­to­vá adresa
“https://api.platebnibrana.csob.cz/api/v1.5” // API
);

if (!empty($_POST[“ninja_forms_field_85”])) {

$cli­ent = new Client($config);
try {
$client->testGetConnection();
$client->testPostConnection();
} catch (Excep­ti­on $e) {
die(“Something went wrong: ” . $e->getMessage());
} finally {

$pay­ment = new Payment(time());
$payment->currency = ‘EUR’;
$payment->language = ‘EN’;
$payment->addCartItem(“Transportation”, 1, $_POST[‘ninja_forms_field_85’] * 100);

$respon­se = $client->paymentInit($payment);

$pay­Id = $payment->getPayId();
$pay­Id = $response[“payId”];

wp_mail([‘t.velechovsky@staygroup.cz’, ‘info@www.downtownsuites.cz.uvirt64.active24.cz’], ‘Pay­ment form’,
“Infor­ma­ce o platbě:
Jmé­no: ” . $_POST[‘ninja_forms_field_72’] . ”
Tele­fon: ” . $_POST[‘ninja_forms_field_74’] . ”
Část­ka: ” . $_POST[‘ninja_forms_field_85’] . ”
”);

/*wp_mail(‘info@www.downtownsuites.cz.uvirt64.active24.cz’, ‘Pay­ment form’,
“Infor­ma­ce k Transportu:
Jmé­no: ” . $_POST[‘ninja_forms_field_72’] . ”
Tele­fon: ” . $_POST[‘ninja_forms_field_74’] . ”
Část­ka: ” . $_POST[‘ninja_forms_field_85’] . ”
”);*/

$url = $client->getPaymentProcessUrl($payId);
//$client->redirectToGateway($payment);
}
}

if (!empty($url) and !empty($_POST[“ninja_forms_field_85”])) {
echo “”;
}
[/insert_php]

Pay­ment form