Asynchronous


   To perform synchronous payment transactions, merchants must be PCI DSS compliant, as cardholder data is handled directly within the merchant's payment environment.

In an asynchronous workflow, the customer completes a payment verification step and is then redirected to the merchantRedirectUrl. The merchant can verify the final payment status using the TWPayz API.

The initial request must contain all the required information:

  • - authentication credentials
  • - mode, brand , type and amount of transaction
  • - merchantRedirectUrl

You can perform the following types of initial payments using our Asynchronous Workflow REST API.


Preauthorization (PA):

A Preauthorization (PA) transaction reserves funds without immediately capturing them. Send a POST request to /transactionServices/REST/v1/payments with paymentType=PA.

The authorized funds can be captured later using the TWPayz Backoffice APIs.

Debit (DB):

A Debit (DB) transaction authorizes and captures funds in a single step. Send a POST request to /transactionServices/REST/v1/payments with paymentType=DB.

Once authorized, the transaction is captured immediately.


In our API Specifications you can find a full list of parameters that can be sent in the initial request.


   Include a valid Authentication Token in the request header when calling TWPayz REST APIs. To generate an authentication token, refer to the Auth Token API documentation.

Workflow


1. Send an Initial Payment

After submitting the request to the TWPayz server, you will receive a response containing the transaction result and related transaction details.

2. Redirect the customer

After receiving a successful response, redirect the customer to the TWPayz checkout page to complete the payment process.

3. Get the payment status

After the payment is completed, verify the transaction status using the payment response or the relevant TWPayz API.


1. Send an Initial Payment

To start the payment process, send an initial server-to-server payment request to the TWPayz platform.

Note: The merchantRedirectUrl must be URL-encoded before sending the request.


Sample Request


Sample Response


Hashing Rule

TWPayz is supporting MD5 Cryptographic Hash for the authenticity of payment request send to the server.


Below is the description of fields used for generating checksum:
  • memberId <Merchant ID as shared by TWPayz>
  • secureKey <Secure Key that can be generated through TWPayz's dashboard>
  • merchantTransactionId <Unique transaction ID provided by merchant>
  • amount <Amount of transaction>

How to generate Checksum?

Checksum has to be calculated with following combination.
<memberId>|<secureKey>|<merchantTransactionId>|<amount>


Sample Code


2. Redirect the Customer

Redirect the customer to the redirect.url received in the initial payment response. If additional parameters are provided, submit them using the POST method.

After payment processing, the customer is redirected to the merchantRedirectUrl along with a resourcePath parameter, which can be used to retrieve the transaction status.


Sample Request


Sample response


3. Get Payment Status

To retrieve the payment status, send a GET request to baseUrl + resourcePath along with the required authentication parameters.

resourcePath example:

resourcePath=/transactionServices/REST/v1/payments/{id}

Sample Request


Sample Response


Hashing Rule for Get Status

TWPayz is supporting MD5 Cryptographic Hash for the authenticity of payment request send to the server.


Below are the description of fields used for generating checksum:
  • memberId <Merchant ID as shared by TWPayz>
  • secureKey <Secure Key that can be generated through TWPayz's dashboard>
  • paymentId <Id of previous transaction>

How to generate Checksum?

Checksum has to be calculated with following combination & needs to be send along with the authentication parameters in each server-to-server request:
<memberId>|<secureKey>|<paymentId>


Standard Notification/ Callback

Checksum has to be calculated with following combination.
<paymentId>|<merchantTransactionId>|<amount>|<short status of transaction>|<secret key>

Example :
77251|011E1D8A5C034|156.00|N|<merchant secret key>


Sample Code


Payment Modes and Brands

Below are the list of payment brands for asynchronous workflow which requires the payment data.

Show all modes & brands