double CSaleUserAccount::Withdraw( int userID, double paySum, string payCurrency[, int orderID = 0] );
The method Withdraw withdraws the specified amount from the internal user account. If there is not enough money on the internal account, the method withdraws maximum available amount.
Parameter | Description |
---|---|
userID | The user ID. |
paySum | The amount to withdraw. |
payCurrency | The currency of the amount to withdraw. |
orderID | The order ID (if applicable). |
The method returns the amount actually withdrawn, or false otherwise.
The amount is withdrawn only from the account in currency passed in payCurrency. Other user accounts are not affected.
<? // Pay the order 21 in full or partially from the user's account $arOrder = CSaleOrder::GetByID(21); $withdrawSum = CSaleUserAccount::Withdraw( $arOrder["USER_ID"], $arOrder["PRICE"], $arOrder["CURRENCY"], $arOrder["ID"] ); if ($withdrawSum > 0) { $arFields = array( "SUM_PAID" => $withdrawSum, "USER_ID" => $arOrder["USER_ID"] ); CSaleOrder::Update($arOrder["ID"], $arFields); if ($withdrawSum == $arOrder["PRICE"]) CSaleOrder::PayOrder($arOrder["ID"], "Y", False, False); } ?>
© 2001-2005 Bitrix | Bitrix Site Manager - Content Management & Portal Solutions |