Pay By Link
The Pay By Link API allows merchants to generate a secure payment link by providing transaction and customer details.
The API returns a unique payment URL that can be shared with customers to complete transactions securely through TWPayz.
A POST request must be sent over HTTPS to the following endpoint: merchantServices/api/v1/generatePayByLink
Merchant needs to set authentication token in header for each request. To generate authentication token, please refer Auth token API.
Request specification.
| Parameter | Description | Format | Required |
|---|---|---|---|
| authentication.memberId | Merchant’s unique ID assigned by TWPayz to authenticate a transaction request. | N10 [0-9] |
Yes |
| authentication.checksum | Cryptographic hash generated by MD5 as follows. All the processes has different combination of parameters to generate hash (all values separated by pipe). Kindly refer sample given in tutorial for each case . | AN255 [a-zA-Z0-9] |
Yes |
| authentication.expirationTime | Enter the validity period of the authentication credentials in hours (1–24). After this period expires, the client must generate a new authentication request. | N2 [1-24] |
No |
| merchant.orderID | This reference number is provided by the merchant, should be unique for the transactions and is visible on the end customer’s statement. | AN100 [.\\p[0-9a-zA-Z\\p{Space}\\-]{0,100} |
Yes |
| merchant.amount | Amount of the transaction. | N13 [0-9]{1,10}\.[0-9]{2} |
Yes |
| merchant.currency | Currency of the transaction. | A3 [a-zA-Z\\p{Space}\\,]+ |
Yes |
| merchant.contactName | Name of the customer. | AN [a-zA-Z0-9\\p{Space}\\,.:'"-=+)({}[]]+ |
No |
| merchant.email | Email address of the customer. | AN100 [A-Za-z0-9._%'-]+@[A-Za-z0-9.-]+\\.[a-zA-Z]{2,100} |
Conditional |
| merchant.phone | Phone number of the customer. | N24 [0-9\+-. ]{6,24} |
Conditional |
| merchant.orderDescription | Description of the order sent by merchant | A255 [\p{L}\P{M}\p{M}\n\ra-zA-Z0-9:\\!@#$%^&{}\[\]()_+\-=,*.~'` ] |
No |
Response specification.
| Parameter | Description | Format | Required |
|---|---|---|---|
| result.code | The unique response code for successful or failed transaction. See the Response codes for more detailed information. | AN11 [0-9\.]{2,11} |
Yes |
| result.description | Response description of the response code. | AN255 [a-zA-Z0-9\\p{Space}\\,]+[a-zA-Z0-9\\p{Space}\\,]+ |
Yes |
| result.url | The transaction payment URL generated for the order. Use this URL to redirect the customer to the payment page. | AN2048 (Valid URL) |
Yes |
Sample Request
https://sandbox..com/merchantServices/api/v1/generatePayByLink
{
"authentication": {
"memberId": "13947",
"checksum": "cd67c0c11138ad899d46f8751f37b1a4",
"expirationTime": "1"
},
"merchant": {
"orderID": "qwerty459567",
"amount": "20.00",
"currency": "GBP",
"contactName": "Jhon Doe",
"email": "Jhon.Doe@gmail.com",
"phone": "1234567890",
"orderDescription": "qwertyuiop"
}
}
Sample Response
{
"result": {
"code": "00026",
"description": "Your record found successfully",
"url": "https://sandbox..com/transaction/PayByLink?orderId=qwerty459567&authToken=a4000890-6b0e-4d3d-83f7-ca172753edae"
}
}
Hashing Rule
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>
- orderid <Unique transaction ID provided by Merchant>
- amount <Amount of transaction>
- memberkey <Secure Key that can be generated through TWPayz's dashboard>
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>|<orderid>|<amount>|<memberkey>