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

UnionPay

Characteristics#


FeatureDetails
Processing currenciesUSD、GBP、EUR、HKD、SGD、CNY
Settlement currenciesUSD
Refunds✓
Partial Refunds✓

Payment process#

1.
The client from PC choosing to pay with unionpay will be redirected to UnionPay payment page
企业微信截图_8909d7b5-1ede-4958-99b3-cc84d71586b2.png
2.
The client from mobile choosing to pay with unionpay will be redirected to UnionPay APP to complete the payment
企业微信截图_83114001-0acb-4d8d-b5bf-628132280a3a.png

Integration Method#

Payment method enumeration values: unionpay
There are two integration methods for UnionPay
1.
Direct API
2.
Checkout

Direct API#

Using unionpay, customers pay by redirecting from your website or app, finish the payment, then return to your website or app where you get immediate notification on whether the payment succeeds or fails.
For direct API intergration, you can create payment intent and get url in only one step, the folllowing is the demo of creating payment intents:

Create a PaymentIntent#

A PaymentIntent is an object that represents your intent to collect payment from your customer and tracks the lifecycle of the payment process. Create a PaymentIntent on your server and specify the amount to collect and a supported currency. If you have an existing Payment Intents integration, add unionpay to the list of payment method types.
Request
{
    "amount":1050,
    "currency":"CNY",
    "confirm":true,
    "payment_method_data" : {
        "type":"unionpay"
    },
    "return_url":"https://your.website"
}
Response
{
    "id": "pi_1646357082686881792",
    "object": "payment_intent",
    "created": 1681357091000,
    "currency": "CNY",
    "amount": 1050,
    "status": "requires_action",
    "livemode": true,
    "client_secret": "pi_1646357082686881792_secret_WrLaoJjPfB9FaWPfaqsxQyPx",
    "next_action": {
        "type": "unionpay_handle_redirect",
        "unionpay_handle_redirect": {
            "url": "https://api.wooshpay.com/v1/receives/paydibs/pay/1646357082686881792"
        }
    },
    "payment_method_types": [
        "unionpay"
    ],
    "confirmation_method": "automatic",
    "return_url": "https://your.website",
    "payment_method": "pm_1646357082556858368",
    "capture_method": "automatic"
}

Checkout#

Create a seesion#

Request
{
    "cancel_url": "www.wooshpay.com",
    "mode": "payment",
    "success_url": "https://wooshpay.com/",
    "payment_method_types": [
        "unionpay"
    ],
    "line_items": [
        {
            "price_data": {
                "currency": "CNY",
                "unit_amount": 100,
                "nickname": "apple",
                "product_data": {
                    "name": "apple"
                },
                "billing_scheme": "testscheme",
                "lookup_key": "test_lookup_key"
            },
            "quantity": 1
        }
    ]
}
Response
{
    "id": "cs_1722490919669727232",
    "object": "checkout.session",
    "created": 1699508812000,
    "livemode": true,
    "currency": "CNY",
    "customer": "",
    "mode": "payment",
    "status": "open",
    "url": "https://checkout.wooshpay.com/pay/cs_1722490919669727232?key=cGtfbGl2ZV9OVEUzTVRZek56STJNVE14TkRVMk9UUXlNRGd4T205dmNVRmFNMGRPVTBSa2VHZzJVbWQ1V1U4MFNUSTJSREUyT1Rnd05UQXdPVFF6TVRn",
    "cancel_url": "www.wooshpay.com",
    "line_items": {
        "object": "list",
        "data": [
            {
                "id": "li_1722490919694893056",
                "object": "item",
                "currency": "CNY",
                "description": "apple",
                "price": {
                    "id": "price_1722490919703281664",
                    "object": "price",
                    "created": 1699508812000,
                    "livemode": true,
                    "active": false,
                    "currency": "CNY",
                    "nickname": "apple",
                    "product": {
                        "id": "prod_1722490919711670272",
                        "object": "product",
                        "created": 1699508812000,
                        "livemode": true,
                        "active": false,
                        "name": "apple",
                        "updated": 1699508812000
                    },
                    "type": "one_time",
                    "unit_amount": 100,
                    "billing_scheme": "per_unit",
                    "lookup_key": "test_lookup_key"
                },
                "quantity": 1,
                "amount_subtotal": 100,
                "amount_total": 100
            }
        ]
    },
    "payment_intent": "pi_1722490922173726720",
    "payment_method_types": [
        "unionpay"
    ],
    "payment_status": "unpaid",
    "success_url": "https://wooshpay.com/",
    "amount_subtotal": 100,
    "amount_total": 100,
    "billing_address_collection": "auto",
    "expires_at": 1699595212242,
    "payment_link": "",
    "client_secret": "pi_1722490922173726720_secret_fCyH13QfV89RRfXYPAVvEUOJ"
}

Next step#

You can add more features to your integration as needed

Create a Webhook#

Listen to events on your WooshPay account so your integration can automatically trigger reactions. Create a webhook that mainly focuses on enabled_events and url.

Create a Refund#

Create a refund to repay funds to your customer. You can also perform partial refunds, but not every payment method supports them. A partial refund is when you refund only part of the original transaction amount.
Modified at 2024-03-11 02:02:48
Previous
ShopeePay
Next
9Pay
Built with