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.

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.

  // ...other required properties
  onChargeUpdated: charge => {
    switch (charge.statusCode) {
      case 200:
        // Processing
      case 300:
        // Success
      case 400:
        // Failed

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.

Code Name Description
100 Pending The charge was created and is awaiting a payment
200 Processing A payment was detected and is waiting for confirmations
300 Success The payment was processed correctly
310 Overpaid The amount received was higher than expected
400 Failure Something went wrong with the payment and couldn't be processed
405 Underpaid The charge expired and the amount received was less than expected
410 Timeout The charge expired and no payments were made
420 Late A payment for the full amount was made after the charge expired

results matching ""

    No results matching ""