Skip to main content

Payment Methods

warning

Verify that your API credentials allow for the selected pay_type.

PayType

CodeDescription
800008Consumer Present QR Code Mode (CPM) for WeChat, Alipay, UNIONPAY Quick Pass
800101Alipay Merchant Presented QR Code Payment in store (MPM) (Overseas Merchants)
800108Alipay Consumer Presented QR Code Payment (CPM) (Overseas & HK Merchants)
801101Alipay Online WEB (in browser Chrome etc.) Payment (Overseas Merchants) **
801107Alipay Online WAP (in mobile browser Chrome etc.) Payment (Overseas Merchants)
801110Alipay in-APP Payments (Overseas Merchants)
800107Alipay Service Window H5 Payment (in Alipay APP H5 payments)
801501Alipay Merchant Presented QR Code (MPM) Payment (HK Merchants)
801510Alipay In-App Payment (HK Merchants)
801512Alipay Online WAP Payment (HK Merchants)
801514Alipay Online WEB Payment (HK Merchants)
800201WeChat Merchant Presented QR Code Payment (MPM) (Overseas & HK Merchants)
800208WeChat Consumer Presented QR Code Payment (CPM) (Overseas & HK Merchants)
800207WeChat JSAPI Payment - WeChat Official Account Payment (in Wechat App)(Overseas & HK Merchants)
800212WeChat H5 Payment (In mobile browser)
800210WeChat in-APP Payment (Overseas & HK Merchants)
800213WeChat Mini-Program Payment (Overseas & HK Merchants)
801008WeChat Pay HK Consumer Presented QR Code Payment (CPM) (Direct Settlement, HK Merchants)
801010WeChat Pay HK In-App Payment (Direct Settlement, HK Merchants)
805801PayMe Merchant Presented QR Code Payment in store (MPM) (HK Merchants)
805808PayMe Consumer Presented QR Code Payment (CPM) (HK Merchants)
805814PayMe Online WEB (in browser Chrome etc.) Payment (HK Merchants)
805812PayMe Online WAP (in mobile browser Chrome etc.) Payment (HK Merchants)
800701UNIONPAY Quick Pass Merchant Presented QR Code Payment (MPM)
800708UNIONPAY Quick Pass Consumer Presented QR Code Payment (CPM)
800712UNIONPAY WAP Payment (HK Merchants)
800714UNIONPAY PC-Web Payment (HK Merchants)
802001FPS Merchant Presented QR Code Payment (MPM) (HK Merchants)***
803701Octopus dynamic QRC Payment - Merchant Present Mode (MPM) (HK Merchants)
802801Visa / Mastercard Online Payments
802808Visa / Mastercard Offline Payments
806527ApplePay Online Payments
806708UnionPay Card Offline Payments
806808American Express Card Offline Payments
note

*

  1. Differently from Public Payment Parameters, return_url is a mandatory request parameter.
  2. web_url parameter in response contains the payment url.

**

  1. Transaction amount must be greater than 1 HKD.

***

  1. Payment method does not support refunds.

****

  1. Please refer to this section for payment request and response.

Currencies

The below listed currencies are currently available in our payment network. Please consult technical.support@qfpay.com to verify that your API credentials and selected pay_type support your desired currency.

CodeDescription
AEDArab Emirates Dirham
CNYChinese Yuan
EUREuro
HKDHong Kong Dollar
IDRIndonesian Rupiah
JPYJapanese Yen
MMKMyanmar Kyat
MYRMalaysian Ringgit
SGDSingapore Dollar
THBThai Baht
USDUnited States Dollar
CADCanadian Dollar
AUDAustralian Dollar

API Endpoint for Payments

warning

Remember to immediately refund transactions that were made in the sandbox environment.

If you would like to quickly test the payment function in Postman we provide a collection that includes a pre-request script to generate the signature, download the file from here: Payment Request in Postman

Request Header:

{
Content-Type: application/x-www-form-urlencoded;
X-QF-APPCODE: D5589D2A1F2E42A9A60C37**********
X-QF-SIGN: 6FB43AC29175B4602FF95F8332028F19
}

Request Body:

{
mchid=ZaMVg*****&out_trade_no=01234567890123&pay_type=800101&txamt=10&txcurrcd=EUR&txdtm=2019-12-25 14:21:28
}

#coding=utf8
import urllib.request, urllib.parse, urllib.error, urllib.request, urllib.error, urllib.parse, hashlib
import requests
import datetime
import string

# Enter Client Credentials
environment = 'https://test-openapi-hk.qfapi.com'
app_code = 'D5589D2A1F2E42A9A60C37*********'
client_key = '0E32A59A8B454940A2FF39**********'


# Create parameter values for data payload
current_time = datetime.datetime.now().replace(microsecond=0)

print(current_time)

# Create signature
def make_req_sign(data, key):
keys = list(data.keys())
keys.sort()
p = []
for k in keys:
v = data[k]
p.append('%s=%s'%(k,v))
unsign_str = ('&'.join(p) + key).encode("utf-8")
s = hashlib.md5(unsign_str).hexdigest()
return s.upper()


# Body payload
txamt = '10' #In USD,EUR,etc. Cent
txcurrcd = 'HKD'
pay_type = '800101' # Alipay CPM = 800108 , MPM = 800101
auth_code='283854702356157409' #CPM only
out_trade_no = '01234567890123'
txdtm = current_time
goods_name = 'test1'
auth_code = '280438849930815813'
mchid = 'ZaMVg*****'
notify_url = 'https://xxx.com/notify/success'
key = client_key


#data ={'txamt': txamt, 'txcurrcd': txcurrcd, 'pay_type': pay_type, 'out_trade_no': out_trade_no, 'txdtm': txdtm, 'goods_name': goods_name, 'udid': udid, 'auth_code': auth_code, 'mchid': mchid, 'notify_url': notify_url}
data ={'txamt': txamt, 'txcurrcd': txcurrcd, 'pay_type': pay_type, 'out_trade_no': out_trade_no, 'txdtm': txdtm, 'mchid': mchid}

r = requests.post(environment+"/trade/v1/payment",data=data,headers={'X-QF-APPCODE':app_code,'X-QF-SIGN':make_req_sign(data, key)})

print(r.json())

The above command returns JSON structured like this:

{
"txdtm": "2019-12-25 14:21:28",
"qrcode": "https://qr.alipay.com/bax01781r3pu4fjaqazt4091",
"pay_type": "800101",
"resperr": "success",
"out_trade_no": "01234567890123",
"syssn": "20191225000200020060996533",
"sysdtm": "2019-12-25 14:22:37",
"paydtm": "2019-12-25 14:22:37",
"txcurrcd": "EUR",
"respmsg": "",
"cardcd": "",
"udid": "qiantai2",
"txamt": "10",
"respcd": "0000",
"chnlsn": ""
}

HTTP Request

POST ../trade/v1/payment

Listed below are the most common parameters for the payment endpoint. Please refer to the payment scenario applicable to you for additional parameters.

Public Payment Request Parameters

AttributeMandatoryTypeDescription
txamtYesInt(11)Amount of the transaction. Unit in cents (i.e. 100 = $1)
txcurrcdYesString(3)Transaction currency. View the Currencies table for a complete list of available currencies
pay_typeYesString(6)Please refer to the section Payment Codes for a complete list of payment types
out_trade_noYesString(128)External transaction number / Merchant platform transaction number: This parameter must be unique for each payment and refund request under the same merchant account in the system.
txdtmYesString(20)Transaction time format:
YYYY-MM-DD hh:mm:ss
auth_codeYes
(CPM only)
String(128)Specifies the authorization code for scanning a barcode/QR Code. The auth_code returned is unique in each authorization. Each auth_code can be used only once and will automatically expire in one day. For testing CPM with Alipay and WeChat Pay the auth_code can be extracted with any QRC reader or manually found in the consumer wallet below the barcode.
expired_timeNo
(MPM only)
String(3)QRC expiration time in unit minutes. The default expiration time is 30 minutes. The parameter can manually be adjusted to a minimum of 5 minutes, and up to a maximum of 120 minutes.
Available for:
800201 - WeChat scan code
800101 - Alipay scan code
801512 - Alipay Hong Kong WAP payment
801501 - Alipay Hong Kong scan code
801107 - Alipay overseas WAP payment
801101 - Alipay overseas scan code
801010 - WeChat Hong Kong APP
801510 - Alipay Hong Kong APP
goods_nameNoString(64)Goods Name / Marking: Cannot exceed 20 alphanumeric or contain special characters. Cannot be empty for app payment. Parameter needs to be UTF-8 encoded if it is written in Chinese characters.
mchidNoString(16)May or may not be given to merchant. If MCHID is given, it is mandatory to provide the MCHID .On the contrary, if MCHID is not provided, merchants shall not pass in the MCHID parameter in the API request.
txzoneNoString(5)Transaction Time zone. Default time zone is Beijing time UTC+8 (+0800).
udidNoString(40)Unique transaction device ID displayed on the merchant portal.
notify_urlNoString(256)URL where asynchronous notificiations will be sent to upon payment completion.

Public Payment Response Parameters

AttributeTypeDescription
pay_typeString(6)Please refer to the section Payment Codes for a complete list of payment types
sysdtmString(20)Format:YYYY-MM-DD hh:mm:ss
This parameter value is used as the cut-off time for settlements.
txdtmString(20)Format:YYYY-MM-DD hh:mm:ss
resperrString(128)Request result description
txamtInt(11)Amount of the transaction
respmsgString(128)Supplementary response description
out_trade_noString(128)External transaction number
syssnString(40)QFPay internal transaction number (unique)
chnlsnStringWallet/Channel transaction number
respcdString(4)0000 = Request successful.
1143/1145 = merchants are required to continue to query the transaction result.
All other return codes indicate transaction failure. Please refer to the page Transaction Status Codes for a complete list of response codes.

Transaction Status Codes

Return codeDescription
0000Transaction successful
1100System under maintenance (1100)
1101Reversal error (1101)
1102Duplicate request (1102)
1103Request format error (1103)
1104Request parameter error (1104)
1105Device not activated (1105)
1106Invalid device (1106)
1107Device not allowed (1107)
1108Signature error (1108)
1125Transaction has been refunded already (1125)
1136The transaction does not exist or is not operational (1136)
1142Order already closed (1142)
1143The order has not been paid for, the password is currently being entered (1143)
1145Please wait while processing (1145)
1147Wechat pay transaction error (1147)
1150Your billing method is T0 and does not support canceling transactions. (1150)
1155Refund request denied (1155)
1181Order expired (1181)
1201Insufficient balance, please use a different payment method (1201)
1202Incorrect or expired payment code, please show the correct payment code or refresh the payment code and retry (1202)
1203Merchant account error, confirm that the payment account is configured correctly (1203)
1204Bank error, confirm that the payment wallet is functionable (1204)
1205The transaction failed. Please try again later (1205)
1212Please use the UnionPay overseas payment code (1212)
1241The store does not exist or the status is incorrect. Do not conduct payments (1241)
1242The store has not been configured correctly, unable to conduct payments (1242)
1243The store has been disabled. Do not conduct payments, contact the owner to confirm (1243)
1250The transaction is forbidden. For more information please contact QFPay Customer Service Team (1250)
1251The store has not been configured correctly, we are currently working to fix this problem (1251)
1252System error when making the order request (1252)
1254A problem occured. We are currently resolving the issue (1254)
1260The order has already been paid for, please confirm the transaction result before conducting more transactions (1260)
1261The order has not been paid for, please confirm the transaction result before conducting more transactions (1261)
1262The order has been refunded, please confirm the order status before conducting more transactions (1262)
1263The order has been cancelled, please confirm the order status before conducting more transactions (1263)
1264The order has been closed, please confirm the order status before conducting more transactions (1264)
1265The transaction cannot be refunded. Refunds for transactions between 11:30pm to 0:30am and special promotions cannot be processed. (1265)
1266The transaction amount is wrong, please confirm the order status (1266)
1267The order information does not match, please confirm the order status (1267)
1268The order does not exist, please confirm the order status (1268)
1269Today's unsettled transaction amount is insufficient. Refunds cannot be processed. Please confirm that the balance is sufficient (1269)
1270This currency does not support partial refunds (1270)
1271The selected transaction does not support partial refunds (1271)
1272The refund amount is greater than the maximum amount that can be refunded for the original transaction (1272)
1294The transaction may be non-compliant and has been prohibited by the bank (1294)
1295The connection is slow, waiting for a network response (1295)
1296The connection is slow, waiting for a network response. Please try again later or use other payment methods (1296)
1297The banking system is busy. Please try again later or use other payment methods (1297)
1298The connection is slow, waiting for a network response. In case you have already paid, do not repeat the payment. Please confirm the result later (1298)
2005The customer payment code is incorrect or has expired, please refresh and restart the transaction process (2005)
2011Transaction serial number repeats (2011)