微信支付
了解微信支付,一种受中国客户欢迎的数字钱包.
特点
客户所在地 | 中国消费者 海外华人 中国游客 |
---|---|
用户支付货币 | CNY, GBP, USD, EUR,HKD |
结算给商户货币 | GBP,EUR,USD,HKD |
最小交易 金额 | 没有限制 |
最大交易金额 | 50,000 USD |
退款 | ✅ |
部分退款 | ✅ |
多次部分退款 | ✅ |
争议 | ❌ |
子产品
支付场景 | 产品 | 支付场景描述 |
---|---|---|
QR Code | Web Payment | 在桌面浏览器上,选择微信支付作为支付方式的商家结账后,出现一个二维码。然后购物者打开手机上的微信应用,扫描浏览器页面上显示的条形码,完成支付。 |
QR Code | Quick Pay | 在销售点,商家可以在终端上显示二维码,购物者可以打开手机上的微信应用,扫描二维码完成支付。 |
Mobile H5 Flows | H5 payment | 在手机浏览器上,购物者在商家结账时选择微信支付作为支付方式,并从浏览器转到微信支付应用中完成支付,然后被转回商家浏览器。 |
Mobile - In WeChat app | Official Account 微信公众号 | 通常在更多的中文市场上流行,商家可以考虑在微信社交网站上建立一个个人资料页面,并提示购物者在微信社交网站环境中选择产品并完成付款。 |
Mobile - In WeChat app | Mini Program 小程序 | 小程序是官方账户的另一种变化,它就像微信社交网站中的一个网站,商家可以在这里进行更多的定制,购物者可以在这个环境中选择产品并完成支付。 |
支付流程
QR Code
Mobile H5 Flows
Mobile - In WeChat app
集成方式
wechat_pay
1.
2.
Integration method | Wechat Pay subproduction | terminal_type enumeration values |
---|---|---|
Direct API | Web Payment | WEB |
Direct API | Quick Pay | SCAN_CODE |
Direct API | H5 Payment | WAP |
Direct API | Official Account Payment 微信公众号支付 | OFFICIAL_ACCOUNT |
Direct API 直连
Create a PaymentIntent
1.
2.
3.
4.
Web Payment
{
"amount":20,
"currency":"CNY",
"confirm":true,
"payment_method_options":{
"wechat_pay":{
"terminal_type":"WEB",
"os_type":"IOS",
"client_ip":"192.168.0.1"
}
},
"payment_method_data":{
"type":"wechat_pay"
},
"return_url":"https://wooshpay.com"
}
{
"id": "pi_1666625039547498496",
"object": "payment_intent",
"created": 1686189348000,
"livemode": false,
"currency": "CNY",
"amount": 20,
"status": "requires_action",
"client_secret": "pi_1666625039547498496_secret_qGj2VEg4khXSWkXvRI7Y3yZe",
"next_action": {
"type": "wechat_pay_display_qr_code",
"wechat_pay_display_qr_code": {
"image_data_url": "weixin://wxpay/bizpayurl?pr=lJhTByDzz"
}
},
"payment_method_types": [
"wechat_pay",
],
"confirmation_method": "automatic",
"payment_method_options": {
"wechat_pay": {
"terminal_type": "WEB",
"os_type": "IOS",
"client_ip": "192.168.0.1"
}
},
"return_url": "https://wooshpay.com",
"payment_method": "pm_1666625039430057984",
"capture_method": "automatic"
}
image_data_url
from wechat_pay_display_qr_code
from next_action
can be opened, from the link, the merchant can generate corresponding QR codes. Then use the corresponding QR code to charge.H5 Payment
{
"amount": 20,
"currency": "CNY",
"confirm": true,
"payment_method_options": {
"wechat_pay": {
"terminal_type": "WAP",
"client_ip": "192.168.124.133" //customer's mobile's ip
}
},
"payment_method_data": {
"type": "wechat_pay"
},
"return_url": "yourwebsite"
}
{
"id": "pi_1666625208749916160",
"object": "payment_intent",
"created": 1686189389000,
"livemode": false,
"currency": "CNY",
"amount": 20,
"status": "requires_action",
"client_secret": "pi_1666625208749916160_secret_BeEXcbvAQNUkrV9C6ZFjOamS",
"next_action": {
"type": "wechat_pay_redirect_to_web",
"wechat_pay_redirect_to_web": {
"url": "https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx08095629694611f41b32df91d6ea160000&package=3449031350&redirect_url=https%3A%2F%2Fwooshpay.com"
}
},
"payment_method_types": [
"wechat_pay"
],
"confirmation_method": "automatic",
"payment_method_options": {
"wechat_pay": {
"terminal_type": "WAP",
"os_type": "IOS",
"client_ip": "172.31.5.62"
}
},
"return_url": "https://wooshpay.com",
"payment_method": "pm_1666625208624087040",
"capture_method": "automatic"
}
url
from wechat_pay_redirect_to_web
from next_action
can be opened, from the link, the customer will be direct to the wechat APP for payment, and be direct to return_url
after payment.Quick Pay
{
"amount":10,
"currency":"CNY",
"confirm":true,
"payment_method_options":{
"wechat_pay":{
"terminal_type":"SCAN_CODE",
"os_type":"IOS",
"client_ip":"192.XXX.XX.X"
}
},
"payment_method_data":{
"type":"wechat_pay",
"wechat_pay":{
"payment_code":"XXXXXXXXXX"
}
},
"return_url":"https://yourweb.com"
}
{
"id": "pi_1760544113783996416",
"object": "payment_intent",
"created": 1708581401000,
"livemode": true,
"currency": "CNY",
"amount": 20,
"status": "requires_action",
"description": "test_wechat",
"client_secret": "pi_1760544113783996416_secret_QXXNIYPfHRYjwDoaZ9D9XMTk",
"payment_method_types": [
"wechat_pay"
],
"confirmation_method": "automatic",
"payment_method_options": {
"wechat_pay": {
"terminal_type": "SCAN_CODE",
"client_ip": "192.XXX.XX.X"
}
},
"payment_method": "pm_1760544113712693248",
"capture_method": "automatic"
}
微信公众号支付
{
"amount": 20,
"currency": "CNY",
"confirm": true,
"payment_method_options": {
"wechat_pay": {
"terminal_type": "OFFICIAL_ACCOUNT",
"client_ip": "192.168.0.1",
"openid": ""
}
},
"payment_method_data": {
"type": "wechat_pay"
}
}
{
"id": "pi_1666626536515567616",
"object": "payment_intent",
"created": 1686189705000,
"livemode": false,
"currency": "CNY",
"amount": 20,
"status": "requires_action",
"client_secret": "pi_1666626536515567616_secret_CcrukFKgxbPp7UEAxodLlNRD",
"next_action":{
"wechat_pay_official_account_params":{
"appId":"XXXX",
"timeStamp":"XXXX",
"nonceStr":"XXXX",
"signType":"XXXX",
"paySign":"XXXX",
"package":"XXXX"
}
},
"payment_method_types": [
"wechat_pay"
],
"confirmation_method": "automatic",
"payment_method_options": {
"wechat_pay": {
"openid": "",
"terminal_type": "OFFICIAL_ACCOUNT",
"client_ip": "192.168.0.1"
}
},
"payment_method": "pm_1666626536389738496",
"capture_method": "automatic"
}
next_action
中的wechat_pay_official_account_params
包含一些你需要在前端使用的参数。下面是一个关于如何使用这些参数的例子。js example
下一步
Create a Webhook
Create a Refund
Modified at 2024-03-11 02:03:13