# Hosted Checkout Page Integration

We recommend merchants to integrate with ReelPay's hosted checkout interface. You will only need two steps to start accepting crypto payments. When the integration is done. Your server will be able to call the checkout URL API and present ReelPay's hosted checkout page to your users.&#x20;

<figure><img src="/files/mEeBrmI7th6bAj8RcPiF" alt=""><figcaption><p>Hosted CheckOut Page</p></figcaption></figure>

### **Step 1: Get Checkout URL**

## Return a Checkout URL

<mark style="color:green;">`POST`</mark> `https://pay.reelpay.com/v1/transactions/entrust`

#### Headers

| Name                                           | Type   | Description                                                                                                                                                  |
| ---------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| X-Appid<mark style="color:red;">\*</mark>      | String | Merchant's unique credential. Find it on the [**AppManage page**](https://merchant.reelpay.com/appManage).                                                   |
| X-Timestamp<mark style="color:red;">\*</mark>  | String | Timestamp in seconds (10-digit). The request is valid for two minutes.                                                                                       |
| X-Sign<mark style="color:red;">\*</mark>       | String | hmacSHA256 (<mark style="color:red;">**body (json string)**</mark>+timestamp+appKey). [Signature guide](/reelpay-for-developer/to-get-started/signature.md). |
| content-type<mark style="color:red;">\*</mark> | String | application/json                                                                                                                                             |

#### Request Body

| Name                                             | Type   | Description                                                                                     |
| ------------------------------------------------ | ------ | ----------------------------------------------------------------------------------------------- |
| symbol<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) |
| out\_trade\_no<mark style="color:red;">\*</mark> | String | Order ID in Merchant's system                                                                   |
| name<mark style="color:red;">\*</mark>           | String | Name of the product                                                                             |
| image                                            | String | The URL address of the product image                                                            |
| amount                                           | String | Product Price                                                                                   |

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

#### Response

#### Header

<table><thead><tr><th width="149">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>X-Appid</td><td>el9q0mzllpjhducy</td><td align="center">Y</td><td>string</td><td>Merchant's unique credential. Find it on the <a href="https://merchant.reelpay.com/appManage"><strong>AppManage page</strong></a>.</td></tr><tr><td>X-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>X-Sign</td><td>e0b78d93fd702aa31b07d5488cd85b4b7176d01c4ec45fd8bfaef0d1081a5ead</td><td align="center">Y</td><td>string</td><td>hmacSHA256 (<mark style="color:red;"><strong>body (json string)</strong></mark>+timestamp+appKey). <a href="/pages/HOaKJq8AxsStNTnQZCBX">Signature guide</a>.</td></tr><tr><td>content-type</td><td>application/json</td><td align="center">Y</td><td>string</td><td></td></tr></tbody></table>

#### Body

```json
{
    "code": 200,
    "message": "success",
    "data": {
        "url": "https://pay.reelpay.com/b79d2586ef7807d18c20230725183439",
        "time_expire": 1690389279,
        "trade_no": "b79d2586ef7807d18c20230725183439"
    }
}
```

#### Parameters

<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>200</td><td>true</td><td>Integer</td><td></td></tr><tr><td>message</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.url</td><td><a href="https://pay.reelpay.com/b79d2586ef7807d18c20230725183439">https://pay.reelpay.com/b79d2586ef7807d18c20230725183439</a></td><td>true</td><td>String</td><td>URL link of payment</td></tr><tr><td>data.time_expire</td><td>1690389279</td><td>true</td><td>Integer</td><td></td></tr><tr><td>data.trade_no</td><td>b79d2586ef7807d18c20230725183439</td><td>true</td><td>String</td><td>ReelPay Order ID</td></tr></tbody></table>
{% endtab %}

{% tab title="Remarks" %}
As a security measure, we will sign the returned data (and according to this only { code: 200 } 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 hmacSHA256 (body (json string)+timestamp+appKey).

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 %}

#### **Request Body Example**

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

<pre class="language-json"><code class="lang-json">{
<strong>    "out_trade_no":"202307250001",
</strong>    "symbol":"USD",
    "amount":"100",
    "name":"product name",
    "image":"https://reelpay.com/product.jpg"
}
</code></pre>

{% 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 ReelPay receives the request, the body content will be read and the signature will be verified.
{% endtab %}
{% endtabs %}

#### SDK Example

```go
import (
    reelpay "github.com/ReelPayment/sdk-go"
)
func main()  {
    transaction := reelpay.Transactions{
        AppID: "eqrbntqbi5uqvkpr",
        AppKey: "XhAlbICW10VJnWGruPL0NSnvb6946JDQ",
    }
    res := transaction.EntrustPay(&reelpay.EntrustPay{
        OutTradeNo: "jSWfrolOTdsadcYuUwkJbdw9IJUBeV",
        Symbol:     "USD",
        Amount:     "1.2",
        Name:       "Product name",
        Image:      "https://reelpay.com/product.jpg",
    })
    fmt.Println(res)
}
```

[Click me to see more](/sdk-instruction.md)

### Step 2: Configure Webhook to receive payout notification

Configure Webhook to receive notifications. ReelPay will notify merchant of the final transaction results. You can configure the Webhook URL on the [**AppManage page**](https://merchant.reelpay.com/appManage)

<figure><img src="/files/1IG193lwx0id07NcNPQu" alt="" width="328"><figcaption><p><a href="https://merchant.reelpay.com/appManage"><strong>AppManage</strong></a></p></figcaption></figure>

Transactions will start a request to the callback interface set by the merchant when involving the following [events](/error-code.md#transaction-status-code):

* Paid
* Transaction close
* Transaction timeout
* Refunded
* Chain confirmation failed

Callback Frequency: 5s、15s、30s、3m、10m、20m、30m、30m、30m、60m、3h、3h、3h、6h、6h&#x20;

Total: 24h3m50s &#x20;

Callback Form:

* The callback content is still encrypted.「For more information see the [Signature](/reelpay-for-developer/to-get-started/signature.md)」

### Webhook notification

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

<table><thead><tr><th width="537">Name</th><th width="206">Value</th><th width="101" align="center">Required</th><th width="77">Type</th><th width="299">Description</th></tr></thead><tbody><tr><td>X-Appid</td><td>eqrbntqbi5uqvkpr</td><td align="center">Y</td><td>string</td><td>Merchant's unique credential. Find it on the <a href="https://merchant.reelpay.com/appManage"><strong>AppManage page</strong></a>.</td></tr><tr><td>X-Timestamp</td><td>1690368283</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>X-Sign</td><td>e0c6a719ebc366da0340c1b450026a903a55c86ed5fbe0b586cd73f6be74ade6</td><td align="center">Y</td><td>string</td><td>hmacSHA256 (<mark style="color:red;"><strong>body (json string)</strong></mark>+timestamp+appKey)</td></tr><tr><td>X-EventType</td><td>Paid</td><td align="center">Y</td><td>string</td><td><a href="/pages/SRCuQnmoR80UPGiDLeUf#transaction-status-code">Transaction Status Code</a></td></tr></tbody></table>
{% endtab %}

{% tab title="Body" %}

<pre class="language-json"><code class="lang-json"><strong>```json
</strong>{
   "trade_no": "uGHT9KRRvLIl4WW8JAaTWmETf3mz8D60",
   "appid": "eqrbntqbi5uqvkpr",
   "out_trade_no": "202307250001",
   "amount": "1.2",
   "status": "PAID",
   "success_time": 1690369680
 }
```

</code></pre>

{% endtab %}

{% tab title="Parameters" %}

<table><thead><tr><th width="155.33333333333331">Name</th><th width="88">Type</th><th>Description</th></tr></thead><tbody><tr><td>trade_no</td><td>string</td><td>ReelPay Order ID</td></tr><tr><td>appid</td><td>string</td><td>Merchant APPID</td></tr><tr><td>out_trade_no</td><td>string</td><td>Merchant Order ID</td></tr><tr><td>amount</td><td>string</td><td>Transaction Amount</td></tr><tr><td>status</td><td>string</td><td>Transaction Status</td></tr><tr><td>success_time</td><td>string</td><td>Transaction Time</td></tr></tbody></table>
{% endtab %}

{% tab title="Remarks" %}
Return Appid, Sign, Timestamp in the header of the response.  The signature method hmacSHA256 (<mark style="color:red;">**body (json string)**</mark>+timestamp+appKey).

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

{% hint style="info" %}
Merchants sign to ensure information safety. Once the merchant has processed the order, please return "Success" in the body of the HTTP response if the processing has been successful. If the process fails, ReelPay will attempt to send the order again and the Webhook will retry up to 15 times ( Callback Frequency: 5s、15s、30s、3m、10m、20m、30m、30m、30m、60m、3h、3h、3h、6h、6h, Total: 24h3m50s ).
{% endhint %}

## Example

<figure><img src="/files/ePXbF8DvFgqBKnBwLmwJ" alt=""><figcaption></figcaption></figure>


---

# 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.reelpay.com/payment-api/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.
