These docs are for v4.0.2. Click to read the latest docs for v4.3.0.

QR Payment

🚧

How to Integrate

Please refer to the high level diagram flow of Scan QR 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

  1. MerchantID, secret code & currencyCode are provided by 2C2P.
  1. For PaymentChannel, merchants can refer to the available payment channels for QR Payment (QRC / CSQR / THQR / SGQR) linked above.

Merchants who already know which specific QR payment needs to proceed 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": "JT01",
    "invoiceNo": "1523953661",
    "description": "item 1",
    "amount": 1000.00,
    "currencyCode": "SGD",
    "paymentChannel": ["QR"]
}

 

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": "kSAops9Zwhos8hSTSeLTUajqpG9FvXPBaCUZJYcqWPk6HBVwGDWuBKZLRkqc0ZB1dtfLH30dwfBIatsk7W2bKJi1ewsx0/VTUKZA9BvcSXs=",
  "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": "kSAops9Zwhos8hSTSeLTUajqpG9FvXPBaCUZJYcqWPk6HBVwGDWuBKZLRkqc0ZB1dtfLH30dwfBIatsk7W2bKJi1ewsx0/VTUKZA9BvcSXs=",
	"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": "kSAops9Zwhos8hSTSeLTUajqpG9FvXPBaCUZJYcqWPk6HBVwGDWuBKZLRkqc0ZB1dtfLH30dwfBIatsk7W2bKJi1ewsx0/VTUKZA9BvcSXs=",
	"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": "SGD",
		"invoiceNo": "150920092059",
		"description": "V4 Test"
	},
	"channelCategories": [{
		"groups": [{
			"sequenceNo": 1,
			"name": "QR Code Payment",
			"code": "QRC",
			"iconUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/icon/qrc.png",
			"logoUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/logo/.png",
			"default": true,
			"expiration": false
		}, {
			"sequenceNo": 2,
			"name": "Card Scheme QR Payment",
			"code": "CSQR",
			"iconUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/icon/csqr.png",
			"logoUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/logo/.png",
			"default": false,
			"expiration": false
		}, {
			"sequenceNo": 3,
			"name": "Thai QR Payment",
			"code": "THQR",
			"iconUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/icon/thqr.png",
			"logoUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/logo/.png",
			"default": false,
			"expiration": false
		}, {
			"sequenceNo": 4,
			"name": "SG QR Payment",
			"code": "SGQR",
			"iconUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/icon/sgqr.png",
			"logoUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/logo/.png",
			"default": false,
			"expiration": false
		}],
		"sequenceNo": 1,
		"name": "QR Payment",
		"code": "QR",
		"iconUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/icon/qr.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

  1. Payment Token from Payment Token API
  1. CategoryCode & GroupCode from Payment Option API

📘

Please refer to: Payment Option Details API Request

{
	"categoryCode": "QR",
	"groupCode": "CSQR",
	"paymentToken": "kSAops9Zwhos8hSTSeLTUajqpG9FvXPBaCUZJYcqWPk6HBVwGDWuBKZLRkqc0ZB1dtfLH30dwfBIatsk7W2bKJi1ewsx0/VTUKZA9BvcSXs=",
	"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": 3,
	"name": "Card Scheme QR Payment",
	"categoryCode": "QR",
	"groupCode": "CSQR",
	"iconUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/icon/csqr.png",
	"channels": [{
		"sequenceNo": 1,
		"name": "VISA QR",
		"currencyCodes": null,
		"iconUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/icon/visaqr.png",
		"logoUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/logo/visaqr.png",
		"payment": {
			"code": {
				"channelCode": "VEMVQR"
			},
			"input": {
				"name": "O",
				"email": "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,}))$"
			}
		},
		"isDown": false
	}, {
		"sequenceNo": 2,
		"name": "Master Card QR",
		"currencyCodes": null,
		"iconUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/icon/mcqr.png",
		"logoUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/logo/mcqr.png",
		"payment": {
			"code": {
				"channelCode": "MCEMVQR"
			},
			"input": {
				"name": "O",
				"email": "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,}))$"
			}
		},
		"isDown": false
	}, {
		"sequenceNo": 1,
		"name": "UPI QR",
		"currencyCodes": null,
		"iconUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/icon/upiemvqr.png",
		"logoUrl": "https://d27uu9vmlo4gwh.cloudfront.net/images/v4/images/logo/upiemvqr.png",
		"payment": {
			"code": {
				"channelCode": "UPIEMVQR"
			},
			"input": {
				"name": "O",
				"email": "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,}))$"
			}
		},
		"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 :

  1. Payment Token from Payment Token API
  1. ChannelCode from Payment Option Details API.
    Merchants who already know the necessary ChannelCode from the payment channel list can also fill in this value directly.
  1. For the parameter payment.data, refer to the Payment Option Details API Response parameter channels.payment.input to determine the particular data required.

📘

Please refer to: Do Payment API Request

{
	"responseReturnUrl": "https://sandbox-pgw-ui.2c2p.com/payment/4.1/#/info/",
	"payment": {
		"code": {
			"channelCode": "ALQR"
		},
		"data": {
			"name": "Terrance Tay",
			"email": "[email protected]"
		}
	},
	"clientIP": "175.144.230.170",
	"paymentToken": "kSAops9Zwhos8hSTSeLTUajqpG9FvXPBaCUZJYcqWPk6HBVwGDWuBKZLRkqc0ZB1dtfLH30dwfBIatsk7W2bKJi1ewsx0/VTUKZA9BvcSXs=",
	"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 to: Do Payment API Response

{
	"type": "URL",
	"data": "https://pgw-static-sandbox.s3.amazonaws.com/images/qr/3241886.png",
	"channelCode": "ALQR",
	"respCode": "1005",
	"respDesc": "Pending for user scan QR."
}

 

10. Display QR Code Image

Display the QR code image based on the Do Payment API response. **Failure or rejection of the call for the respCode parameter will terminate the process.**

parameter from Do Payment ResponseDescription
dataQR code image URL
respCodeIndicates redirection method. For more details, refer to Payment Process Flow

 

11. Scan QR Code

Customers must scan the displayed QR code to proceed with payment.

 

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.

Once the payment has been completed, 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: 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": "280520075921",
  "cardNo": "411111XXXXXX1111",
  "amount": "230.87",
  "currencyCode": "THB",
  "tranRef": "2868821",
  "referenceNo": "2785703",
  "approvalCode": "531484",
  "eci": "05",
  "transactionDateTime": "20200528080508",
  "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

{
    "paymentToken": "254b77a5-5568-49ca-9e0e-2f8d28be95e7",
    "merchantID": "JT01",
    "invoiceNo": "254b77aabc",
    "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": "JT01",
    "invoiceNo": "1523953661",
    "amount": 1000.00,
    "currencyCode": "SGD",
    "transactionDateTime": "311220235959",
    "agentCode": "OCBC",
    "channelCode": "VI",
    "approvalCode": "717282",
    "referenceNo": "00010001",
    "pan": "411111XXXXXX1111",
    "cardToken": "",
    "issuerCountry": "SG",
    "eci": "05",
    "installmentPeriod": 6,
    "interestType": "M",
    "interestRate": 0.3,
    "installmentMerchantAbsorbRate ": 0.0,
    "recurringUniqueID": "",
    "fxAmount": 25000.00,
    "fxRate": 25.0000001,
    "fxCurrencyCode": "THB",
    "userDefined1": "",
    "userDefined2": "",
    "userDefined3": "",
    "userDefined4": "",
    "userDefined5": "",
    "respCode": "0000",
    "respDesc": "Transaction is successful."
}