Developers
...
Developer Hub
Developer Tutorials

Handling a Transaction Tutorial

Handling a Transaction

This tutorial is for your client side.

This tutorial will guide you through how to invoke a transaction using the Web SDK, when the consumer presses the payment button on your web page.

It will also cover how to handle the various responses from the Web SDK depending on the result of the transaction. Ensure you have already watched the below tutorials:

Full Tutorial



We have created video chapters from the full tutorial, to help you easily re-watch different parts of the tutorial. We have included an overview and example code snippets for each section below:

When using the code snippets, ensure to replace any field values with your own values.



1. Intro




2. The Configuration Object

Defining the configuration object that will be passed onto the Web SDK when calling the Payment / PreAuth functions.


Configuration Object Example



3. Calling the Web SDK Transaction Function

Adding functionality when the payment button is clicked, the Web SDK transaction function is called.

The configuration object and payment session reference are passed as parameters. This function returns a promise with the transaction result.


Call the Web SDK Transaction Function



4. Testing the Transaction

Testing your implementation using the resources available in Testing Overview section in our developer documentation.




5. Handling the Response

Interpreting the various responses from the Web SDK and how these can be displayed to the consumer.

  • When the promise is resolved, it will return a receipt object containing information on the transaction

This does not mean the result of the transaction was successful.

  • When the promise is rejected, it will return an error object containing information on why the transaction failed.

This chapter also includes an overview of how to validate the result of the transaction, using server to server calls to our API (recommended).


Handle the Response



6. Other Web SDK Card Functions

Web SDK functions for alternative card transactions, which are especially useful if you have a card wallet.


Additional Web SDK Functions



7. Recap

Following the completion of this tutorial, when the payment button is pressed, a card transaction should be invoked.

The result of this transaction should be handled accordingly and displayed to the consumer.




Resources