getAmountRemainingforCheckout

Learn how to get the remaining amount available for checkout.

Use this global method to get the remaining customer credit amount that the shopper can contribute to the checkout.

Sending a request

This method accepts parameters in JSON string format. You need to pass the cartId with this method.

Request body example
"{
    "cartId":CartId
}"

Receiving a response

You'll see the following parameters in the response.

Response body example
{
   "isSuccess":{{Boolean_Value}},
   "amountRemainingToBeContributed":{{Remaining_Amount_To_Be_Contributed}},
   "currencyCode": {{Currency_Code}},
   "errorMessage": {{Error_Message}} // In case of error
}

Calling the global method from a custom component

Import the getAmountRemainingforCheckout method into your custom component javascript file with digialriverv3 as the namespace as shown below.

Import example
import getRemainingAmount from 
"@salesforce/apex/digitalriverv3.DRB2B_CustomerCreditService.getAmountRemainingforCheckout";

Call the global method from a custom JavaScript file by passing the cartId as shown below.

getRemainingAmount(){
        let input = {
            cartId:this.recordId
        };
        getRemainingAmount({inputData:JSON.stringify(input)})
        .then((data)=>{
         // implement logic here in case of success
        })
        .catch((error)=>{
         // implement logic here in case of error
        })
    }

Last updated