Pay
Description and parameters
bool CSaleUserAccount::Pay( int userID, double paySum, string payCurrency[, int orderID = 0[, bool useCC = True]] );
Method deducts the specified amount from the internal user account. If funds are insufficient at the internal account, attempts to deduct additional funds from the user's card. Non-static method.
Call parameters
Parameter | Description |
---|---|
userID | User code. |
paySum | Deducted payable amount. |
payCurrency | Amount payable currency. |
orderID | Order code, if deducted money is associated with the order. |
useCC | If true, the system attempts to deduct money from the user's card if money is insufficient at the internal account. In case of false, the user card is not activated. |
Returned values
Method returns true on successfully deducted money from the user's internal account and false if specified amount cannot be deducted.
Note: money are deducted only from the account with the same currency passed by parameter into method. User accounts with other currencies are not affected.
Examples
<? // Deduct 3 US dollars from the current user USD account as payment for the order No. 21 $bSuccessPayment = CSaleUserAccount::Pay( $USER->GetID(), 3, "USD", 21, False ); if ($bSuccessPayment) echo "Payment amount deducted successfully"; ?>
© «Bitrix24», 2001-2024