Skip to main content

onChargeUpdated callback

The onChargeUpdated callback, like its name suggests, is invoked when the charge changes. This means that this function will be called when a cryptocurrency transaction is created, or when a confirmation is detected, or when the charge expires, and so on.

caution

If you need to write some important logic around these events then you should use a Webhook instead because this function will not be invoked if the Checkout widget was dismissed.

charge argument

The callback's only argument is the charge object. You can use this to check what the charge's status is.

bidali.Checkout.render({
// ...other required properties
onChargeUpdated: charge => {
switch (charge.statusCode) {
case 200:
// Processing
break;
case 300:
// Success
break;
case 400:
// Failed
}
}
});
info

You can review the other required properties in the main Checkout section

Status Codes

Here's a list of the available status codes and what they mean.

CodeNameDescription
100PendingThe charge was created and is awaiting a payment
105UnderpaidA payment was detected, but it wasn't for the full amount
200ProcessingA payment was detected and is waiting for confirmations
300SuccessThe payment was processed correctly
310OverpaidThe amount received was higher than expected
320ResolvedAfter a manual review, this charge was manually processed as successful.
400FailureSomething went wrong with the payment and couldn't be processed
410TimeoutThe charge expired and no payments were made
415UnsettledA payment was received after the timeout and wasn't for the full amount.
417ReviewAmount received was higher than expected and require a manual review.
420LateA payment for the full amount was made after the charge expired
450RefundedThe payment was refunded
500ErrorA general error has occurred