Complete Checkout

Getting Started | Initialise Deko Wallet | Show Finance Info | Start Checkout | Complete Checkout | Confirm Order | Test Data

7. Customer Completes Checkout

Upon successful checkout (using the selected finance product to complete a purchase), the checkout method resolves with a receipt object, whereas if the checkout is unsuccessful (the purchase using the selected finance product is rejected) then the method fails. To capture both the resolve and reject scenarios, please follow the example below.

const receipt = wallet.checkout(cac)
    .then((receipt) => {
      // SEE the decoded receipt JWT example in the next window 
      console.log(‘SUCCESS ====’, receipt);
      
      // This will happen only on a payment success
      return receipt;
    })
    .catch((e) => {
      console.log(‘FAILURE ====’, e.message);
      alert(`FAILURE - ${e.message}`);
      // This will happen when either the customer does not meet credit lending qualification or their deposit payment card has been declined
    });