Self Service Machines
How to Integrate
Please refer to the high level diagram flow of Offline Payment.
Â
1. Prepare Payment Token Request
To prepare a payment token request, refer to the required parameters below.
Please refer to: Payment Token API Request
Pre Requisite |
---|
|
Merchants who already know the specific payment to process may fill in Channel Code. Otherwise, merchants may also fill in Category Code or Group Code (if either parameter is known), and the corresponding payment channel will then be shown in Payment Option and Payment Option Detail APIs. |
{
"merchantID": "JT04",
"invoiceNo": "210920085327",
"description": "V4 Test",
"amount": "10",
"currencyCode": "THB",
"paymentChannel": ["SSM"]
}
Â
2. Receive Payment Token Response
To receive a payment token response, refer to the sample payment token response below.
Please refer to: Payment Token API Response
{
"paymentToken": "kSAops9Zwhos8hSTSeLTUd15vzDUCGPL3MhFRfv3zKvczvyqg6Vt44WJQcGq/iYdO6ifI4DmMis+CwIUr7Ba0K26hfn4CL8ompL9fpOS7zo=",
"respCode": "0000",
"respDesc": "Success"
}
Â
3. Validation of Payment Token
Proceed only when the parameter "respCode" is "0000". Otherwise, terminate the payment process. Refer to the Payment Response Code below.
Please refer to: Payment Response Code
Â
4. Prepare Payment Option Request
To retrieve available payment options, send a payment option request. Refer to the sample Payment Option Request below.
For merchants who already know which payment options are available, this step is optional.
Please refer to: Payment Option API Request
{
"paymentToken": "kSAops9Zwhos8hSTSeLTUd15vzDUCGPL3MhFRfv3zKvczvyqg6Vt44WJQcGq/iYdO6ifI4DmMis+CwIUr7Ba0K26hfn4CL8ompL9fpOS7zo=",
"locale": "en",
"clientID": "30c7cf51-75c4-4265-a70a-effddfbbb0ff"
}
Â
5. Receive Payment Option Response
To receive a payment option response, refer to the sample payment option response below.
Please refer to: Payment Option API Response
{
"paymentToken": "kSAops9Zwhos8hSTSeLTUd15vzDUCGPL3MhFRfv3zKvczvyqg6Vt44WJQcGq/iYdO6ifI4DmMis+CwIUr7Ba0K26hfn4CL8ompL9fpOS7zo=",
"merchantDetails": {
"id": "JT04",
"name": "DEMO Merchant TH",
"address": "DEMO",
"email": "",
"logoUrl": "https://pgw-static-sandbox.s3.amazonaws.com/images/merchantlogo/JT04.png",
"bannerUrl": null
},
"transactionDetails": {
"amount": "10.00",
"currencyCode": "THB",
"invoiceNo": "210920085327",
"description": "V4 Test"
},
"channelCategories": [{
"groups": [{
"sequenceNo": 1,
"name": "ATM",
"code": "ATM",
"iconUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/icon/atm.png",
"logoUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/logo/.png",
"default": true,
"expiration": false
}],
"sequenceNo": 1,
"name": "ATM / Kiosk",
"code": "SSM",
"iconUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/icon/ssm.png",
"logoUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/logo/.png",
"default": true,
"expiration": false
}],
"respCode": "0000",
"respDesc": "Success"
}
Â
6. Prepare Payment Option Details Request
To retrieve details for available payment options, send a payment option details request. Refer to the sample Payment Option Details Request below.
For merchants who already know payment option details, this step is optional.
Pre Requisite |
---|
|
|
Please refer to: Payment Option Details API Request
{
"categoryCode": "SSM",
"groupCode": "ATM",
"paymentToken": "kSAops9Zwhos8hSTSeLTUd15vzDUCGPL3MhFRfv3zKvczvyqg6Vt44WJQcGq/iYdO6ifI4DmMis+CwIUr7Ba0K26hfn4CL8ompL9fpOS7zo=",
"locale": "en",
"clientID": "30c7cf51-75c4-4265-a70a-effddfbbb0ff"
}
Â
7. Receive Payment Option Details Response
To receive a payment option details response, refer to the sample payment option details response below.
Please refer to: Payment Option Details API Response
{
"totalChannel": 8,
"name": "ATM",
"categoryCode": "SSM",
"groupCode": "ATM",
"iconUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/icon/atm.png",
"channels": [{
"sequenceNo": 1,
"name": "Kasikorn Bank",
"currencyCodes": null,
"iconUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/icon/KBANK.png",
"logoUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/logo/KBANK.png",
"payment": {
"code": {
"channelCode": "123",
"agentCode": "KBANK",
"agentChannelCode": "ATM"
},
"input": {
"name": "O",
"email": "O",
"mobileNo": "O"
},
"validation": {
"name": "^(?!\\s*$)[-a-zA-Z' ''.']{1,}$",
"email": "^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$",
"mobileNo": "[0-9]+",
"additional": {
"cardNo": null,
"amount": {
"min": 0,
"max": 0
}
}
}
},
"isDown": false
}, {
"sequenceNo": 2,
"name": "The Siam Commercial Bank",
"currencyCodes": null,
"iconUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/icon/SCB.png",
"logoUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/logo/SCB.png",
"payment": {
"code": {
"channelCode": "123",
"agentCode": "SCB",
"agentChannelCode": "ATM"
},
"input": {
"name": "O",
"email": "O",
"mobileNo": "O"
},
"validation": {
"name": "^(?!\\s*$)[-a-zA-Z' ''.']{1,}$",
"email": "^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$",
"mobileNo": "[0-9]+",
"additional": {
"cardNo": null,
"amount": {
"min": 0,
"max": 0
}
}
}
},
"isDown": false
}, {
"sequenceNo": 3,
"name": "Bangkok Bank PCL",
"currencyCodes": null,
"iconUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/icon/BBL.png",
"logoUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/logo/BBL.png",
"payment": {
"code": {
"channelCode": "123",
"agentCode": "BBL",
"agentChannelCode": "ATM"
},
"input": {
"name": "O",
"email": "O",
"mobileNo": "O"
},
"validation": {
"name": "^(?!\\s*$)[-a-zA-Z' ''.']{1,}$",
"email": "^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$",
"mobileNo": "[0-9]+",
"additional": {
"cardNo": null,
"amount": {
"min": 0,
"max": 0
}
}
}
},
"isDown": false
}, {
"sequenceNo": 4,
"name": "Krung Thai Bank",
"currencyCodes": null,
"iconUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/icon/KTB.png",
"logoUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/logo/KTB.png",
"payment": {
"code": {
"channelCode": "123",
"agentCode": "KTB",
"agentChannelCode": "ATM"
},
"input": {
"name": "O",
"email": "O",
"mobileNo": "O"
},
"validation": {
"name": "^(?!\\s*$)[-a-zA-Z' ''.']{1,}$",
"email": "^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$",
"mobileNo": "[0-9]+",
"additional": {
"cardNo": null,
"amount": {
"min": 0,
"max": 0
}
}
}
},
"isDown": false
}, {
"sequenceNo": 5,
"name": "Bank of Ayudhya",
"currencyCodes": null,
"iconUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/icon/BAY.png",
"logoUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/logo/BAY.png",
"payment": {
"code": {
"channelCode": "123",
"agentCode": "BAY",
"agentChannelCode": "ATM"
},
"input": {
"name": "O",
"email": "O",
"mobileNo": "O"
},
"validation": {
"name": "^(?!\\s*$)[-a-zA-Z' ''.']{1,}$",
"email": "^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$",
"mobileNo": "[0-9]+",
"additional": {
"cardNo": null,
"amount": {
"min": 0,
"max": 0
}
}
}
},
"isDown": false
}, {
"sequenceNo": 6,
"name": "TMB Bank Public Company Limited",
"currencyCodes": null,
"iconUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/icon/TMB.png",
"logoUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/logo/TMB.png",
"payment": {
"code": {
"channelCode": "123",
"agentCode": "TMB",
"agentChannelCode": "ATM"
},
"input": {
"name": "O",
"email": "O",
"mobileNo": "O"
},
"validation": {
"name": "^(?!\\s*$)[-a-zA-Z' ''.']{1,}$",
"email": "^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$",
"mobileNo": "[0-9]+",
"additional": {
"cardNo": null,
"amount": {
"min": 0,
"max": 0
}
}
}
},
"isDown": false
}, {
"sequenceNo": 7,
"name": "Thanachart Bank",
"currencyCodes": null,
"iconUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/icon/TBANK.png",
"logoUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/logo/TBANK.png",
"payment": {
"code": {
"channelCode": "123",
"agentCode": "TBANK",
"agentChannelCode": "ATM"
},
"input": {
"name": "O",
"email": "O",
"mobileNo": "O"
},
"validation": {
"name": "^(?!\\s*$)[-a-zA-Z' ''.']{1,}$",
"email": "^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$",
"mobileNo": "[0-9]+",
"additional": {
"cardNo": null,
"amount": {
"min": 0,
"max": 0
}
}
}
},
"isDown": false
}, {
"sequenceNo": 8,
"name": "United Overseas Bank",
"currencyCodes": null,
"iconUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/icon/UOB.png",
"logoUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/logo/UOB.png",
"payment": {
"code": {
"channelCode": "123",
"agentCode": "UOB",
"agentChannelCode": "ATM"
},
"input": {
"name": "O",
"email": "O",
"mobileNo": "O"
},
"validation": {
"name": "^(?!\\s*$)[-a-zA-Z' ''.']{1,}$",
"email": "^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$",
"mobileNo": "[0-9]+",
"additional": {
"cardNo": null,
"amount": {
"min": 0,
"max": 0
}
}
}
},
"isDown": false
}],
"validation": null,
"configuration": {
"payment": {
"tokenize": false,
"tokenizeOnly": false,
"cardTokenOnly": false,
"immediatePayment": false
},
"notification": {
"facebook": false,
"whatsApp": false,
"line": false
}
},
"respCode": "0000",
"respDesc": "Success"
}
Â
8. Prepare Do Payment Request
Merchants must call the Do Payment API to request for payment. To prepare a payment request, refer to the sample payment request below.
Pre Requisite : |
---|
|
|
|
Please refer to: Do Payment API Request
{
"responseReturnUrl": "https://sandbox-pgw-ui.2c2p.com/payment/4.1/#/info/",
"payment": {
"code": {
"channelCode": "123",
"agentCode": "KBANK",
"agentChannelCode": "ATM"
},
"data": {
"name": "Terrance",
"email": "[email protected]",
"mobileNo": "+60123344556"
}
},
"clientIP": "211.24.117.220",
"paymentToken": "kSAops9Zwhos8hSTSeLTUd15vzDUCGPL3MhFRfv3zKvczvyqg6Vt44WJQcGq/iYdO6ifI4DmMis+CwIUr7Ba0K26hfn4CL8ompL9fpOS7zo=",
"locale": "en",
"clientID": "30c7cf51-75c4-4265-a70a-effddfbbb0ff"
}
Â
9. Receive Do Payment Response
To receive a payment response, refer to the the sample payment response below.
Please refer: Do Payment API Response
{
"data": "https://demo2.2c2p.com/2C2PFrontEnd/storedCardPaymentV2/MPaymentProcess.aspx?token=fyGgMiRLJ5J4umLD0VjYdEjcuOC96Mt++wLdSQS5hlnwbYIDQ+ypHj5QUv4lk33g",
"channelCode": "123",
"respCode": "1001",
"respDesc": "Redirect to authenticate ACS bank page."
}
Â
10. Redirect to Payment Slip
Merchants must call the Do Payment API to display a payment slip via browser. The payment slip details are returned through the following parameters. **Failure or rejection of the call for the respCode parameter will terminate the process.**
parameter from Do Payment Response | Description |
---|---|
data | Third party URL endpoint for payment slip |
respCode | Indicates redirection method. For more details, refer to Payment Process Flow |
Â
11. Print or Download Payment Slip
Customers must print or download the displayed payment slip and complete the payment at the counter or kiosk machine.
Â
12. Display Payment Status
Merchants must have a looping function that checks the Transaction Status API in the 2C2P system. A transaction will be displayed as pending until the customer has completed the payment at the counter or kiosk machine.
Once a customer has completed the payment, the Transaction Status API will return an end status and end the looping function. This allows merchants to display the payment confirmation.
Please refer to: Transaction Status API
Â
13. Receive Payment Response via backend API
Please refer to: Payment Response - Backend API
The parameter "backendReturnUrl" that was previously sent via Payment Token Request is the merchant endpoint that will receive the backend notification. If the parameter "backendReturnUrl" is not set, system will get the backend return URL from the merchant profile set in 2C2P's merchant portal by default.
{
"merchantID": "JT04",
"invoiceNo": "210920085327",
"cardNo": null,
"amount": 10.0,
"userDefined1": "",
"userDefined2": "",
"userDefined3": "",
"userDefined4": "",
"userDefined5": "",
"currencyCode": "THB",
"cardToken": "",
"recurringUniqueID": "",
"tranRef": "209881",
"referenceNo": "",
"approvalCode": null,
"eci": "",
"transactionDateTime": "20200921095120",
"agentCode": "KBANK",
"channelCode": "ATM",
"issuerCountry": "",
"installmentMerchantAbsorbRate": null,
"respCode": "0000",
"respDesc": "Success"
}
Â
14. Payment Inquiry to retrieve payment information
For merchants who do not implement "Receive Payment Response via backend API", you are required to call to the Payment Inquiry API to receive the payment response.
To prepare a payment inquiry request, refer to the sample payment inquiry request below.
Please refer to: Payment Inquiry API Request
{
"merchantID": "JT04",
"invoiceNo": "210920085327",
"locale": "en"
}
Â
15. Receive Payment Inquiry Response
To receive a payment inquiry response, refer to the sample payment inquiry response below.
Please refer to: Payment Inquiry API Response
{
"merchantID": "JT04",
"invoiceNo": "210920085327",
"cardNo": null,
"amount": 10.0,
"userDefined1": "",
"userDefined2": "",
"userDefined3": "",
"userDefined4": "",
"userDefined5": "",
"currencyCode": "THB",
"cardToken": "",
"recurringUniqueID": "",
"tranRef": "209881",
"referenceNo": "",
"approvalCode": null,
"eci": "",
"transactionDateTime": "20200921095120",
"agentCode": "KBANK",
"channelCode": "ATM",
"issuerCountry": "",
"installmentMerchantAbsorbRate": null,
"respCode": "0000",
"respDesc": "Success"
}
Updated almost 2 years ago