# 订单

{% hint style="info" %}
诸如**product\_id、location\_id**等选项可以使用**产品**端点进行检索。

[产品](/cn/dai-li/jing-tai-zhu-zhai-dai-li/api/chan-pin.md)
{% endhint %}

## 获取多个订单

<mark style="color:green;">`GET`</mark> `/orders`

**查询参数**

<table><thead><tr><th width="205.91796875">名称</th><th>类型</th><th>描述</th><th>可用选项</th></tr></thead><tbody><tr><td>product_id</td><td>整型</td><td>产品ID</td><td></td></tr><tr><td>page</td><td>整型</td><td>页数</td><td></td></tr><tr><td>per_page</td><td>整型</td><td>每页获取的订单数</td><td></td></tr><tr><td>location_id</td><td>整型</td><td>位置ID</td><td></td></tr><tr><td>status</td><td>字符串</td><td>订单状态</td><td><p></p><pre><code>unpaid
in-progress
confirmed
refunded
expired
</code></pre></td></tr><tr><td>note_search</td><td>字符串</td><td>要搜索的订单备注字段中的短语</td><td></td></tr><tr><td>order_ids</td><td>数组</td><td>目标订单的ID</td><td></td></tr><tr><td>sort_by</td><td>字符串</td><td>要排序的列。与订单一起使用时为必填项</td><td></td></tr><tr><td>order</td><td>字符串</td><td>对订单分类。与sort_by一起使用时为必填项</td><td><pre><code>asc
desc
</code></pre></td></tr><tr><td>statuses</td><td>数组</td><td>订单状态。必须仅包含可用选项中的值。</td><td><pre><code>unpaid
in-progress
confirmed
refunded
expired
</code></pre></td></tr><tr><td>status_is_expiring_soon</td><td>布尔值</td><td>订单是否即将到期</td><td></td></tr><tr><td>order_billing_type</td><td>字符串</td><td>订单计费类型</td><td><pre><code>subscription
regular
</code></pre></td></tr></tbody></table>

**响应案例：**

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

```
curl -X GET "https://apid.iproyal.com/v1/reseller/orders?product_id=123&page=1&per_page=10&location_id=456&status=in-progress&note_search=example%20note&order_ids[]=789&order_ids[]=1011" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';

$params = [
    'product_id' => 123,
    'page' => 1,
    'per_page' => 10,
    'location_id' => 456,
    'status' => 'in-progress',
    'note_search' => 'example note',
    'order_ids' => [789, 1011]
];

$query = http_build_query($params);
$url = "https://apid.iproyal.com/v1/reseller/orders?$query";

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ]
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
params = {
    'product_id': 123,
    'page': 1,
    'per_page': 10,
    'location_id': 456,
    'status': 'in-progress',
    'note_search': 'example note',
    'order_ids[]': [789, 1011]
}

url = 'https://apid.iproyal.com/v1/reseller/orders'
headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers, params=params)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';

const params = new URLSearchParams({
  product_id: 123,
  page: 1,
  per_page: 10,
  location_id: 456,
  status: 'in-progress',
  note_search: 'example note',
});

const orderIds = [789, 1011];
orderIds.forEach(id => params.append('order_ids[]', id));

const options = {
  hostname: 'apid.iproyal.com',
  path: `/v1/reseller/orders?${params.toString()}`,
  method: 'GET',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.List;
import java.util.Map;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_access_token>";
        String urlString = "https://apid.iproyal.com/v1/reseller/orders";

        Map<String, String> params = Map.of(
                "product_id", "123",
                "page", "1",
                "per_page", "10",
                "location_id", "456",
                "status", "in-progress",
                "note_search", "example note"
        );

        List<String> orderIds = List.of("789", "1011");

        StringBuilder queryParams = new StringBuilder();
        try {
            for (Map.Entry<String, String> entry : params.entrySet()) {
                if (queryParams.length() > 0) {
                    queryParams.append("&");
                }
                queryParams.append(URLEncoder.encode(entry.getKey(), "UTF-8"))
                        .append("=")
                        .append(URLEncoder.encode(entry.getValue(), "UTF-8"));
            }

            for (String orderId : orderIds) {
                if (queryParams.length() > 0) {
                    queryParams.append("&");
                }
                queryParams.append(URLEncoder.encode("order_ids[]", "UTF-8"))
                        .append("=")
                        .append(URLEncoder.encode(orderId, "UTF-8"));
            }

            URL url = new URL(urlString + "?" + queryParams.toString());
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("X-Access-Token", apiToken);
            connection.setRequestProperty("Content-Type", "application/json");

            int responseCode = connection.getResponseCode();
            System.out.println("Response Code: " + responseCode);

            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println("Response Body: " + content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
	"net/url"
)

const (
	apiToken = "<your_access_token>"
	baseURL  = "https://apid.iproyal.com/v1/reseller/orders"
)

func main() {
	params := url.Values{}
	params.Add("product_id", "123")
	params.Add("page", "1")
	params.Add("per_page", "10")
	params.Add("location_id", "456")
	params.Add("status", "in-progress")
	params.Add("note_search", "example note")

	orderIds := []string{"789", "1011"}
	for _, id := range orderIds {
		params.Add("order_ids[]", id)
	}

	fullURL := fmt.Sprintf("%s?%s", baseURL, params.Encode())

	req, err := http.NewRequest(http.MethodGet, fullURL, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System.Text.Json;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        string url = "https://apid.iproyal.com/v1/reseller/orders";

        var queryParams = new Dictionary<string, string>
        {
            { "product_id", "123" },
            { "page", "1" },
            { "per_page", "10" },
            { "location_id", "456" },
            { "status", "in-progress" },
            { "note_search", "example note" },
        };

        List<string> orderIds = new List<string> { "789", "1011" };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            var query = new List<string>();
            
            foreach (var param in queryParams)
            {
                query.Add($"{Uri.EscapeDataString(param.Key)}={Uri.EscapeDataString(param.Value)}");
            }
            
            foreach (var orderId in orderIds)
            {
                query.Add($"{Uri.EscapeDataString("order_ids[]")}={Uri.EscapeDataString(orderId)}");
            }

            string queryString = string.Join("&", query);
            string urlWithParams = $"{url}?{queryString}";

            HttpResponseMessage response = await client.GetAsync(urlWithParams);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**响应示例：**

```json
{
    "data": [
        {
            "id": 420,
            "note": null,
            "product_name": "Static Residential",
            "expire_date": "2024-04-20 10:25:12",
            "plan_name": "30 Days",
            "status": "confirmed",
            "location": "United States",
            "locations": "United States",
            "quantity": 5,
            "questions_answers": [
                {
                    "question": "Extra requirements (if you have any):",
                    "answer": "I need 128.158.97"
                }
            ],
            "proxy_data": {
                "ports": {
                    "socks5": 12324,
                    "http|https": 12323
                },
                "proxies": []
            },
            "auto_extend_settings": null,
            "extended_history": []
        },
        ...
    ],
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 2,
        "path": "https://apid.iproyal.com/v1/reseller/orders",
        "per_page": 10,
        "to": 10,
        "total": 14
    }
}
```

## 获取订单

<mark style="color:green;">`GET`</mark>  `/orders/{order_id}`

**响应案例：**

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

```
curl -X GET "https://apid.iproyal.com/v1/reseller/orders/12345" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';
$order_id = 12345;

$url = "https://apid.iproyal.com/v1/reseller/orders/$order_id";

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ]
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>

```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
order_id = 12345

url = f'https://apid.iproyal.com/v1/reseller/orders/{order_id}'
headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';
const order_id = 12345;

const options = {
  hostname: 'apid.iproyal.com',
  path: `/v1/reseller/orders/${order_id}`,
  method: 'GET',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequest {
    public static void main(String[] args) {
        String apiToken = "<your_access_token>";
        int orderId = 12345;
        String urlString = String.format("https://apid.iproyal.com/v1/reseller/orders/%d", orderId);

        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("X-Access-Token", apiToken);
            connection.setRequestProperty("Content-Type", "application/json");

            int responseCode = connection.getResponseCode();
            System.out.println("Response Code: " + responseCode);

            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder content = new StringBuilder();

                while ((inputLine = in.readLine()) != null) {
                    content.append(inputLine);
                }
                in.close();

                System.out.println("Response Body: " + content.toString());
            } else {
                System.out.println("GET request failed. Response Code: " + responseCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken = "<your_access_token>"
	orderID  = 12345
)

func main() {
	url := fmt.Sprintf("https://apid.iproyal.com/v1/reseller/orders/%d", orderID)

	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        int orderId = 12345;
        string url = $"https://apid.iproyal.com/v1/reseller/orders/{orderId}";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            HttpResponseMessage response = await client.GetAsync(url);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**响应示例：**

```json
{
    "id": 420,
    "note": null,
    "product_name": "Static Residential",
    "expire_date": "2024-04-20 10:25:12",
    "plan_name": "30 Days",
    "status": "expired",
    "location": "Canada",
    "locations": "Canada",
    "quantity": 5,
    "questions_answers": [],
    "proxy_data": {
        "ports": {
            "socks5": 12324,
            "http|https": 12323
        },
        "proxies": []
    },
    "auto_extend_settings": null,
    "extended_history": []
}
```

## 计算价格

<mark style="color:green;">`GET`</mark>  `/orders/calculate-pricing`

**查询参数**

<table><thead><tr><th width="257">名称</th><th width="114">类型</th><th>描述</th><th>可用选项</th></tr></thead><tbody><tr><td>product_id</td><td>整型</td><td>产品ID</td><td></td></tr><tr><td>product_plan_id</td><td>整型</td><td>产品套餐ID</td><td></td></tr><tr><td>product_location_id</td><td>整型</td><td>产品地理位置ID</td><td></td></tr><tr><td>quantity</td><td>整型</td><td>代理数量</td><td></td></tr><tr><td>coupon_code</td><td>字符串</td><td>优惠码</td><td></td></tr><tr><td>order_id</td><td>整型</td><td>订单编号</td><td></td></tr><tr><td>order_billing_type</td><td>字符串</td><td>订单计费类型</td><td><pre><code>subscription
regular
</code></pre></td></tr><tr><td>product_question_answers</td><td>数组</td><td>产品问题答案</td><td></td></tr></tbody></table>

**响应案例：**

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

```
curl -X GET "https://apid.iproyal.com/v1/reseller/orders/calculate-pricing?product_id=123&product_plan_id=456&product_location_id=789&quantity=10&coupon_code=DISCOUNT2024" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';

$params = [
    'product_id' => 123,
    'product_plan_id' => 456,
    'product_location_id' => 789,
    'quantity' => 10,
    'coupon_code' => 'DISCOUNT2024'
];

$query = http_build_query($params);
$url = "https://apid.iproyal.com/v1/reseller/orders/calculate-pricing?$query";

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ]
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
params = {
    'product_id': 123,
    'product_plan_id': 456,
    'product_location_id': 789,
    'quantity': 10,
    'coupon_code': 'DISCOUNT2024'
}

url = 'https://apid.iproyal.com/v1/reseller/orders/calculate-pricing'
headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers, params=params)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';

const params = new URLSearchParams({
  product_id: 123,
  product_plan_id: 456,
  product_location_id: 789,
  quantity: 10,
  coupon_code: 'DISCOUNT2024'
}).toString();

const options = {
  hostname: 'apid.iproyal.com',
  path: `/v1/reseller/orders/calculate-pricing?${params}`,
  method: 'GET',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String accessToken = "<your_access_token>";
        String url = "https://apid.iproyal.com/v1/reseller/orders/calculate-pricing" +
                "?product_id=123&product_plan_id=456&product_location_id=789&quantity=10&coupon_code=DISCOUNT2024";

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("X-Access-Token", accessToken)
                .GET()
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println("Response Code: " + response.statusCode());
        System.out.println("Response Body: " + response.body());
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
	"net/url"
)

const (
	apiToken = "<your_access_token>"
	baseURL  = "https://apid.iproyal.com/v1/reseller/orders/calculate-pricing"
)

func main() {
	params := url.Values{}
	params.Add("product_id", fmt.Sprintf("%d", 123))
	params.Add("product_plan_id", fmt.Sprintf("%d", 456))
	params.Add("product_location_id", fmt.Sprintf("%d", 789))
	params.Add("quantity", fmt.Sprintf("%d", 10))
	params.Add("coupon_code", "DISCOUNT2024")

	fullURL := fmt.Sprintf("%s?%s", baseURL, params.Encode())

	req, err := http.NewRequest(http.MethodGet, fullURL, nil)
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Text.Json;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        string url = "https://apid.iproyal.com/v1/reseller/orders/calculate-pricing";

        var queryParams = new Dictionary<string, string>
        {
            { "product_id", "123" },
            { "product_plan_id", "456" },
            { "product_location_id", "789" },
            { "quantity", "10" },
            { "coupon_code", "DISCOUNT2024" }
        };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            var urlWithParams = new UriBuilder(url) { Query = await new FormUrlEncodedContent(queryParams).ReadAsStringAsync() }.ToString();

            HttpResponseMessage response = await client.GetAsync(urlWithParams);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**响应示例：**

```json
{
    "pre_discount_price": 30,
    "price_with_vat": 30,
    "vat": null,
    "price": 30,
    "pre_discount_price_per_item": 3,
    "price_per_item": 3,
    "plan_discount_percent": 0,
    "location_discount_percent": 0,
    "coupon_discount_percent": 0,
    "quantity_discount_percent": 0,
    "total_discount_percent": 0,
    "quantity_required_for_next_discount": {
        "quantity": 90,
        "discount": 5
    },
    "message": null
}
```

## 创建订单

<mark style="color:blue;">`POST`</mark>  `/orders`

**正文参数**

<table><thead><tr><th width="257">名称</th><th width="114">类型</th><th>描述</th></tr></thead><tbody><tr><td>product_id</td><td>整型</td><td>产品ID</td></tr><tr><td>product_plan_id</td><td>整型</td><td>产品套餐ID</td></tr><tr><td>product_location_id</td><td>整型</td><td>产品地理位置ID</td></tr><tr><td>quantity</td><td>整型</td><td>代理数量</td></tr><tr><td>coupon_code</td><td>字符串</td><td>优惠码</td></tr><tr><td>auto_extend</td><td>布尔值</td><td>订单是否会自动续期 預設值為 false</td></tr><tr><td>product_question_answers</td><td>数组</td><td><p>问题解答</p><pre><code>{ question_id: answer, ... }
</code></pre></td></tr><tr><td>card_id</td><td>整型</td><td>卡号。如果订单通过卡支付，则必须提供卡号，否则会被视为用余额购买</td></tr><tr><td>selection</td><td>数组</td><td>您可以使用 <code>selection.locations</code>字段提供多个位置及其数量。当您使用此功能时，无需在请求正文中指定<code>product_plan_id</code>和<code>quantity</code>量作为顶层参数。</td></tr></tbody></table>

**响应案例：**

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

```
curl -X POST "https://apid.iproyal.com/v1/reseller/orders" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json" \
     -d '{
           "product_id": 123,
           "product_plan_id": 456,
           "coupon_code": "DISCOUNT2024",
           "auto_extend": true,
           "product_question_answers": {
               "question_id_1": "answer_1",
               "question_id_2": "answer_2"
           },
           "card_id": 1,
           "selection": {
             "locations": [
               {
                 "product_location_id": 789,
                 "quantity": 10
               }
             ]
           }
         }'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';

$url = "https://apid.iproyal.com/v1/reseller/orders";

$data = [
    'product_id' => 123,
    'product_plan_id' => 456,
    'coupon_code' => 'DISCOUNT2024',
    'auto_extend' => true,
    'product_question_answers' => [
        'question_id_1' => 'answer_1',
        'question_id_2' => 'answer_2'
    ],
    'card_id' => 1,
    'selection' => [
        'locations' => [
            ['product_location_id' => 789, 'quantity' => 10]
        ]
    ]
];

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ],
    CURLOPT_POSTFIELDS => json_encode($data)
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>

```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
url = 'https://apid.iproyal.com/v1/reseller/orders'

data = {
    'product_id': 123,
    'product_plan_id': 456,
    'coupon_code': 'DISCOUNT2024',
    'auto_extend': True,
    'product_question_answers': {
        'question_id_1': 'answer_1',
        'question_id_2': 'answer_2'
    },
    'card_id': 1,
    'selection': {
        'locations': [
            {'product_location_id': 789, 'quantity': 10}
        ]
    }
}

headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.post(url, json=data, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';
const data = JSON.stringify({
  product_id: 123,
  product_plan_id: 456,
  coupon_code: 'DISCOUNT2024',
  auto_extend: true,
  product_question_answers: {
    question_id_1: 'answer_1',
    question_id_2: 'answer_2'
  },
  card_id: 1,
  selection: {
    locations: [
      { product_location_id: 789, quantity: 10 },
    ]
  }
});

const options = {
  hostname: 'apid.iproyal.com',
  path: '/v1/reseller/orders',
  method: 'POST',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json',
    'Content-Length': data.length
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.write(data);
req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String accessToken = "<your_access_token>";
        String url = "https://apid.iproyal.com/v1/reseller/orders";

        String requestBody = """
            {
                "product_id": 123,
                "product_plan_id": 456,
                "coupon_code": "DISCOUNT2024",
                "auto_extend": true,
                "product_question_answers": {
                    "question_id_1": "answer_1",
                    "question_id_2": "answer_2"
                },
                "card_id" 1,
                "selection": {
                    "locations": [
                        { "product_location_id": 789, "quantity": 10 },
                    ]
                }
            }
        """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("X-Access-Token", accessToken)
                .POST(HttpRequest.BodyPublishers.ofString(requestBody))
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println("Response Code: " + response.statusCode());
        System.out.println("Response Body: " + response.body());
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken = "<your_access_token>"
	url      = "https://apid.iproyal.com/v1/reseller/orders"
)

func main() {
	data := map[string]interface{}{
		"product_id":              123,
		"product_plan_id":         456,
		"product_location_id":     789,
		"quantity":                10,
		"coupon_code":             "DISCOUNT2024",
		"auto_extend":             true,
		"product_question_answers": map[string]string{
			"question_id_1": "answer_1",
			"question_id_2": "answer_2",
		},
		"card_id":		   1,
		"selection": map[string]interface{}{
			"locations": []map[string]interface{}{
				{"product_location_id": 789, "quantity": 10},
		},
	}

	jsonData, err := json.Marshal(data)
	if err != nil {
		log.Fatal("Error marshaling JSON:", err)
	}

	req, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(jsonData))
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        string url = "https://apid.iproyal.com/v1/reseller/orders";

        var data = new
        {
            product_id = 123,
            product_plan_id = 456,
            product_location_id = 789,
            quantity = 10,
            coupon_code = "DISCOUNT2024",
            auto_extend = true,
            product_question_answers = new
            {
                question_id_1 = "answer_1",
                question_id_2 = "answer_2"
            },
            card_id = 1,
            selection = new
            {
                locations = new[]
                {
                    new { product_location_id = 789, quantity = 10 },
                }
            }
        };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            var jsonData = JsonSerializer.Serialize(data);
            var content = new StringContent(jsonData, Encoding.UTF8, "application/json");

            HttpResponseMessage response = await client.PostAsync(url, content);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**响应示例：**

```json
{
    "id": 420,
    "note": null,
    "product_name": "Static Residential",
    "plan_name": "30 Days",
    "expire_date": "2024-04-20 10:25:12",
    "status": "expired",
    "location": "Canada",
    "locations": "Canada",
    "quantity": 5,
    "questions_answers": [],
    "proxy_data": {
        "ports": {
            "socks5": 12324,
            "http|https": 12323
        },
        "proxies": []
    },
    "auto_extend_settings": null,
    "extended_history": []
}
```

## 续期订单

<mark style="color:blue;">`POST`</mark>  `/orders/{order_id}/extend`

**正文参数**

<table><thead><tr><th width="257">名称</th><th width="114">类型</th><th>描述</th></tr></thead><tbody><tr><td>product_plan_id</td><td>整型</td><td>产品套餐ID</td></tr><tr><td>card_id</td><td>整型</td><td>卡号。如果订单通过卡支付，则必须提供卡号，否则会被视为用余额购买</td></tr><tr><td>proxies</td><td>数组</td><td>可选的IP地址扩展列表。若省略或为空，则扩展该订单对应的所有代理。</td></tr></tbody></table>

**响应案例：**

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

```
curl -X POST "https://apid.iproyal.com/v1/reseller/orders/12345/extend" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json" \
     -d '{
           "product_plan_id": 678,
           "card_id": 1,
           "proxies": []
         }'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';
$order_id = 12345;
$product_plan_id = 678;

$url = "https://apid.iproyal.com/v1/reseller/orders/$order_id/extend";

$data = [
    'product_plan_id' => $product_plan_id,
    'card_id' => 1,
    'proxies' => []
];

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ],
    CURLOPT_POSTFIELDS => json_encode($data)
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>

```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
order_id = 12345
url = f'https://apid.iproyal.com/v1/reseller/orders/{order_id}/extend'

data = {
    'product_plan_id': 678,
    'card_id': 1,
    'proxies' => []
}

headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.post(url, json=data, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';
const order_id = 12345;
const data = JSON.stringify({
  product_plan_id: 678,
  card_id: 1,
  proxies: []
});

const options = {
  hostname: 'apid.iproyal.com',
  path: `/v1/reseller/orders/${order_id}/extend`,
  method: 'POST',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json',
    'Content-Length': data.length
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.write(data);
req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String accessToken = "<your_access_token>"; 
        String orderId = "12345";
        String url = "https://apid.iproyal.com/v1/reseller/orders/" + orderId + "/extend";

        String requestBody = """
            {
                "product_plan_id": 678,
                "card_id": 1,
                "proxies": []
            }
        """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("X-Access-Token", accessToken)
                .POST(HttpRequest.BodyPublishers.ofString(requestBody))
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println("Response Code: " + response.statusCode());
        System.out.println("Response Body: " + response.body());
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken = "<your_access_token>"
	orderID  = 12345
)

func main() {
	url := fmt.Sprintf("https://apid.iproyal.com/v1/reseller/orders/%d/extend", orderID)

	data := map[string]interface{}{
		"product_plan_id": 678,
		"card_id": 1,
		"proxies": []string{}
	}

	jsonData, err := json.Marshal(data)
	if err != nil {
		log.Fatal("Error marshaling JSON:", err)
	}

	req, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(jsonData))
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        int orderId = 12345;
        string url = $"https://apid.iproyal.com/v1/reseller/orders/{orderId}/extend";

        var data = new
        {
            product_plan_id = 678,
            card_id = 1,
            proxies = Array.Empty<string>()
        };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            var jsonData = JsonSerializer.Serialize(data);
            var content = new StringContent(jsonData, Encoding.UTF8, "application/json");

            HttpResponseMessage response = await client.PostAsync(url, content);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**响应示例：**

```json
{
    "id": 420,
    "note": null,
    "product_name": "Static Residential",
    "plan_name": "30 Days",
    "expire_date": "2024-04-20 10:25:12",
    "status": "expired",
    "location": "Canada",
    "locations": "Canada",
    "quantity": 5,
    "questions_answers": [],
    "proxy_data": {
        "ports": {
            "socks5": 12324,
            "http|https": 12323
        },
        "proxies": [],
        "extended_proxies": []
    },
    "auto_extend_settings": null,
    "extended_history": []
}
```

## 切换订单自动续费

<mark style="color:blue;">`POST`</mark>  `/orders/toggle-auto-extend`

**查询参数**

<table><thead><tr><th>名称</th><th>类型</th><th>描述</th><th>可用选项</th></tr></thead><tbody><tr><td>order_id</td><td>整型</td><td>订单ID</td><td></td></tr><tr><td>is_enabled</td><td>布尔值</td><td>是否应启用或禁用自动续费</td><td></td></tr><tr><td>product_plan_id</td><td>整型</td><td>订单的产品方案ID。此参数为非必填项，若为空，则默认使用订单当前的产品ID</td><td></td></tr><tr><td>payment_type</td><td>字符串</td><td>续费使用的支付方式。若<code>is_enabled</code>为否，则此参数为非必填项</td><td><p></p><pre><code>card
balance
</code></pre></td></tr><tr><td>card_id</td><td>整型</td><td>用于支付续费的银行卡ID。若<code>payment_type</code>为余额，则此参数为非必填项</td><td></td></tr></tbody></table>

**响应案例:**

{% tabs fullWidth="false" %}
{% tab title="cURL" %}

```
curl -X POST "https://apid.iproyal.com/v1/reseller/orders/toggle-auto-extend" \
     -H "X-Access-Token: <your_access_token>" \
     -H "Content-Type: application/json" \
     -d '{
           "order_id": 123,
           "product_plan_id": 3,
           "is_enabled": true,
           "payment_type": "card",
           "card_id": 1
         }'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$api_token = '<your_access_token>';

$url = "https://apid.iproyal.com/v1/reseller/orders/toggle-auto-extend";

$data = [
    'order_id' => 123,
    'product_plan_id' => 3,
    'is_enabled' => true,
    'payment_type' => 'card',
    'card_id' => 1
];

$options = [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        "X-Access-Token: $api_token",
        'Content-Type: application/json'
    ],
    CURLOPT_POSTFIELDS => json_encode($data)
];

$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_token = '<your_access_token>'
url = 'https://apid.iproyal.com/v1/reseller/orders/toggle-auto-extend'

data = {
	'order_id': 123,
	'product_plan_id': 3,
	'is_enabled': True,
	'payment_type': 'card',
	'card_id': 1
}

headers = {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json'
}

response = requests.post(url, json=data, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');

const api_token = '<your_access_token>';
const data = JSON.stringify({
	order_id: 123,
	product_plan_id: 3,
	is_enabled: true,
	payment_type: 'card',
	card_id: 1
});

const options = {
  hostname: 'apid.iproyal.com',
  path: '/v1/reseller/orders/toggle-auto-extend',
  method: 'POST',
  headers: {
    'X-Access-Token': api_token,
    'Content-Type': 'application/json',
    'Content-Length': data.length
  }
};

const req = https.request(options, (res) => {
  let responseData = '';

  res.on('data', (chunk) => {
    responseData += chunk;
  });

  res.on('end', () => {
    console.log(responseData);
  });
});

req.on('error', (error) => {
  console.error('Error:', error.message);
});

req.write(data);
req.end();
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String accessToken = "<your_access_token>";
        String url = "https://apid.iproyal.com/v1/reseller/orders/toggle-auto-extend";

        String requestBody = """
            {
	            "order_id": 123,
	            "product_plan_id": 3,
		    "is_enabled": true,
		    "payment_type": "card",
		    "card_id": 1
            }
        """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("X-Access-Token", accessToken)
                .POST(HttpRequest.BodyPublishers.ofString(requestBody))
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println("Response Code: " + response.statusCode());
        System.out.println("Response Body: " + response.body());
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
)

const (
	apiToken = "<your_access_token>"
	url      = "https://apid.iproyal.com/v1/reseller/orders/toggle-auto-extend"
)

func main() {
	data := map[string]interface{}{
		"order_id":        123,
		"product_plan_id": 3,
		"is_enabled":      true,
		"payment_type":    "card",
		"card_id":         1,
	}

	jsonData, err := json.Marshal(data)
	if err != nil {
		log.Fatal("Error marshaling JSON:", err)
	}

	req, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(jsonData))
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("X-Access-Token", apiToken)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error making request:", err)
	}
	defer resp.Body.Close()

	fmt.Println("Status Code:", resp.StatusCode)

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response body:", err)
	}

	var jsonResponse map[string]interface{}
	err = json.Unmarshal(responseBody, &jsonResponse)
	if err != nil {
		log.Fatal("Error unmarshaling JSON:", err)
	}

	fmt.Printf("%+v\n", jsonResponse)
}

```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string apiToken = "<your_access_token>";
        string url = "https://apid.iproyal.com/v1/reseller/orders/toggle-auto-extend";

        var data = new
        {
            order_id = 123,
            product_plan_id = 3,
            is_enabled = true,
            payment_type = "card",
            card_id = 1
        };

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);

            var jsonData = JsonSerializer.Serialize(data);
            var content = new StringContent(jsonData, Encoding.UTF8, "application/json");

            HttpResponseMessage response = await client.PostAsync(url, content);

            Console.WriteLine((int)response.StatusCode);

            string responseText = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
            Console.WriteLine(jsonResponse);
        }
    }
}
```

{% endtab %}
{% endtabs %}

**响应示例:**

```json
{
    "order_id": 202,
    "is_enabled": true,
    "product_plan_id": 3,
    "payment_type": "balance",
    "card_id": null
}
```


---

# 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.iproyal.com/cn/dai-li/jing-tai-zhu-zhai-dai-li/api/ding-dan.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.
