Bitrix Site Manager

CSaleUserAccount::Pay

bool
CSaleUserAccount::Pay(
 int userID,
 double paySum,
 string payCurrency[,
 int orderID = 0[,
 bool useCC = True]]
);

The method Pay withdraws the specified amount from the internal user account. If there is not enough money on the internal account, the method attempts to withdraw deficient amount from the user credit card.

Parameters

ParameterDescription
userID The user ID.
paySum The amount to withdraw.
payCurrency The currency of the amount to withdraw.
orderID The order ID (if applicable).
useCC If true, the method will attempt to withdraw deficient amount from the user credit card, if there is not enough money on the internal account. If false, the user credit card is not touched.

Return Values

The method returns true if the money has been withdrawn, or false if the specified amount could not be withdrawn.

Remarks

The amount is withdrawn only from the account in currency passed in payCurrency. Other user accounts are not affected.

Example



<?
// Withdraw 3 EUR from the Euro account, to pay order #21
$bSuccessPayment = CSaleUserAccount::Pay(
        $USER->GetID(),
        3,
        "EUR",
        21,
        False
    );
if ($bSuccessPayment)
    echo "Transaction succeeded";
?>