WooshPay OpenAPI
Product DocumentAPI ReferenceJS SDK ReferenceSaaS Platform Integration
Product DocumentAPI ReferenceJS SDK ReferenceSaaS Platform Integration
Back to WooshPay Website
  1. Wallets
  • Online payments
    • Quick Start
    • Integration overview
    • Wooshpay JS SDK
    • Wooshpay Checkout
    • Wooshpay Direct API
    • Payment Link
    • Authorize and capture
    • Build subscriptions integration
    • Testing cards
  • After the payment
    • Payouts
    • Webhook
    • Check the webhook signatures
    • 校验webhook签名
  • Add more payment methods
    • Supported payment method
    • Cards
    • Wallets
      • Alipay
      • Alipay HK
      • Apple Pay
      • Google Pay
      • Wechat Pay
      • 微信支付
      • Kakao Pay
      • DANA
      • Boost
      • Grabpay
      • Mcash
      • Touch'n Go
      • ShopeePay
      • UnionPay
      • 9Pay
      • OVO
      • GCash
      • TrueMoney
    • Bank redirects
      • Bancontact
      • BPI
      • Trustly
      • EPS
      • Giropay
      • iDEAL
      • Przelewy24
      • FPX
    • Buy Now Pay Later
      • Klarna
    • Bank Debits
      • Sepa Direct Debit
    • Bank Transfer
      • Bank Transfer in Europe
      • Bank Transfer in United Kingdom
      • Bank Transfer in Indonesia
    • QR Payments
      • QRIS
      • PromptPay
    • Real-time payments
      • PIX
      • PayNow
      • UPI
      • SPEI
  • More payment scenarios
    • Set up future payments
    • Save payment method during payment
  • SaaS platform integration
    • Shopify Plugin
    • Shopastro 星盘
    • WooCommerce
    • Shoplazza 店匠
    • Shopline Plugin
    • Sage Connection
  • Resources
    • Supported currencies
  1. Wallets

微信支付

了解微信支付,一种受中国客户欢迎的数字钱包.#

微信支付作为一个数字钱包,被整合到流行的中国超级应用--微信中。多年来,作为寻求与中国消费者建立联系的企业在国内和国际上的一个重要支付解决方案,它已经获得了显著的地位。微信已经转变为一个全面的生态系统,为中国购物者提供了聊天、浏览产品或服务的便利,并在一个统一的平台上进行无缝支付。这种整合使购物体验就像与同伴进行友好交谈一样毫不费力,而且都在一个地方。

特点#

客户所在地中国消费者
海外华人
中国游客
用户支付货币CNY, GBP, USD, EUR,HKD
结算给商户货币GBP,EUR,USD,HKD
最小交易金额没有限制
最大交易金额50,000 USD
退款✅
部分退款✅
多次部分退款✅
争议❌

子产品#

支付场景产品支付场景描述
QR CodeWeb Payment在桌面浏览器上,选择微信支付作为支付方式的商家结账后,出现一个二维码。然后购物者打开手机上的微信应用,扫描浏览器页面上显示的条形码,完成支付。
QR CodeQuick Pay在销售点,商家可以在终端上显示二维码,购物者可以打开手机上的微信应用,扫描二维码完成支付。
Mobile H5 FlowsH5 payment在手机浏览器上,购物者在商家结账时选择微信支付作为支付方式,并从浏览器转到微信支付应用中完成支付,然后被转回商家浏览器。
Mobile - In WeChat appOfficial Account 微信公众号通常在更多的中文市场上流行,商家可以考虑在微信社交网站上建立一个个人资料页面,并提示购物者在微信社交网站环境中选择产品并完成付款。
Mobile - In WeChat appMini Program 小程序小程序是官方账户的另一种变化,它就像微信社交网站中的一个网站,商家可以在这里进行更多的定制,购物者可以在这个环境中选择产品并完成支付。

支付流程#

QR Code#

pic_QR Code.png

Mobile H5 Flows#

pic_Mobile H5 Flows.png

Mobile - In WeChat app#

pic_Mobile - In WeChat app.png

集成方式#

Payment method enumeration values: wechat_pay
微信支付有两种对接方式
1.
Direct API 直连
2.
Checkout 收银台
Integration methodWechat Pay subproductionterminal_type enumeration values
Direct APIWeb PaymentWEB
Direct APIQuick PaySCAN_CODE
Direct APIH5 PaymentWAP
Direct APIOfficial Account Payment 微信公众号支付OFFICIAL_ACCOUNT
|

Direct API 直连#

PaymentIntent是一个对象,代表了你向客户收款的意图,并跟踪付款过程的生命周期。在你的服务器上创建一个PaymentIntent,并指定要收取的金额和支持的货币。

Create a PaymentIntent#

对于直接的API集成,你可以创建PaymentIntent并在一个步骤中获得url。以下是创建付款意向的演示:
1.
Web Payment
2.
H5 Payment
3.
Quick Pay
4.
Official Account Payment

Web Payment#

Request
{
    "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"
}
Response
{
    "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"
}
The 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#

Request
{
    "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"    
}
Response
{
    "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"
}
The 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#

Request
{
    "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"
}
Response
{
    "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"
}
The password-free payment can be paid directly, otherwise the customer needs to enter the password, fingerprint, etc. on the mobile phone to pay.

微信公众号支付#

Request
{
    "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"
    }
}
Response
{
    "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

下一步#

You can add more features to your integration as needed

Create a Webhook#

听取你的WooshPay账户上的事件,这样你的集成可以自动触发反应。创建一个webhook,主要关注 enabled_events和url。

Create a Refund#

创建一个退款,将资金偿还给你的客户。你也可以执行部分退款,但不是每一种支付方式都支持。部分退款是指你只退还原始交易金额的一部分。
Modified at 2024-03-11 02:03:13
Previous
Wechat Pay
Next
Kakao Pay
Built with