# Hosted Checkout Page Integration

Without development, just call the interface to obtain the checkout page. You can display this page to your users. CCPayment will send the receiving notification to you after the user completes the payment order.

### **Step 1: Get checkout URL**

## Return a Checkout URL

<mark style="color:green;">`POST`</mark> `https://admin.ccpayment.com/ccpayment/v1/concise/url/get`

#### Headers

| Name                                           | Type   | Description                                                                                                                                                                                                                   |
| ---------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Appid<mark style="color:red;">\*</mark>        | String | Merchant's unique credential. Find it on the [Developer page](https://admin.ccpayment.com/developer/config).                                                                                                                  |
| Timestamp<mark style="color:red;">\*</mark>    | String | Timestamp in seconds (10-digit). The request is valid for two minutes.                                                                                                                                                        |
| Sign<mark style="color:red;">\*</mark>         | String | SHA-256 (APPID + APP Secret +timestamp+<mark style="color:red;">**body (json string)**</mark>). [Signature guide](https://doc.ccpayment.com/~/changes/HSMg9pcC4k6HIczMjOvx/ccpayment-for-developer/to-get-started/signature). |
| Content-Type<mark style="color:red;">\*</mark> | String | application/json; charset=utf-8                                                                                                                                                                                               |

#### Request Body

| Name                                                  | Type    | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| ----------------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| order\_valid\_period                                  | Integer | <p>The valid duration for the order. </p><p></p><p>Time period in seconds (10 digits).</p><p><br>The parameter passed by the merchant should be less than the order's valid period in Merchant's system. Cause on-chain transactions may need some time to proceed.</p><p><br>BTC will arrive within 24 hours and other tokens will usually arrive within 30 minutes.</p><p></p><p>Orders will be valid for 24 hrs by default. The max valid duration is 10 days (max valid duration for Satoshi is 2 hours).</p> |
| product\_price<mark style="color:red;">\*</mark>      | String  | Amount should be paid for this order (in USD by default, no more than two digits after the dot)                                                                                                                                                                                                                                                                                                                                                                                                                   |
| merchant\_order\_id<mark style="color:red;">\*</mark> | String  | Order ID in Merchant's system                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| product\_name<mark style="color:red;">\*</mark>       | String  | Name of the product                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| return\_url                                           | String  | Redirect users to this URL after user makes payment                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| notify\_url                                           | String  | The URL address will be notified via a POST request when the order status changes. Ensure the URL is accessible to receive notifications from the payment platform.                                                                                                                                                                                                                                                                                                                                               |
| custom\_value                                         | String  | Merchant custom field - This custom value field will be returned in transaction status notification.                                                                                                                                                                                                                                                                                                                                                                                                              |

{% tabs %}
{% tab title="200: OK Success" %}
{% tabs %}
{% tab title="Response" %}

#### Response

#### Header

#### Body

```json
{
	"code": 10000,
	"msg": "success",
	"data": {
              "payment_url": "https://checkout.cpayment.com/xxx"
	}
}
```

#### Parameters

{% endtab %}

{% tab title="Remarks" %}
As a security measure, we will sign the returned data (and according to this only { code: 10000 } should be signed, but it's signing all the returned body.). Additionally, it will return Appid, Sign, Timestamp  in the header of the response.  The signature method SHA-256 (appid+appSecret+Timestamp+body).

Please use the data with caution if the signature verification fails. It indicates that the data has been tampered with.
{% endtab %}
{% endtabs %}

{% endtab %}

{% tab title="500: Internal Server Error " %}

{% endtab %}

{% tab title="404: Not Found " %}

{% endtab %}
{% endtabs %}

<table><thead><tr><th width="180">Name</th><th width="173">Value</th><th data-type="checkbox">Required </th><th>Type</th><th width="153">Description</th></tr></thead><tbody><tr><td>code</td><td>10000</td><td>true</td><td>Integer</td><td></td></tr><tr><td>msg</td><td>Success</td><td>true</td><td>String</td><td></td></tr><tr><td>data</td><td></td><td>true</td><td>Object</td><td></td></tr><tr><td>data.payment_url</td><td><a href="https://s.cwallet.com/zpj9u9">https://s.cwallet.com/zpj9u9</a></td><td>true</td><td>String</td><td>URL link of payment</td></tr></tbody></table>

<table><thead><tr><th width="134">Name</th><th width="188">Value</th><th width="104" align="center">Required</th><th width="82">Type</th><th width="299">Description</th></tr></thead><tbody><tr><td>Appid</td><td>202302010636261620672405236006912</td><td align="center">Y</td><td>string</td><td>Merchant's unique credential. Find it on the Developer page.</td></tr><tr><td>Timestamp</td><td>1677152490</td><td align="center">Y</td><td>string</td><td>Timestamp in seconds (10-digit). The request is valid for two minutes.</td></tr><tr><td>Sign</td><td>871f0223c66ea72435208d03603a0cb00b90f6ac4a4ba725d00164d967e291f6</td><td align="center">Y</td><td>string</td><td>SHA-256 (appId + appSecret + timestamp+<mark style="color:red;"><strong>body (json string)</strong></mark>)</td></tr></tbody></table>

#### **Request Body Example**

{% tabs %}
{% tab title="Body" %}

```json
{
    "order_valid_period":823456,
    "product_price":"1",
    "merchant_order_id":"2012033040550",
    "product_name":"test",
    "return_url":"https://checkout.ccpayment.com/xxxxx"
}
```

{% endtab %}

{% tab title="Remarks" %}
The body of HTTP is a json string .

Add the content in body of HTTP to the signature. Ensure the body content matches the signature content. As soon as CCPayment receives the request, the body content will be read and the signature will be verified.
{% endtab %}
{% endtabs %}

### Step 2: Get deposit result

CCPayment will notify merchants the final transaction results. [Go to Webhook Configuration Guide](/ccpayment-v1.0-api/webhook-notification/webhook-notification-tutorial.md).

{% content-ref url="/pages/vKAOK9hIu8IaNry20TB7" %}
[API Deposit Webhook Notification](/ccpayment-v1.0-api/webhook-notification/api-deposit-webhook-notification.md)
{% endcontent-ref %}

> Once the merchant has processed the order, please return {http code: 200} and include a “success” string in the HTTP response body. <br>
>
> If CCPayment does not receive “success” as a response from the merchant, CCPayment will keep pushing the notification up to 6 times. Any response other than “success” will be regarded as a failure, and CCPayment will keep sending the notification.

<figure><img src="/files/LNdGpYl25HGjytNfXVE0" alt=""><figcaption><p>Response Example</p></figcaption></figure>

✅ Now you have completed the entire integration process for hosted checkout page

{% hint style="info" %}
Except for webhook notifications, you can get the order information via the Call [Order Information Interface.](/ccpayment-v1.0-api/payment-api-ccpayment/api-deposit-order-information-interface.md)\
\
The status of the API returned has a time lag with the webhook status maybe, Handle idempotency properly.
{% endhint %}

### Hosted Checkout Diagram

<figure><img src="/files/1S2KNHPdi6UuvCsnmnHN" alt=""><figcaption></figcaption></figure>

### Order status of API deposit

View order status in [API Deposit tab](https://admin.ccpayment.com/payment/paymentApiOrder/incoming).

<table><thead><tr><th width="211.33333333333331">Payment Info</th><th width="281">Order Within Valid Period</th><th>Order status</th></tr></thead><tbody><tr><td>Non-payment</td><td>Yes</td><td>Awaiting payment</td></tr><tr><td>Non-payment</td><td>No</td><td>Expired</td></tr><tr><td>Part-payment</td><td>Yes</td><td>Underpayment</td></tr><tr><td>Part-payment</td><td>No</td><td>Underpayment（Overdue）</td></tr><tr><td>Paid in full</td><td>Yes</td><td>Paid</td></tr><tr><td>Paid in full</td><td>No</td><td>Paid（Overdue）</td></tr><tr><td>Overpayment</td><td>Yes</td><td>Overpayment</td></tr><tr><td>Overpayment</td><td>No</td><td>Overpayment（Overdue）</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ccpayment.com/ccpayment-v1.0-api/payment-api-ccpayment/hosted-checkout-page-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
