Zakup z koszyka

Lista wszystkich publicznie dostępnych metod interakcji z API.

PUT

Zakup z koszyka

/cart/purchase

Zrealizowanie zamówienia

Ta metoda służy do zrealizowania zamówienia. Aby to zrobić, należy przesłać parametry order_id oraz overall (czyli total_price, wyrażoną w walucie użytkownika) z v2/cart/order do tego punktu końcowego.

Ta metoda wymaga autoryzacji!
Możesz skorzystać z własnego klucza API, który znajdziesz pod adresem {panel sterowania.
Ta metoda - wymaga uprawnień -cart.purchase
Tworząc token API w swoim panelu sterowania, możesz wybrać określone uprawnienia (np. uniemożliwić tokenowi składanie zamówień).
Listę uprawnień znajdziesz także w naszej dokumentacji.

Metoda zapytania

PUThttps://api.stableproxy.com/v2/cart/purchase

Parametry zapytania

IdentyfikatorRegulaminPrzykład
order_idrequiredstring"bbb940d1-3263-4dd3-ae93-9e2d31e2e0ce"
overallrequirednumeric3.34

Przykłady kodu

1const baseUrl = "https://api.stableproxy.com/v2";
2const response = await fetch(baseUrl + "/cart/purchase", {
3 method: "PUT",
4 headers: {
5 "Authorization": "API-Token [YOUR TOKEN]",
6 "Content-Type": "application/json"
7 },
8 body: JSON.stringify({
9 "order_id": "\"bbb940d1-3263-4dd3-ae93-9e2d31e2e0ce\"",
10 "overall": "3.34"
11 })
12});
13const data = await response.json();

Przykłady odpowiedzi

Success response200application/json
{
  "data": {
    "response": {
      "buyed": true,
      "paid": true
    },
    "package": {
      "is_waiting_activation": false,
      "is_given": false,
      "last_paid_date": "2024-11-11T08:55:04.000000Z",
      "user_id": 1,
      "uid": "C7RS-PLMLOS",
      "uuid": "ZENQ-HQ0KIU",
      "updated_at": "2024-11-11T08:55:04.000000Z",
      "created_at": "2024-11-11T08:55:04.000000Z",
      "id": 11246,
      "order_id": "bbb940d1-3263-4dd3-ae93-9e2d31e2e0ce",
      "proxy_usernames": [],
      "proxy_passwords": [],
      "proxy_auth_ips": [],
      "bandwidth_summary": {
        "bytes_used": 0,
        "bytes_remaining": 0,
        "bytes_limit": 1,
        "bytes_projected": 0
      },
      "requests_summary": {
        "total": 0,
        "successful": 0,
        "failed": 0,
        "last_at": 0
      },
      "stop_date": [],
      "delete_date": [],
      "can_renew": true,
      "prefer_ip_auth": false,
      "total_proxy_diffs_visited": 0,
      "is_super_proxy": true,
      "order": {
        "id": "bbb940d1-3263-4dd3-ae93-9e2d31e2e0ce",
        "type": "shared",
        "count": 30,
        "traffic_amount": 100,
        "traffic_unit": "gb",
        "period_amount": 1,
        "period_unit": "weeks",
        "countries": {
          "PL": 6,
          "FR": 24
        },
        "currency": "USD",
        "added_price_per_day": 0,
        "has_unlimited_auth_ips": false,
        "user_id": 1,
        "version": 32,
        "deleted_at": null,
        "created_at": "2024-11-11T08:55:04.000000Z",
        "updated_at": "2024-11-11T08:55:04.000000Z",
        "already_spent_in_usd": 3,
        "ip_score": 0,
        "geo_service": "adspower",
        "already_spent": 3,
        "pay_for_setup": false,
        "prices": {
          "overall": 3.82,
          "one_proxy": 0.08,
          "overall_formatted": "$3.82",
          "one_proxy_formatted": "$0.08 - 1 proxy",
          "overall_usd": 3.82,
          "one_proxy_usd": 0.08,
          "overall_formatted_usd": "$3.82",
          "version": 32,
          "one_proxy_formatted_usd": "$0.08 - 1 proxy",
          "currency": "USD",
          "sale_percentage": 1.05,
          "sale_amount_usd": 0.19,
          "sale_amount": 0.19
        },
        "renew_prices": {
          "overall": 3.82,
          "one_proxy": 0.08,
          "overall_formatted": "$3.82",
          "one_proxy_formatted": "$0.08 - 1 proxy",
          "overall_usd": 3.82,
          "one_proxy_usd": 0.08,
          "overall_formatted_usd": "$3.82",
          "version": 32,
          "one_proxy_formatted_usd": "$0.08 - 1 proxy",
          "currency": "USD",
          "sale_percentage": 1.05,
          "sale_amount_usd": 0.19,
          "sale_amount": 0.19
        }
      },
      "proxy_countries": {
        "PL": 6,
        "FR": 24
      },
      "proxy_count": 0,
      "connect_keep_alive_seconds": 1,
      "is_disabled": null,
      "features": [
        {
          "id": "prefer.index",
          "name": "floating IP",
          "description": "Yes, if you enable \"floating IP\", the user will not need to make any changes when changing the IP address. The system will automatically support another IP that will work without additional actions from the user.",
          "default": true,
          "enabled": true
        },
        {
          "id": "prefer.ip-auth",
          "name": "Authorization by IP",
          "description": "Authorization by IP address includes the ability to access the proxy server without using a login and password. To do this, you need to add the appropriate settings to the order configuration.",
          "default": false,
          "enabled": false
        },
        {
          "id": "show.out-ips",
          "name": "Show source IPs",
          "description": "This function displays the IP addresses of each proxy. Please note that these addresses cannot be used for connection!",
          "default": false,
          "enabled": false
        },
        {
          "id": "show.hidden",
          "name": "Show hidden proxies",
          "description": "",
          "default": false,
          "enabled": false
        },
        {
          "id": "auto.renew",
          "name": "Auto-renew",
          "description": "Auto-renew your order: Ensure service continuity by automatically renewing your order for maximum convenience and a seamless experience. Please note that to use this option you need to have sufficient funds on your balance.",
          "default": true,
          "enabled": true
        }
      ],
      "is_super_proxy_selector": true
    },
    "balance_history": [
      {
        "id": 59988,
        "user_id": 1,
        "created_at": "2024-11-11T08:55:04.000000Z",
        "updated_at": "2024-11-11T08:55:04.000000Z",
        "payment_id": "bbb940d1-3263-4dd3-ae93-9e2d31e2e0ce",
        "description": "Order Reservation #11246",
        "data": {
          "package_uid": "C7RS-PLMLOS",
          "package_id": 11246,
          "order": {
            "version": 32,
            "added_price_per_day": 0,
            "already_spent_in_usd": 3,
            "count": 30,
            "traffic_amount": 100,
            "traffic_unit": "gb",
            "period_amount": 1,
            "period_unit": "weeks",
            "countries": {
              "PL": 6,
              "FR": 24
            },
            "currency": "USD",
            "type": "shared",
            "has_unlimited_auth_ips": false,
            "user_id": 1,
            "ip_score": 0,
            "geo_service": "adspower",
            "id": "bbb940d1-3263-4dd3-ae93-9e2d31e2e0ce",
            "updated_at": "2024-11-11T08:55:04.000000Z",
            "created_at": "2024-11-11T08:55:04.000000Z",
            "already_spent": 3,
            "pay_for_setup": false,
            "prices": {
              "overall": 3.82,
              "one_proxy": 0.08,
              "overall_formatted": "$3.82",
              "one_proxy_formatted": "$0.08 - 1 proxy",
              "overall_usd": 3.82,
              "one_proxy_usd": 0.08,
              "overall_formatted_usd": "$3.82",
              "version": 32,
              "one_proxy_formatted_usd": "$0.08 - 1 proxy",
              "currency": "USD",
              "sale_percentage": 1.05,
              "sale_amount_usd": 0.19,
              "sale_amount": 0.19
            },
            "renew_prices": {
              "overall": 3.82,
              "one_proxy": 0.08,
              "overall_formatted": "$3.82",
              "one_proxy_formatted": "$0.08 - 1 proxy",
              "overall_usd": 3.82,
              "one_proxy_usd": 0.08,
              "overall_formatted_usd": "$3.82",
              "version": 32,
              "one_proxy_formatted_usd": "$0.08 - 1 proxy",
              "currency": "USD",
              "sale_percentage": 1.05,
              "sale_amount_usd": 0.19,
              "sale_amount": 0.19
            }
          }
        },
        "type": "reserve-package",
        "hide": false,
        "balance_before": 1810.73,
        "balance_after": 1806.91,
        "amount": -3.82,
        "currency": "USD",
        "is_delayed": false,
        "delayed_until_date": null,
        "balance_before_in_usd": 1810.73,
        "balance_after_in_usd": 1806.91,
        "amount_in_usd": -3.82,
        "invoice_url": null
      }
    ]
  },
  "good": true,
  "timestamp": 1731315304,
  "cause": {
    "type": "user",
    "user_id": 1,
    "token_id": 302,
    "token_sign": "8491affc7321d0925064c90eeeee53d2"
  }
}