CUP QR

Overview

Introduction

CUP QR is a payment method which allows to process payments in Chinese yuan by using bank accounts in China. This method supports purchases.

This article provides information about working with the CUP QR method: general insights are presented in the Overview section, while information about the actions required to process payments and perform other actions is presented in the sections that follow.

General information

Payment method type QR code payments
Payment instruments bank accounts
Countries and regions CH
Payment currencies CNY
Currency conversion
One-time purchases +
Credential-on-file purchases
Full refunds
Partial refunds
Payouts
Chargebacks
Notes
Onboarding and access fee refer to your ecommpay key account manager

Interaction diagram

Payment processing by using the CUP QR method involves the merchant's web service, one of ecommpay interfaces, the ecommpay payment platform, and technical facilities of the CUP QR service.



Operations support

Various platform interfaces can be used to process payments and perform operations using the CUP QR method. Purchases can be processed by using Payment Page, Gate and Dashboard (using payment links).

Processing scenarios

To perform a purchase by using the CUP QR method, the customer needs to scan QR code by using a mobile banking application.

Purchases by using Payment Page

General information

To process a purchase through Payment Page by using the CUP QR method, the merchant's web service is required to send a request with all required parameters and signature to the ecommpay URL and receive a callback with the result. The full sequence and special aspects of purchase processing are provided below.



Figure: Purchase processing by using Payment Page: step-by-step description

  1. A customer initiates a purchase in the web service.
  2. The web service sends the request for opening Payment Page to the specified ecommpay URL.
  3. The request for opening Payment Page is sent to the payment platform.
  4. The payment platform receives the request and validates the required parameters and signature.
  5. Payment Page is generated based on the project and request parameters.
  6. Payment Page is displayed to the customer.
  7. The customer selects the CUP QR method.
  8. The list of supported banks is displayed to the customer on the Payment Page.
  9. The customer selects a bank.
  10. The payment platform receives the request for processing the payment by using the CUP QR method.
  11. The payment platform processes the request and sends it to the CUP QR service.
  12. The request is processed on the CUP QR service side.
  13. The data for displaying the QR code to the customer is sent from the CUP QR service to the payment platform.
  14. The data for displaying the QR code to the customer is sent from the payment platform to Payment Page.
  15. The QR code is displayed to the customer on Payment Page.
  16. The customer scans QR code by using mobile application and completes all the required steps.
  17. The purchase is processed in the CUP QR service.
  18. The CUP QR service sends email with the payment result to the customer.
  19. The CUP QR service sends a notification about the result to the payment platform.
  20. The payment platform sends the payment result callback to the web service.
  21. The payment platform sends the result information to Payment Page.
  22. The result information is displayed to the customer on Payment Page.

Information about the formats of requests and callbacks used for processing payments by using the CUP QR method via Payment Page is presented further in this section; general information about working with the Payment Page API is presented in Interaction concepts.

Request format

There are several things you need to consider when using the CUP QR method:

  1. The following parameters required for any payment must be specified:
    • project_id—project identifier obtained from ecommpay during integration
    • payment_id—payment identifier unique within the project
    • payment_currency—payment currency code in the ISO-4217 alpha-3 format
    • payment_amount—payment amount in the smallest currency unit
    • customer_id—customer identifier unique within the project
  2. The following parameters required for any payment must be specified: project_id, payment_id, payment_currency, payment_amount, customer_id.
  3. Additionally, it is recommended to specify the following parameters:
    • customer_first_name—first name of the customer, specified in Chinese
    • customer_last_name—last name of the customer, specified in Chinese
    • customer_email—customer email address
    • customer_phone—customer phone number
    • customer_country—customer country of residence in ISO 3166-1 alpha-2 format
    • customer_city—customer city of residence, specified in Chinese
    • customer_street—customer address of residence, specified in Chinese
    • customer_zip—customer postal code
    • payment_description—payment description

    If any of these parameters are missing, the payment form may display input fields for entering the missing values (details are available in Submission of additional payment information).

  4. The currency of payment can only be CNY.
  5. If you need to have the payment form displayed with the CUP QR method selected, set the force_payment_method parameter to cup-qr.
  6. Additionally, any other parameters available for working with Payment Page can be used (details).
  7. After all target parameters are specified, generate a signature (details).

Thus, a correct request for opening the payment form using the CUP QR method must contain the project identifier, basic payment information (identifier, amount, and currency code), customer information and payment description, as well as signature.

{
   "project_id": 120,
   "payment_id": "580",
   "payment_amount": 100000,
   "payment_currency": "CNY",
   "customer_id": "customer1",   
   "customer_id": "customer121",
   "customer_first_name": "伍",
   "customer_last_name": "伍",
   "customer_email": "paul@example.com",
   "customer_country": "CH,
   "customer_city": "倩",
   "customer_street": "倩",
   "customer_phone": "13632264147",
   "customer_zip": "123456",
   "payment_description: "payment_876543",
   "signature": "kUi2x9dKHAVNU0FYldOcZzUCwX6R\/ekpZhkIQg=="
}

Figure: Example of sufficient data in a purchase request

{
   "project_id": 120,
   "payment_id": "580",
   "payment_amount": 100000,
   "payment_currency": "CNY",
   "customer_id": "customer1",   
   "customer_id": "customer121",
   "customer_first_name": "伍",
   "customer_last_name": "伍",
   "customer_email": "paul@example.com",
   "customer_country": "CH,
   "customer_city": "倩",
   "customer_street": "倩",
   "customer_phone": "13632264147",
   "customer_zip": "123456",
   "payment_description: "payment_876543",
   "signature": "kUi2x9dKHAVNU0FYldOcZzUCwX6R\/ekpZhkIQg=="
}

Callback format

The CUP QR 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 information about a 300.00 CNY purchase made in the 843 project.

Figure: Example of callback data indicating that the purchase has been processed

"project_id": 843,
        "payment": {
            "id": "EP761d-6f6d",
            "type": "purchase",
            "status": "success",
            "date": "2019-12-11T12:20:17+0000",
            "method": "cup-qr",
            "sum": {
                "amount": 30000,
                "currency": "CNY"
            },
            "description": "123"
        },
        "account": {
            "number": "qwerty@qwe.fff"
        },
        "customer": {
            "phone": "2233"
        },
        "operation": {
            "id": 2000000029,
            "type": "sale",
            "status": "success",
            "date": "2019-12-11T12:20:17+0000",
            "created_date": "2019-12-11T12:18:04+0000",
            "request_id": "9a593318e4842a725b60498b-00000003",
            "sum_initial": {
                "amount": 30000,
                "currency": "CNY"
            },
            "sum_converted": {
                "amount": 30000,
                "currency": "CNY"
            },
            "code": "0",
            "message": "Success",
            "provider": {
                "id": 1838,
                "payment_id": "1001905226143910",
                "auth_code": "",
                "date": "2019-12-11T12:18:14+0000"
            }
        },
        "signature": "y/DQVScN32bQi2BHO4YU1gfuikigFEbA...=="
    }

The following is the example of a callback with information about a declined purchase.

Figure: Example of callback data indicating that the purchase has been declined

"project_id": 843,
        "payment": {
            "id": "EP761d-6f6d",
            "type": "purchase",
            "status": "decline",
            "date": "2019-12-11T12:20:17+0000",
            "method": "cup-qr",
            "sum": {
                "amount": 30000,
                "currency": "CNY"
            },
            "description": "123"
        },
        "account": {
            "number": "qwerty@qwe.fff"
        },
        "customer": {
            "phone": "2233"
        },
        "operation": {
            "id": 2000000029,
            "type": "sale",
            "status": "decline",
            "date": "2019-12-11T12:20:17+0000",
            "created_date": "2019-12-11T12:18:04+0000",
            "request_id": "9a593318e4842a725b60498b-00000003",
            "sum_initial": {
                "amount": 30000,
                "currency": "CNY"
            },
            "sum_converted": {
                "amount": 30000,
                "currency": "CNY"
            },
            "code": "20602",
            "message": "Time-out",
            "provider": {
                "id": 1838,
                "payment_id": "1001905226143910",
                "auth_code": "",
                "date": "2019-12-11T12:18:14+0000"
            }
        },
        "signature": "y/DQVScN32bQi2BHO4YU1gfuikigFEbA...=="
    }

Useful links

The following articles can be useful when implementing purchases via Payment Page:

Purchases by using Gate

General information

To process a purchase through Gate by using the CUP QR method, the merchant's web service is required to do the following:

  1. Send a request with all the required parameters and signature to the ecommpay URL.
  2. Receive an intermediate callback from the payment platform and display the QR code to the customer.
  3. Receive the final callback from the payment platform.

The full sequence and special aspects of purchase processing are provided below.



Figure: Purchase processing by using Gate: step-by-step description

  1. A customer initiates a purchase by using the CUP QR method in the web service.
  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.
  4. The payment platform validates the required parameters and signature in the request.
  5. The payment platform sends the response to the web service with information about the receipt of the request and its validity (details).
  6. The payment platform performs further processing of the request (with parameter consistency check) and sends it to the CUP QR service.
  7. The request is processed on the CUP QR service side.
  8. The data for displaying the QR code to the customer is sent from the CUP QR service to the payment platform.
  9. The payment platform sends the callback with the data for displaying the QR code to the customer to the web service.
  10. The QR code is displayed to the customer on the web service side.
  11. The customer scans QR code by using mobile application and completes all the required steps.
  12. The purchase is processed in the CUP QR service.
  13. The CUP QR service sends email with the payment result to the customer.
  14. The CUP QR service sends the payment result notification to the payment platform.
  15. The payment platform sends the payment result callback to the web service.
  16. The customer receives the payment result information from the web service.

Information about the formats of requests and callbacks used for processing payments by using the CUP QR method via Gate is presented further in this section. General information about working with the Gate API is presented in Interaction concepts.

Request format

There are several things you need to consider when sending purchase requests by using the CUP QR method:

  1. To initiate each purchase, send a separate POST request to the /v2/payment/cup/qr/sale endpoint.
  2. Each request must include the following objects and parameters:
    • Object general—general purchase information:
      • project_id—project identifier obtained from ecommpay during integration
      • payment_id—payment identifier unique within the project
      • signature—request signature generated after all required parameters are specified (details—in the Signature generation and verification) (details)
    • Object payment—payment information:
      • amount—payment amount in the smallest currency unit
      • currency—payment currency code in the ISO-4217 alpha-3 format
      • description—description or comment to the payment
    • customer—object that contains customer information:
      • id—customer identifier unique within the project
      • ip_address—customer IP address relevant for the initiated payment
      • first_name—customer first name, specified in Chinese
      • last_name—customer last name, specified in Chinese
      • phone—customer phone number without "+" sign
      • email—customer email
      • zip—customer postcode
      • country—customer country of residence in the ISO 3166-1 alpha-2 format
      • city—customer city of residence, specified in Chinese
      • street—customer address of residence in Chinese
    • return_url—URL for returning customers from bank site to merchant web service after payment processing:
      • success—URL for returning after processed payment
  3. The currency of payment can only be VND.
  4. Additionally, any other parameters included in the specification can be used.

Thus, a correct purchase request by using the CUP QR method must contain the project identifier, basic payment information (identifier, amount, and currency code), customer information, URL for redirection, as well as signature.

{
  "general": {
    "project_id": 200,
    "payment_id": "ECT_TEST_1559134591371-pz-3",
    "signature": "pK1YN6fd7yajGSWAzsbYeJo5nvotVBtOijOzgFvAU5Cc8PB...=="
  },
  "customer": {
    "ip_address": "192.0.2.0",
    "first_name": "伍",
    "last_name": "倩文",
    "phone": "13632264147",
    "email": "2524243674@email.com",
    "street":"street",
    "city": "city",
    "zip": "123045607",
    "country": "CH",
    "id": "123"
  },
  "payment": {
    "amount": 1000,
    "currency": "CNY",    
    "description": "payment"
  },
  "return_url: {
    "success": "http://example.com"
  }
}

Figure: Example of sufficient data in a purchase request

{
  "general": {
    "project_id": 200,
    "payment_id": "ECT_TEST_1559134591371-pz-3",
    "signature": "pK1YN6fd7yajGSWAzsbYeJo5nvotVBtOijOzgFvAU5Cc8PB...=="
  },
  "customer": {
    "ip_address": "192.0.2.0",
    "first_name": "伍",
    "last_name": "倩文",
    "phone": "13632264147",
    "email": "2524243674@email.com",
    "street":"street",
    "city": "city",
    "zip": "123045607",
    "country": "CH",
    "id": "123"
  },
  "payment": {
    "amount": 1000,
    "currency": "CNY",    
    "description": "payment"
  },
  "return_url: {
    "success": "http://example.com"
  }
}

Formats of intermediate callbacks containing data for displaying QR codes

To complete the payment, customers must get the payment QR code from you. The QR code data is sent in the callback from the payment platform in the display_data object. Therefore, before displaying the QR code, you need to accept and process such callback.

This callback is sent from the ecommpay payment platform to the URL specified in the merchant project settings. The payment status in this callback is awaiting customer action until the payment is completed by the customer.

The following is the callback fragment containing payment QR code data.

 "display_data": [
            {
                "type": "qr_data",
                "title": "QR Code",
                "data": "https://cashier.xhepay.com/paygate/union/pay/MDAyMDUxNjk0OTMwNjYyMTQzMTgwOHwwNHw0ODgxMDAwMA=="
            },
            {
                "type": "add_info",
                "title": "QR Code Timeout",
                "data": "600"
            }
        ]

Final callback format

The CUP QR 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 information about a 300.00 CNY purchase made in the 843 project.

Figure: Example of callback data indicating that the purchase has been processed

"project_id": 843,
        "payment": {
            "id": "EP761d-6f6d",
            "type": "purchase",
            "status": "success",
            "date": "2019-12-11T12:20:17+0000",
            "method": "cup-qr",
            "sum": {
                "amount": 30000,
                "currency": "CNY"
            },
            "description": "123"
        },
        "account": {
            "number": "qwerty@qwe.fff"
        },
        "customer": {
            "phone": "2233"
        },
        "operation": {
            "id": 2000000029,
            "type": "sale",
            "status": "success",
            "date": "2019-12-11T12:20:17+0000",
            "created_date": "2019-12-11T12:18:04+0000",
            "request_id": "9a593318e4842a725b60498b-00000003",
            "sum_initial": {
                "amount": 30000,
                "currency": "CNY"
            },
            "sum_converted": {
                "amount": 30000,
                "currency": "CNY"
            },
            "code": "0",
            "message": "Success",
            "provider": {
                "id": 1838,
                "payment_id": "1001905226143910",
                "auth_code": "",
                "date": "2019-12-11T12:18:14+0000"
            }
        },
        "signature": "y/DQVScN32bQi2BHO4YU1gfuikigFEbA...=="
    }

The following is the example of a callback with information about a declined purchase.

Figure: Example of callback data indicating that the purchase has been declined

"project_id": 843,
        "payment": {
            "id": "EP761d-6f6d",
            "type": "purchase",
            "status": "decline",
            "date": "2019-12-11T12:20:17+0000",
            "method": "cup-qr",
            "sum": {
                "amount": 30000,
                "currency": "CNY"
            },
            "description": "123"
        },
        "account": {
            "number": "qwerty@qwe.fff"
        },
        "customer": {
            "phone": "2233"
        },
        "operation": {
            "id": 2000000029,
            "type": "sale",
            "status": "decline",
            "date": "2019-12-11T12:20:17+0000",
            "created_date": "2019-12-11T12:18:04+0000",
            "request_id": "9a593318e4842a725b60498b-00000003",
            "sum_initial": {
                "amount": 30000,
                "currency": "CNY"
            },
            "sum_converted": {
                "amount": 30000,
                "currency": "CNY"
            },
            "code": "20602",
            "message": "Time-out",
            "provider": {
                "id": 1838,
                "payment_id": "1001905226143910",
                "auth_code": "",
                "date": "2019-12-11T12:18:14+0000"
            }
        },
        "signature": "y/DQVScN32bQi2BHO4YU1gfuikigFEbA...=="
    }

Useful links

The following articles can be useful when implementing purchases via Gate:

Analysis of payments results

To analyse information about payments made with the CUP QR method and other methods, you can use:

  • Dashboard interface toolkit with various lists and analytic panels.
  • Reports in CSV file format, available via the Reports section (one-time and periodically).
  • Data in JSON format, sent by program requests to a specified URL available by using the Data API interface.

If you have any questions, refer to the documentation (Dashboard and Using Data API) and ecommpay technical support.