Skip to content

Instantly share code, notes, and snippets.

@gvsrini
Forked from medikoo/tiw-maxcom-api.md
Last active May 29, 2021 13:31
Show Gist options
  • Save gvsrini/d05661679a7b01fe0587 to your computer and use it in GitHub Desktop.
Save gvsrini/d05661679a7b01fe0587 to your computer and use it in GitHub Desktop.

TIW <-> MaxCom data exchange API

API of MaxCom service

Payment initialization

Request data
Property nameDescriptionValue format
emailEmailValid email, max 100 characters
mobileNoMobile numberFull country code, only dialling digits, no symbols e.g. 48693427795
businessIdTIW unique business id, provided by MaxComExactly: '1'
customerNameCustomer nameString, only English Alphabets allowed, max 100 chars
amountAmount to be charged in TShPositive integer
txnIdTransaction id, unique, generated by TIWPositive integer, Max 11 digits
hashCodeMD5 Hash of Shared Secret + amount + businessId + customerName + email + mobileNo + txnId MD5 Hash
Response data

Request is initialized by user from TIW application window, so there's no MaxCom response that can be parsed on TIW end, instead user is presented with expected interface of MaxCom application.

User Initiated Mobile Payment cancellation

Customer (or TIW) may choose to cancel a Mobile Payment transaction. (This API is not applicable for Credit Card Payment)

To initiate cancellation, this API is invoked on MaxCom payment server (which in turn communicates the same to Mobile Money Gateway) and responds back with a Success or Failure. In case of failure, the same API may be re-invoked later (or handled manually).

Request data
Property nameDescriptionValue format
txnIdTransaction Id (as provided by TIW in payment initialization request)Positive integer
amountCharged amountPositive integer
hashCodeMD5 Hash of Shared Secret + amount + txnId MD5 Hash
Response data
Property nameDescriptionValue format
txnIdTransaction Id (as provided by TIW in payment initialization request)Positive integer
cancellationNoUnique Cancellation No.Positive integer,12 digits
cancellationDateCancellation Date and Time in YYYYMMDDHH24MISS format
amountCharged amountPositive integer
statusStatusOne of the following strings: "Success", "Failure"
responseCodeInternal response code of MaxCom, not meaningful to TIW, to be saved just for reference0-Success, 1 to 100 for different errors.
responseMessageMessage (human friendly description of status)Max 200 characters
hashCodeMD5 Hash of Shared Secret + amount + cancellationDate + cancellationNo + responseCode + responseMessage + status + txnId MD5 Hash

API of TIW service

Payment resolution

Customer may choose to make payment via Credit Card or Mobile Money.

In case of Credit Card, this URL will be invoked after the Credit Card Payment Gateway either returns a Success or Failure response, and the same information is passed to TIW by redirecting browser to the resolve-payment-transaction URL.

In case of Mobile Money, payment is completed in 2 steps:

Step 1: Payment initialisation

Customer is presented with a Mobile Txn Ref and after pausing for 2 minutes, customer is redirected to resolve-payment-transaction URL. At this point, it is not known whether customer has completed the payment or not. Hence, a response code of 999 is returned with a Transaction Message of "Transaction Initiated Successfully" and "Success" status.

TIW Handshake: GET on resolve-payment-transaction

Step 2: Payment Completion

Upon completion of payment after a certain duration (after initialisation call, could it be before also in some cases(?)), same URL is invoked with a response code of 0.

TIW Handshake: POST (Same URL as a REST API) on resolve-payment-transaction from MaxCom Payment Gateway Server to TIW Server

Request data
Property nameDescriptionValue format
txnIdTransaction Id (as provided by TIW in payment initialization request)Positive integer
amountCharged amountPositive integer
statusStatusOne of the following strings: "Success", "Failure", "Cancelled"
responseCodeInternal response code of MaxCom, not meaningful to TIW, to be saved just for reference0-Success, 1 to 100 for different errors. 999 in case of Mobile Money txn initiation
responseMessageMessage (human friendly description of status)Max 200 characters
receiptNoReceipt NumberMobile Txn Ref for Step 1 and Receipt No. for Step 2. Max 20 characters
hashCodeMD5 Hash of Shared Secret + amount + receiptNo + responseCode + responseMessage + status + txnId MD5 Hash
Response data

Request is initialized by user from MaxCom application window, so instead of sending response to MaxCom service, TIW server responds back with TIW user application.

MaxCom Initiated Mobile Payment cancellation

MaxCom may choose to cancel a Mobile Payment transaction in case payment is not received with defined time - Ex: After 2 days. (This API is not applicable for Credit Card Payment).

To initiate cancellation, this API is invoked by MaxCom payment server to TIW server and TIW server responds back with a Success or Failure. In case of failure, the same API may be re-invoked later (or handled manually).

Request data
Property nameDescriptionValue format
txnIdTransaction Id (as provided by TIW in payment initialization request)Positive integer
amountCharged amountPositive integer
cancellationNoUnique Cancellation No.Positive integer,12 digits
cancellationDateCancellation Date and Time in YYYYMMDDHH24MISS format
hashCodeMD5 Hash of Shared Secret + amount + cancellationDate + cancellationNo + txnId MD5 Hash
Response data
Property nameDescriptionValue format
txnIdTransaction Id (as provided by TIW in payment initialization request)Positive integer
amountCharged amountPositive integer
statusStatusOne of the following strings: "Success", "Failure", "Cancelled"
responseCodeInternal response code of TIW, not meaningful to MaxCom, to be saved just for reference0-Success, 1 to 100 for different errors.
responseMessageMessage (human friendly description of status)Max 200 characters
hashCodeMD5 Hash of Shared Secret + amount + responseCode + responseMessage + status + txnIdMD5 Hash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment