QFPay API is a comprehensive payment solution that offers various payment methods to meet the needs of different businesses. This skill provides complete API integration guidelines including environment configuration, request formats, signature generation, payment types, supported currencies, and status codes.
SKILL.md
QFPay Payment API Skill
Overview
QFPay API is a comprehensive payment solution that offers various payment methods to meet the needs of different businesses. This skill provides complete API integration guidelines including environment configuration, request formats, signature generation, payment types, supported currencies, and status codes.
Environment Configuration
QFPay API is accessible via three main environments:
Environment
Base URL
Description
Sandbox
https://openapi-int.qfapi.com
For simulating payments without real fund deduction
Testing
https://test-openapi-hk.qfapi.com
Real payment flow but linked to test accounts (no settlement)
Production
https://openapi-hk.qfapi.com
Real live payments with actual settlement
Important Notes:
Transactions in Testing environment using test accounts will NOT be settled
Always ensure refunds are triggered immediately for test transactions
Mixing credentials or endpoints across environments will result in signature or authorization errors
Environment Variables Setup
Configure these environment variables before using the API:
Double-check parameter order and encoding if signature fails
Code Examples
Python
import os
import hashlib
APPCODE = os.getenv('QFPAY_APPCODE')
KEY = os.getenv('QFPAY_KEY')
def generate_signature(params, key):
"""Generate MD5 signature"""
keys = list(params.keys())
keys.sort()
query = []
for k in keys:
if k not in ('sign', 'sign_type') and (params[k] or params[k] == 0):
query.append(f'{k}={params[k]}')
data = '&'.join(query) + key
md5 = hashlib.md5()
md5.update(data.encode('utf-8'))
return md5.hexdigest().upper()
def generate_signature_sha256(params, key):
"""Generate SHA256 signature"""
keys = list(params.keys())
keys.sort()
query = []
for k in keys:
if k not in ('sign', 'sign_type') and (params[k] or params[k] == 0):
query.append(f'{k}={params[k]}')
data = '&'.join(query) + key
sha256 = hashlib.sha256()
sha256.update(data.encode('utf-8'))
return sha256.hexdigest().upper()
Payment Types
The pay_type parameter specifies which payment method to use. This affects transaction routing and UI requirements.
Note: Not all pay_type values are enabled for every merchant. Contact [email protected] for clarification.
Supported Payment Types
Code
Description
800008
CPM for WeChat, Alipay, UnionPay QuickPass, PayMe
800101
Alipay MPM (Overseas Merchants)
800108
Alipay CPM (Overseas & HK Merchants)
801101
Alipay Web Payment (Overseas)
801107
Alipay WAP Payment (Overseas)
801110
Alipay In-App Payment (Overseas)
800107
Alipay Service Window H5 Payment
801501
Alipay MPM (HK Merchants)
801510
Alipay In-App (HK Merchants)
801512
Alipay WAP (HK Merchants)
801514
Alipay Web (HK Merchants)
800201
WeChat MPM (Overseas & HK)
800208
WeChat CPM (Overseas & HK)
800207
WeChat JSAPI Payment (Overseas & HK)
800212
WeChat H5 Payment
800210
WeChat In-App Payment (Overseas & HK)
800213
WeChat Mini-Program Payment
801008
WeChat Pay HK CPM (Direct Settlement, HK)
801010
WeChat Pay HK In-App (Direct Settlement, HK)
805801
PayMe MPM (HK Merchants)
805808
PayMe CPM (HK Merchants)
805814
PayMe Web Payment (HK Merchants)
805812
PayMe WAP Payment (HK Merchants)
800701
UnionPay QuickPass MPM
800708
UnionPay QuickPass CPM
800712
UnionPay WAP Payment (HK)
800714
UnionPay PC-Web Payment (HK)
802001
FPS MPM (HK Merchants)
803701
Octopus MPM (HK Merchants)
803712
Octopus WAP Payment (HK)
803714
Octopus PC-Web Payment (HK)
802801
Visa / Mastercard Online
802808
Visa / Mastercard Offline
806527
ApplePay Online
806708
UnionPay Card Offline
806808
American Express Card Offline
Special Remarks
801101: Transaction amount must be greater than 1 HKD
802001: This payment method does not support refunds
Supported Currencies
All codes follow ISO 4217 format (3-letter uppercase):
Code
Description
AED
Arab Emirates Dirham
CNY
Chinese Yuan
EUR
Euro
HKD
Hong Kong Dollar
IDR
Indonesian Rupiah
JPY
Japanese Yen
MMK
Myanmar Kyat
MYR
Malaysian Ringgit
SGD
Singapore Dollar
THB
Thai Baht
USD
United States Dollar
CAD
Canadian Dollar
AUD
Australian Dollar
Note: Some payment methods may only support HKD. Verify with your integration manager before non-HKD transactions.
Status Codes
Standard respcd values returned by QFPay API:
Code
Description
0000
Transaction successful
1100
System under maintenance
1101
Reversal error
1102
Duplicate request
1103
Request format error
1104
Request parameter error
1105
Device not activated
1106
Invalid device
1107
Device not allowed
1108
Signature error
1125
Transaction already refunded
1136
Transaction does not exist or not operational
1142
Order already closed
1143
Order not paid, password being entered
1145
Processing, please wait
1147
WeChat Pay transaction error
1150
T0 billing method does not support cancellation
1155
Refund request denied
1181
Order expired
1201
Insufficient balance
1202
Incorrect or expired payment code
1203
Merchant account error
1204
Bank error
1205
Transaction failed, try again later
1212
Please use UnionPay overseas payment code
1241
Store does not exist or status incorrect
1242
Store not configured correctly
1243
Store has been disabled
1250
Transaction forbidden
1251
Store configuration error
1252
System error making order request
1254
Problem occurred, resolving issue
1260
Order already paid
1261
Order not paid
1262
Order already refunded
1263
Order already cancelled
1264
Order already closed
1265
Transaction cannot be refunded (11:30pm-0:30am)
1266
Transaction amount wrong
1267
Order information mismatch
1268
Order does not exist
1269
Insufficient unsettled balance for refund
1270
Currency does not support partial refund
1271
Transaction does not support partial refund
1272
Refund amount exceeds maximum refundable
1294
Transaction non-compliant, prohibited by bank
1295
Connection slow, waiting for network response
1296
Connection slow, try again later
1297
Banking system busy
1298
Connection slow, do not repeat payment if already paid