Payment
SecurePay
POST
https://api.2pay.co/online/v1/secure-pay
This API provides a fast and secure way for order payments
Request Body
merchantNo*
String
ID of a merchant.
verifySign *
String
The merchants should verify the signature to ensure the response is from the server and not modified by any others.
currency*
String
Currency supported by 2Pay is "USD".
amount *
Number
Amount of a transaction.
vendor*
String
Payment methods.
Potential values:"alipay", "wechatpay", "paypal", "venmo", "unionpay", "creditcard", "truemoney", "alipay_hk", "tng", "gcash", "dana", "kakaopay", "bkash", "easypaisa".
reference*
String
The reference number of a trasaction in the merchant services system.
terminal*
String
Potential values: "ONLINE", "WAP", "YIP","MWEB"(for Wechat H5 payment).
ipnUrl*
String
Asynchronous callback Url.
The IPN Url should be secure and reliable.
callbackUrl*
String
Synchronously return a http url via a callback url.
This callback url is used to recieve notifications and messages of an event.
The callback url should follow the macro rules. For example, xxxcallback_url?trans_no={amount}&amount={amount}. 2Pay will automatically replace the values of parameters in curly brackets ("{ }").
description
String
Description of a transaction on a bill / invoice.
timeout
String
The interval for a transaction to be expired. (measured in minutes)
Default value: 120
goodsInfo
String
The product information (stores in an array) written in JSON format.
For example, [{"goods_name":"name1", "quantity":"quantity1"}, {"goods_name":"name2", "quantity":"quantity2"}]
Do not support special characters.
{
"ret_code": "000100",
"ret_msg": "prepay success",
"result": {
"amount": "1",
"currency": "USD",
"transactionNo": "558901a15-1c3f-427a-b838-83049b4efc47",
"reference": "b6984c78-w8201-kqcak81jk",
"cashierUrl": "https://api.2pay.co/app/url",
"settleCurrency": "USD"
}
}
Response
Parameter
Type
Description
ret_msg
String
Return response message.
ret_code
String
Return response status code.
Result Object
Parameter
Type
Description
amount
String
The amount of a transaction.
This parameter will be returned when the transaction currency is "USD".
currency
String
Transaction currency.
Currency supported by 2Pay is: "USD".
transactionNo
String
The transaction ID of 2Pay system.
reference
String
The reference number of a trasaction in the merchant services system.
cashierUrl
String
The Url using by cashiers.
settleCurrency
String
Currency code from ISO 4217.
Potential value: "USD".
curl --location --request POST 'https://api.2pay.co/online/v1/secure-pay' \
--header 'Content-Type: application/json' \
--data-raw '{
"merchantNo": "M165937487",
"vendor": "alipay",
"reference": "b6984c78-8201-kqcak81jk",
"amount": "1",
"currency": "USD",
"description": "your description",
"terminal": "IOS",
"callbackUrl": "https://{paidUrl}",
"ipnUrl": "https://alipay.com/notify",
"goodsInfo": "[{'\''goods_name'\'':'\''Plan'\'','\''quantity'\'':'\''1'\''}]",
"timeout": "120",
"verifySign": "{{verifySign}}"
}'
Last updated