CodePay Hosted Checkout
Merchants who have online websites (such as online shopping centers/ticketing websites/recharge websites, etc.) can refer to the solutions provided in this section to access CodePay payment.
Product Introduction
CodePay hosted checkout is a payment integration method provided by CodePay for merchants who wish to receive payments on its website. It provides a secure way to collect payments from customers by redirecting them to the payment page hosted by CodePay.
The CodePay hosted checkout integrates a large number of payment services from banks/acquirer/third-party payment service providers, including bank card online payment, online banking payment, mobile wallet scanning payment, etc.
After the user completes the payment, the merchant can receive a payment notification from CodePay, and the merchant can also actively call the order query API to obtain payment results. After obtaining the payment result, CodePay will synchronize and update order information to merchants to complete the remaining goods and services.
How It Works?
To use the CodePay hosted checkout, merchants need to integrate the CodePay hosted checkout into their website. Once integrated, customers can choose the payment method they want to use and enter their payment details on the payment form. When they click the "Pay" button, they will be redirected to the payment page hosted by CodePay, where they will complete the payment process. Once the payment is processed, the customer will be redirected back to the merchant's website, where they can view the payment results.
![Working principle of CodePay hosted checkout](/docs/assets/images/PayCloudCheckHowItWork-f703e5d44556d668879175d23f414ce7.jpg)
CodePay Checkout Page Demonstration
The following example shows some pages of the CodePay hosted checkout, where the content is displayed when the customer is redirected to this page:
Card payment mode
QR payment mode
Flow
![CodePay hosted checkout timing diagram, flowchart, process description](/docs/assets/images/PayCloudCheckSequence-2686c82f2154f0d36a443df347685070.jpg)
- Customers select products or services on the merchant website, create an order, click the payment button, and request the merchant server to start payment.
- The merchant server saves the order and requests the CodePay hosted checkout order API on the CodePay server to submit the order information to CodePay.
- CodePay verifies order information and saves the order.
- CodePay returns the checkout page URL to the merchant server.
- The merchant server returns the CodePay checkout URL to the merchant website.
- The merchant website redirects user requests to the CodePay checkout page. The fifth and sixth steps can also be redirected by the merchant's backend, and the specific implementation plan can be chosen by the merchant according to their needs.
- The user selects a payment method at the CodePay checkout, such as credit card payment or QR payment, and securely submits the corresponding payment information to the backend.
- CodePay verifies payment information and forwards payment requests to banks/acquirer/third-party payment service providers.
- Process payment requests and synchronously return corresponding processing results.
- CodePay synchronously returns the payment result to the CodePay checkout. And asynchronously notify the merchant server of the payment result. For details, please refer to the transaction result notification. The Webhook notification URL is passed to CodePay by the merchant through the "notify_url" parameter when Create Order.
- The CodePay cashier redirects to the merchant's page, and the redirect URL is passed to CodePay through the "return_url" parameter when the merchant Create Order.
- The merchant page should confirm whether the order has been successfully paid through the transaction status in the backend. Display the corresponding payment result interface to the user and provide subsequent products or services.To prevent missing orders, you can proactively check the order status through the Order Query API.
Start Integration
To integrate with the CodePay hosted checkout, you need to send an HTTP request and check the response. This will redirect customers from the merchant's website to CodePay's payment page to complete the payment. You can refer to the API description and example message in the document to start.
API List
We provide a set of REST APIs, please refer to the table below. These APIs provide SDKs for several languages, please visit SDK. API access rules, please refer to API rules.
API Name | Description |
---|---|
CodePay hosted checkout Ordering | Submit payment orders through this API |
Submit a refund request | If you submit a refund request through this API and the refund does not arrive immediately, you can call the refund inquiry API to get the progress of the refund. |
Query order | Query the transaction result (consumption/pre-authorization/pre-authorization completion) of a positive transaction order through this API |
Query refund | Query the transaction results of negative transaction orders (consumption cancellation/pre-authorization cancellation/consumption refund/pre-authorization completion refund) through this API |
Transaction result notification | After the transaction, notify the merchant through this webhook to tell the merchant the result of the transaction |
Quick Integration SDK
To simplify the integration process, we also provide SDKs or demos for several languages (see SDK/Demo section). These SDKs handle most of the necessary functionality, making the implementation of CodePay Hosted Checkout processes easier.