China UnionPay

Overview

China UnionPay is a payment method that uses the online banking mechanism for purchases and refunds processing in China by using bank cards. You can perform purchases through this method by using Payment Page and Gate, refunds by using Gate.

General information

Payment method type Online banking
Countries and regions China
Payment currencies SGD, USD, CNY, HKD, THB *
Currency conversion
Purchases +
Payouts
Stored credentials payments
Full refunds +
Partial refunds +
Chargebacks
Notes We recommend that you perform all operations by using Internet Explorer; other browsers do not fully support payments via China UnionPay.
Onboarding and access fee Refer to your ECommPay key account manager
Note: *For information about supported currencies refer to the ECommPay key account manager.

Interaction diagram

Payment processing by using the China UnionPay payment method requires merchant's web service, one of ECommPay interfaces, and the ECommPay payment platform, as well as the China UnionPay service.



Operations support

  Interfaces Amounts
Payment Page CMS Plug-ins Gate Dashboard minimum maximum
Purchases + +
Full refunds +
Partial refunds +

Processing scenarios

In the China UnionPay method, to perform a purchase operation, you need to redirect a customer to the China UnionPay service, while to initiate a refund, you need to receive a request from a customer via your web service.

Figure: Purchase by using Payment Page



Figure: Purchase by using Gate



Figure: Refund by using Gate



The sections that follow provide detailed information about what you need to perform payments and how you can analyse the information on payments and operations.

Purchase by using Payment Page

General information

In the China UnionPay method, any purchase follows the usual procedure which is common to Payment Page: merchant's web service sends a request with all the required parameters and signature to ECommPay URL, Payment Page accepts the request and then redirects it to the payment platform for further processing. When opening payment form, you can either allow your customer to select the China UnionPay method from the list of other payment methods on payment form or have the payment form opened with the China UnionPay method selected. For more information about preselecting payment methods, see in Preselecting payment method. The full sequence and particularities of the purchase process are provided below.



Figure: Purchase by using Payment Page

  1. Customer initiates purchase by using the web service.
  2. The merchant web service sends to the specified ECommPay URL the purchase request for processing the purchase by using Payment Page.
  3. The payment platform receives the request for processing the purchase by using Payment Page.
  4. The payment platform performs the initial request processing that involves validation of the required parameters and signature.
  5. Requested Payment Page is generated into the ECommPay payment platform as specified in the project settings and the request parameters.
  6. Payment Page is displayed to the customer.
  7. The customer selects China UnionPay payment method and agrees to use the method (or accepts the method already selected on Payment Page and agrees).
  8. The payment platform receives the purchase request for payment processing in the China UnionPay service.
  9. The payment platform performs the internal purchase request processing and sends it to the China UnionPay service.
  10. The purchase request is processed on the China UnionPay side.
  11. The China UnionPay service generates the data for redirecting the customer to the China UnionPay service and sends it to the payment platform.
  12. The payment platform sends to Payment Page the data for redirecting the customer to the China UnionPay service.
  13. The customer is redirected to the China UnionPay service.
  14. The customer completes all the payment steps required.
  15. The payment is processed on the China UnionPay side.
  16. The result is displayed to the customer.
  17. The customer is redirected to Payment Page.
  18. The China UnionPay service sends the result notification to the payment platform.
  19. The payment platform sends the result to Payment Page.
  20. The payment platform sends a callback with the payment result to the web service.
  21. A page with the payment result information is displayed to the customer on Payment Page.

The sections that follow discuss in more details the request format and the Payment Page parameters to use in the China UnionPay payment method and provide the information on the format of callbacks with payment results. For the general information on how to use the API, see Payment Page API Description.

Request format

There are several things you need to consider when using the China UnionPay method:

  1. You must provide values for the basic minimum of parameters. Listed below are the parameters that are mandatory for any payment method:
    • customer_id—the unique ID of the customer within your project
    • project_id—the project ID obtained from ECommPay
    • payment_id—payment ID unique within the project
    • payment_currency—payment currency in ISO-4217 alpha-3 format
    • payment_amount—payment amount in minor units
  2. The currency of payment can be one of the following: CNY, HKD, SGD THB or USD. Consult with your ECommPay account manager regarding availability of currencies.
  3. To open Payment Page in the language of the bank group, pass the zh code in the language_code parameter in the request for opening. For more information, see Interface language support.
  4. If you need to have payment form displayed with the China UnionPay method selected, set the force_payment_method parameter to cup-union.
  5. If required, you can also add any other additional parameters Payment Page supports.
  6. After you specify all the parameters you need, you must create the signature for the request. For instructions on how to sign a payment request, see Signature generation and verification.

Thus, a correct payment request in the China UnionPay method must include project, customer and payment IDs, language code, the currency and the amount of a payment in the appropriate currency, as shown in the following example:

EPayWidget.run(
    { payment_id: 'X03936', 
      payment_amount: 1000, 
      payment_currency: 'USD',
      customer_id: '123', 
      project_id: 198,
      signature: "kUi2x9dKHAVNU0FYldJrxh4yo+52Kt8KU+Y1Y4HASCQqtVUkDJrO...=="
    }
)

For information about all parameters available in the China UnionPay method, see Payment Page invocation parameters.

Callback format

The China UnionPay method uses the standard format for callbacks to deliver purchase results. For more information, see Callbacks.

The following is the example of a callback with an information about successful 10.00 USD purchase made in the 198 project.

Figure: Example of a successful purchase callback

"callbackBody": {
        "project_id": 198,
        "payment": {
            "id": "TEST_154402240162030",
            "type": "purchase",
            "status": "success",
            "date": "2018-12-06T13:33:33+0000",
            "method": "unionpay",
            "sum": {
                "amount": 100,
                "currency": "USD"
            },
            "description": "TEST_154402240162930"
        },
        "operation": {
            "id": 7458000002161,
            "type": "sale",
            "status": "success",
            "date": "2018-12-06T13:33:33+0000",
            "created_date": "2018-12-06T13:31:41+0000",
            "request_id": "986be38f02e8fe3fb8-c1990f3e7af3",
            "sum_initial": {
                "amount": 100,
                "currency": "USD"
            },
            "sum_converted": {
                "amount": 100,
                "currency": "USD"
            },
            "provider": {
                "id": 410,
                "payment_id": "74580000021610207055371314024366",
                "date": "2018-12-06T13:31:42+0000",
                "auth_code": ""
            },
            "code": "0",
            "message": "Success"
        },
        "signature": "lci0uOA7aWgJ5nwyImqQjXAfdP+nEzyXwb/t9G1E1U8+5vDkdb...=="
    }

The following is the example of a callback for a declined purchase.

Figure: Example of a declined purchase callback

"callbackBody": {
        "project_id": 198,
        "payment": {
            "id": "TEST_1548340290097231",
            "type": "purchase",
            "status": "decline",
            "date": "2019-01-26T14:36:35+0000",
            "method": "unionpay",
            "sum": {
                "amount": 2000000,
                "currency": "CNY"
            },
            "description": "TEST_1548340290097"
        },
        "customer": {
            "id": "1"
        },
        "operation": {
            "id": 4723000002794,
            "type": "sale",
            "status": "decline",
            "date": "2019-01-26T14:36:35+0000",
            "created_date": "2019-01-24T14:36:33+0000",
            "request_id": "72b28ec3f95271699dcade",
            "sum_initial": {
                "amount": 2000000,
                "currency": "CNY"
            },
            "sum_converted": {
                "amount": 294684,
                "currency": "USD"
            },
            "provider": {
                "id": 410,
                "payment_id": "47230000027940105280386327826886",
                "date": "2019-01-24T14:36:35+0000",
                "auth_code": ""
            },
            "code": "20000",
            "message": "General decline"
        },
        "signature": "vOpSHO5fMolQhUGItTilgFKcVkbdmBMaf2cD7FsIB...=="
    }

Related topics

The following topics might be useful when implementing payments through Payment Page:

Purchase by using Gate

General information

In the China UnionPay methods, when processing a purchase by using Gate, the merchant web service is required to do the following:

  1. Send a request with all the required parameters and signature to the ECommPay URL.
  2. Perform redirecting customer to the China UnionPay service.
  3. Get the callback with the payment result from the payment platform.

The following diagram provides the detailed picture of the payment processing procedure.



Figure: Purchase by using Gate

  1. Customer initiates purchase on the merchant web service by using China UnionPay method.
  2. The web service sends the request for processing the purchase by using Gate to the specified ECommPay URL.
  3. The payment platform receives the request for processing the purchase by using Gate.
  4. The payment platform performs the initial request processing that includes validation of the required parameters and signature.
  5. The payment platform sends to the web service response with request receipt confirmation and correctness check result. For more information, see Response format.
  6. The payment platform performs the internal payment request processing and sends it to the China UnionPay service.
  7. The purchase request is processed on the China UnionPay side.
  8. The China UnionPay service generates the data for redirecting the customer to the China UnionPay form and sends it to the payment platform.
  9. The payment platform sends to the web service the callback that delivers the data for redirecting customer to the China UnionPay service.
  10. The customer is redirected to the China UnionPay payment form.
  11. The customer enters card number.
  12. The payment is processed on the China UnionPay side.
  13. The China UnionPay service sends the payment result notification to the payment platform.
  14. The payment platform sends the callback to the web service.
  15. The customer receives the payment result from the web service.

The sections that follow discuss in more details the request format and the Gate parameters to use in the China UnionPay payment method and provide the information on the format of callbacks with purchase results.

Request format

There are several things you must consider when using purchase requests in the China UnionPay method:
  1. You send purchase requests by sending the request by using HTTP method POST to /v2/payment/cup/union/sale.
  2. The following objects and parameters must be specified in any request:
    • general—object that contains general request identification information:
      • project_id—the project ID obtained from ECommPay
      • payment_id—payment ID unique within the project
      • signature—signature created after you specify all the required parameters. For more information about signature generation, see Signature generation and verification.
    • customer—object that contains customer information:
      • id—the unique ID of the customer within your project
      • ip_address—customer IP address
    • payment—object that contains purchase information:
      • amount—purchase amount in minor units
      • description*—payment description
      • currency—purchase currency in ISO-4217 alpha-3 format
    • Object return_url*—URL for redirecting a customer from the bank website:
      • success*—URL for redirecting a customer after a performed purchase
    Note: *Consult with your ECommPay account manager for the detailed information what parameters are required.
  3. The currency of payment can be one of the following: CNY, HKD, SGD THB or USD. Consult with your ECommPay account manager regarding availability of currencies.
  4. If required, you can also add any other additional parameters Gate supports.

Thus, a correct payment request in the China UnionPay method must include general information about request and information about payment and customer. The method may also require a URL for redirection as shown in the following example. For details, refer to your ECommPay account manager.

Figure: Example of a purchase request

{
  "general": {
    "project_id": 198,
    "payment_id": "TEST_15532590003171111",
    "signature": "dMNfpKk0MnZhXWKjAKWTckxgEoNbjNhOYQMh6lB4C9J7gksH...=="
  },
  "customer": {
    "id": "123",
    "ip_address": "112.65.92.27"
  },
  "payment": {
    "amount": 1000,
    "description": "test payment",
    "currency": "USD"
  },
  "return_url": {
    "success": "https://example.com"
  }
}

Formats of the customer redirection data

To redirect a customer from the web service to the China UnionPay service, you must receive a callback from the payment platform containing the URL for redirection in the redirect_data.url parameter and data to be sent in the request body in the redirect_data.body parameter, and use these parameters when opening the HTML page using method specified in the redirect_data.method parameter.

The following is the callback fragment containing the URL for redirection.

redirect_data": {
                    "body": [],
                    "method": "GET",
                    "url": "https://secure.com/service/payment/000c33951a400c665596bc2b39"
                }

Callback format

The China UnionPay method uses the standard format for callbacks to deliver purchase results. For more information, see Callbacks.

The following is the example of a callback with an information about successful 10.00 USD purchase made in the 198 project.

Figure: Example of a successful purchase callback

"callbackBody": {
        "project_id": 198,
        "payment": {
            "id": "TEST_154402240162030",
            "type": "purchase",
            "status": "success",
            "date": "2018-12-06T13:33:33+0000",
            "method": "unionpay",
            "sum": {
                "amount": 100,
                "currency": "USD"
            },
            "description": "TEST_154402240162930"
        },
        "operation": {
            "id": 7458000002161,
            "type": "sale",
            "status": "success",
            "date": "2018-12-06T13:33:33+0000",
            "created_date": "2018-12-06T13:31:41+0000",
            "request_id": "986be38f02e8fe3fb8-c1990f3e7af3",
            "sum_initial": {
                "amount": 100,
                "currency": "USD"
            },
            "sum_converted": {
                "amount": 100,
                "currency": "USD"
            },
            "provider": {
                "id": 410,
                "payment_id": "74580000021610207055371314024366",
                "date": "2018-12-06T13:31:42+0000",
                "auth_code": ""
            },
            "code": "0",
            "message": "Success"
        },
        "signature": "lci0uOA7aWgJ5nwyImqQjXAfdP+nEzyXwb/t9G1E1U8+5vDkdb...=="
    }

The following is the example of a callback for a declined purchase.

Figure: Example of a declined purchase callback

"callbackBody": {
        "project_id": 198,
        "payment": {
            "id": "TEST_1548340290097231",
            "type": "purchase",
            "status": "decline",
            "date": "2019-01-26T14:36:35+0000",
            "method": "unionpay",
            "sum": {
                "amount": 2000000,
                "currency": "CNY"
            },
            "description": "TEST_1548340290097"
        },
        "customer": {
            "id": "1"
        },
        "operation": {
            "id": 4723000002794,
            "type": "sale",
            "status": "decline",
            "date": "2019-01-26T14:36:35+0000",
            "created_date": "2019-01-24T14:36:33+0000",
            "request_id": "72b28ec3f95271699dcade",
            "sum_initial": {
                "amount": 2000000,
                "currency": "CNY"
            },
            "sum_converted": {
                "amount": 294684,
                "currency": "USD"
            },
            "provider": {
                "id": 410,
                "payment_id": "47230000027940105280386327826886",
                "date": "2019-01-24T14:36:35+0000",
                "auth_code": ""
            },
            "code": "20000",
            "message": "General decline"
        },
        "signature": "vOpSHO5fMolQhUGItTilgFKcVkbdmBMaf2cD7FsIB...=="
    }

Related topics

The following topics might be useful when implementing payments through Gate:

Refund by using Gate

General information

China UnionPay supports full and partial refunds processing. However, for one payment you can perform only one partial refund, then to make additional refunds for this payment you need to contact the technical support of the payment system.

In the China UnionPay method, any refund follows the usual procedure which is common to Gate: merchant's web service sends a request with all the required parameters and signature to ECommPay URL, Gate accepts the request and redirects to the payment platform for further processing. The full sequence of the payout process is provided below.



Figure: Refund by using Gate

  1. A customer orders a refund on the merchant's web service side.
  2. Merchant's web service sends the request for the refund processing by using Gate to the appropriate ECommPay URL.
  3. Gate redirects the request to the ECommPay payment platform.
  4. The payment platform performs all the necessary checks and processes the request.
  5. The reply with the request processing results is sent to the merchant's web service. For more information, see Response format.
  6. The payment platform redirects the refund request to the China UnionPay service.
  7. The payment is processed on the China UnionPay side.
  8. China UnionPay sends the result notification to the payment platform.
  9. The payment platform sends a callback with the payment result to the web service.
  10. The customer receives the refund result from the web service.

The sections that follow discuss in more details the request format and the Gate parameters to use in the China UnionPay payment method and provide the information on the format of callbacks with refund results.

Request format

There are several things you must consider when using refund requests in the China UnionPay method:
  1. You send payout requests by sending the /v2/payment/unionpay/refund request by using HTTP method POST.
  2. The following objects and parameters must be specified in any request:
    • Object general—general refund information:
      • project_id—project identifier
      • payment_id—unique refund identifier
      • signature—signature created after you specify all the required parameters. For more information about signature generation, see Signature generation and verification
    • Object customer—customer information:
      • ip_address—customer IP address
    • Object payment—refund information:
      • description—comment or description
      • amount—refund amount in minor units (mandatory for partial refund only)
      • currency—refund currency in ISO-4217 alpha-3 format (mandatory for partial refund only)
  3. If required, you can also add any other additional parameters Gate supports.

Thus, a correct refund request in the China UnionPay method must include project and payment IDs, customer IP address, currency and amount of the refund, as shown in the following example:

Figure: Example of a refund request

{
"general": {
            "project_id": 198,
            "payment_id": "TEST_111"
            },
"payment": {
            "amount": 500,
            "currency": "USD",
            "description": "test"
            }
}

Callback format

The China UnionPay method uses the standard format for callbacks to deliver refund results. For more information, see Callbacks.

The following is the example of a callback with an information about successful 10.00 USD refund for the customer in the 198 project.

Figure: Example of a successful refund callback

"callbackBody": {
        "project_id": 198,
        "payment": {
            "id": "TEST_154402240162030",
            "type": "purchase",
            "status": "refunded",
            "date": "2018-12-06T14:24:08+0000",
            "method": "unionpay",
            "sum": {
                "amount": 1000,
                "currency": "USD"
            },
            "description": "TEST_154402240162930"
        },
        "operation": {
            "id": 7458000002162,
            "type": "refund",
            "status": "success",
            "date": "2018-12-06T14:24:08+0000",
            "created_date": "2018-12-06T14:23:58+0000",
            "request_id": "758cf8a4a495acf7f27eb0c1b",
            "sum_initial": {
                "amount": 1000,
                "currency": "USD"
            },
            "sum_converted": {
                "amount": 1000,
                "currency": "USD"
            },
            "provider": {
                "id": 410,
                "payment_id": "",
                "date": "2018-12-06T22:24:04+0000",
                "auth_code": ""
            },
            "code": "0",
            "message": "Success"
        },
        "signature": "pHyB8h89qctuJ3ksW9xsERYpVSi3SDWAAWnknJw4o9f...=="
    }

The following is the example of a callback for a refund declined due to business rules failure.

Figure: Example of a declined refund callback

  "callbackBody": {
        "project_id": 198,
        "payment": {
            "id": "TEST_1542789072282111",
            "type": "purchase",
            "status": "partially refunded",
            "date": "2018-11-21T12:33:38+0000",
            "method": "unionpay",
            "sum": {
                "amount": 50,
                "currency": "USD"
            },
            "description": "TEST_1542789072282"
        },
        "customer": {
            "id": "1"
        },
        "errors": [
            {
                "code": "2701",
                "message": "Rules Failed Code",
                "description": "fatal: RULES_FAILED_CODE"
            }
        ],
        "operation": {
            "id": 16115000001979,
            "type": "refund",
            "status": "decline",
            "date": "2018-11-21T12:49:38+0000",
            "created_date": "2018-11-21T12:49:38+0000",
            "request_id": "3abc68c33b2298127",
            "sum_initial": {
                "amount": 50,
                "currency": "USD"
            },
            "sum_converted": {
                "amount": 50,
                "currency": "USD"
            },
            "provider": {
                "id": 410,
                "payment_id": ""
            },
            "code": "2701",
            "message": "Rules Failed Code"
        },
        "signature": "hAS3NXs1LmLl0xYtaHqLrRCAANBq1Z+/g26NVka...=="
    }

Related topics

The following topics might be useful when implementing payments through Gate:

Analysis of payments results

As with other payment methods ECommPay offers, when using the China UnionPay method, you have several options to analyse the information about payments and operations performed by using the method—alone or in conjunction with other methods.

You can load and analyse all the necessary information in Dashboard, for instance you can use the analytic panels on the Analytics tab to this end.

Also, you can export the information for further analysis by using third party analytical tools. The following options are available:

  • Dashboard allows you to download reports in CSV and XLS formats—by using the tools on the Payments tab. You can perform export as a one-time download to your local computer or have payment data regularly exported and delivered to email addresses you specify.
  • Data API allows you to have payment information exported in JSON format and delivered to a URL you specify. The payment information is exported by using the /operations/get queries.

If you have any further questions regarding payment data analysis, contact ECommPay technical support.