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 | bank payments |
---|---|
Payment instruments | payments cards |
Countries and regions | AE, AG, AT, AU, AZ, BD, BE, BN, BY, CA, CN, DE, ES, FI, FR, GB, GE, HK, HU, ID, IE, IT, JP, KE, KG, KH, KR, KZ, LB, LI, LK, LT, LU, MG, MN, MO, MT, MU, MX, MY, NL, NP, NZ, PA, PF, PH, PT, RU, SC, SG, SI, SK, SR, TH, TJ, TZ, US, VN * |
Payment currencies | AUD, CAD, CHF, CNY, EUR, GBP, HKD, JPY, NZD, SGD, USD, THB * |
Currency conversion | – |
Purchases | + |
Payouts | – |
Stored credentials payments | – |
Full refunds | + |
Partial refunds | + |
Chargebacks | – |
Notes | – |
Onboarding and access fee | Refer to your 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 methods. The full sequence and particularities of the purchase process are provided below.
Figure: Purchase by using Payment Page
- Customer initiates purchase by using the web service.
- The merchant web service sends to the specified ecommpay URL the purchase request for processing the purchase by using Payment Page.
- The payment platform receives the request for processing the purchase by using Payment Page.
- The payment platform performs the initial request processing that involves validation of the required parameters and signature.
- Requested Payment Page is generated into the ecommpay payment platform as specified in the project settings and the request parameters.
- Payment Page is displayed to the customer.
- The customer selects China UnionPay payment method and agrees to use the method (or accepts the method already selected on Payment Page and agrees).
- The payment platform receives the purchase request for payment processing in the China UnionPay service.
- The payment platform performs the internal purchase request processing and sends it to the China UnionPay service.
- The purchase request is processed on the China UnionPay side.
- The China UnionPay service generates the data for redirecting the customer to the China UnionPay service and sends it to the payment platform.
- The payment platform sends to Payment Page the data for redirecting the customer to the China UnionPay service.
- The customer is redirected to the China UnionPay service.
- The customer completes all the payment steps required.
- The payment is processed on the China UnionPay side.
- The result is displayed to the customer.
- The customer is redirected to Payment Page.
- The China UnionPay service sends the result notification to the payment platform.
- The payment platform sends the result to Payment Page.
- The payment platform sends a callback with the payment result to the web service.
- 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:
- 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
- Depending on the payment processing provider it can be necessary to specify the last name of the customer in the customer_last_name parameter (to avoid errors during payment processing it is recommended to set the following value length—from 3 to 100 characters). If the request is missing the parameter, the additional field to input missing data is displayed to the customer on Payment Page. For more details about clarification, see Submission of additional payment information.
- The currency of payment can be one of the following: AUD, CAD, CHF, CNY, EUR, GBP, HKD, JPY, NZD, SGD, USD, THB. Consult with your ecommpay account manager regarding availability of currencies.
- 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. - If you need to have payment form displayed with the China UnionPay method selected, set the force_payment_method parameter to
cup-union
. - If required, you can also add any other additional parameters Payment Page supports.
- 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 and payment IDs, the currency and the amount of a payment, as well as the last name of the customer, as shown in the following example:
{ payment_id: 'X03936', payment_amount: 1000, payment_currency: 'USD', customer_id: '123', project_id: 198, customer_last_name: 'Johnson', signature: "kUi2x9dKHAVNU0FYldJrxh4yo+52Kt8KU+Y1Y4HASCQqtVUkDJrO...==" }
For information about all parameters available in the China UnionPay method, see Parameters for opening payment form.
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:
- Send a request with all the required parameters and signature to the ecommpay URL.
- Perform redirecting customer to the China UnionPay service.
- 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
- Customer initiates purchase on the merchant web service by using China UnionPay method.
- The web service sends the request for processing the purchase by using Gate to the specified ecommpay URL.
- The payment platform receives the request for processing the purchase by using Gate.
- The payment platform performs the initial request processing that includes validation of the required parameters and signature.
- The payment platform sends to the web service response with request receipt confirmation and correctness check result. For more information, see Response format.
- The payment platform performs the internal payment request processing and sends it to the China UnionPay service.
- The purchase request is processed on the China UnionPay side.
- The China UnionPay service generates the data for redirecting the customer to the China UnionPay form and sends it to the payment platform.
- The payment platform sends to the web service the callback that delivers the data for redirecting customer to the China UnionPay service.
- The customer is redirected to the China UnionPay payment form.
- The customer enters card number.
- The payment is processed on the China UnionPay side.
- The China UnionPay service sends the payment result notification to the payment platform.
- The payment platform sends the callback to the web service.
- 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:- You send purchase requests by sending the request by using HTTP method POST to /v2/payment/cup/union/sale.
- 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
- last_name*—last name (to avoid errors during payment processing it is recommended to set the following value length—from 3 to 100 characters). If the parameter is not specified in the request, a callback containing this parameter is sent for additional payment information submission (for more details, see Submission of additional payment information)
- payment—object that contains purchase information:
- amount—purchase amount in minor units
- currency—purchase currency in ISO-4217 alpha-3 format
- Object return_url*—contains the URLs to which customer is redirected during or after payment processing:
- success*—URL for redirecting a customer after a performed purchase
- return*—URL to return customer to the web service during any step before the payment is completed
Note: *Consult with your ecommpay account manager for the detailed information what parameters are required. - general—object that contains general request identification information:
- The currency of payment can be one of the following: AUD, CAD, CHF, CNY, EUR, GBP, HKD, JPY, NZD, SGD, USD, THB. Consult with your ecommpay account manager regarding availability of currencies.
- 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 URLs for redirection and the last name of the customer 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": { "ip_address": "112.65.92.27", "last_name": "Johnson" "id": "123" }, "payment": { "amount": 1000, "currency": "USD" }, "return_url": { "success": "https://example.com/success", "return": "https://example.com/return" } }
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
- A customer orders a refund on the merchant's web service side.
- Merchant's web service sends the request for the refund processing by using Gate to the appropriate ecommpay URL.
- Gate redirects the request to the ecommpay payment platform.
- The payment platform performs all the necessary checks and processes the request.
- The reply with the request processing results is sent to the merchant's web service. For more information, see Response format.
- The payment platform redirects the refund request to the China UnionPay service.
- The payment is processed on the China UnionPay side.
- China UnionPay sends the result notification to the payment platform.
- The payment platform sends a callback with the payment result to the web service.
- 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:- You send payout requests by sending the /v2/payment/unionpay/refund request by using HTTP method POST.
- 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)
- Object general—general refund information:
- 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.