\beGateway\Settings::$gatewayBase = "https://" . \Bitrix\Main\Config\Option::get($module_id, "domain_gateway");
     \beGateway\Settings::$checkoutBase = "https://" . \Bitrix\Main\Config\Option::get($module_id, "domain_payment_page");
     if ($amount > 0) {
         if (strlen($refund) > 0) {
             $query = new \beGateway\Refund();
             $query->setReason(Loc::getMessage("DEVTM_BEGATEWAY_REASON_DESC"));
         } else {
             if (strlen($capture) > 0) {
                 $query = new \beGateway\Capture();
             } else {
                 if (strlen($void) > 0) {
                     $query = new \beGateway\Void();
                 }
             }
         }
         $query->setParentUid($parent_uid);
         $query->money->setCents($amount);
         $response = $query->submit()->getResponse();
         if (isset($response->errors)) {
             throw new Exception($response->message);
         }
         if (is_array($uids) && !empty($uids)) {
             $uids[$response->transaction->uid] = $response->transaction->type;
         }
         $fields = array("PS_STATUS_DESCRIPTION" => json_encode($uids));
         CSaleOrder::Update($ID, $fields);
     }
 }
 $result = array();
 $result["order_id"] = $order["ID"];
 $result["amount"] = array("price" => $order["PRICE"], "currecy" => $order["CURRENCY"]);
示例#2
0
$transaction->setTrackingId('my_custom_variable');
$transaction->card->setCardNumber('4200000000000000');
$transaction->card->setCardHolder('John Doe');
$transaction->card->setCardExpMonth(1);
$transaction->card->setCardExpYear(2030);
$transaction->card->setCardCvc('123');
$transaction->customer->setFirstName('John');
$transaction->customer->setLastName('Doe');
$transaction->customer->setCountry('LV');
$transaction->customer->setAddress('Demo str 12');
$transaction->customer->setCity('Riga');
$transaction->customer->setZip('LV-1082');
$transaction->customer->setIp('127.0.0.1');
$transaction->customer->setEmail('*****@*****.**');
$response = $transaction->submit();
print "Transaction message: " . $response->getMessage() . PHP_EOL;
print "Transaction status: " . $response->getStatus() . PHP_EOL;
if ($response->isSuccess()) {
    print "Transaction UID: " . $response->getUid() . PHP_EOL;
    print "Trying to Void transaction " . $response->getUid() . PHP_EOL;
    $void = new \beGateway\Void();
    $void->setParentUid($response->getUid());
    $void->money->setAmount($transaction->money->getAmount());
    $void_response = $void->submit();
    if ($void_response->isSuccess()) {
        print "Voided successfuly. Void transaction UID " . $void_response->getUid() . PHP_EOL;
    } else {
        print "Problem to void" . PHP_EOL;
        print "Void message: " . $void_response->getMessage() . PHP_EOL;
    }
}