Proxy Sale
  • Introduction
  • Getting Started
  • API Reference
    • Balance
      • Get Balance
      • Add Balance
      • Pay Methods
    • Proxies
      • List Proxies
      • Download Proxies
      • Set Proxy Comments
    • Order
      • Reference List
      • Calculate Order
      • Create Order
    • Renewal
      • Calculate Renewal
      • Create Renewal Order
    • Residential Proxies
      • Package Info
      • Download Geo
      • Get IP Lists
      • Create IP List
      • Rename IP List
      • Delete IP List
      • API-TOOL
  • Users Links
    • FAQ
    • Blog
  • Support
    • support@proxy-sale.com
    • Telegram
Powered by GitBook
On this page
  1. API Reference
  2. Order

Calculate Order

PreviousReference ListNextCreate Order

Last updated 1 year ago

POST https://proxy-sale.com/personal/api/v1/{apiKey}/order/calc

This endpoint calculates the cost of an order based on the specified proxy configurations, which you can obtain from the . It is designed to provide you with an estimate before finalizing the purchase, aiding in your planning and budgeting for proxy needs.

Headers

Name
Value

Content-Type

application/json

Path Parameters

Name
Type
Description

apiKey*

string

API key to authorize requests

Body parameters

Name
Type
For Proxy Type
Description

coupon

string

All

Optional promotional code for discounts.

countryId*

integer

IPV4, IPV6, ISP, Mobile

Country ID for the proxy location.

periodId*

string

All

Duration for proxy rental, e.g., "30d" for 30 days.

quantity*

integer

IPV4, IPV6, ISP, Mobile

Number of proxies required.

authorization

string

IPV4, IPV6, ISP, Mobile

IP address for authorization (optional).

targetSectionId

integer

IPV4, ISP, Resident

Section ID for specific proxy targets (optional).

targetId

integer

IPV4, ISP, Resident

ID of the target website or service, 0 for custom.

customTargetName

string

IPV4, ISP, IPV6*,

Resident

Name of the custom target, used when targetId is 0.

protocol

string

IPV6, potentially others

Proxy protocol (HTTPS/SOCKS5).

operatorId*

string

Mobile

Operator ID for mobile proxies.

rotationId*

integer

Mobile

Rotation settings for mobile proxies.

tarifId*

integer

Resident

Tariff ID for resident proxies.

Request examples

curl -X 'POST' \
  'https://proxy-sale.com/personal/api/v1/YOUR_API_KEY_HERE/order/calc' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "coupon": "OZGCNK_1",
  "countryId": 3350393,
  "periodId": "30d",
  "quantity": 5,
  "authorization": "127.0.0.1",
  "targetSectionId": 99,
  "targetId": 0,
  "customTargetName": "Another target"
}'
<?php

$url = 'https://proxy-sale.com/personal/api/v1/YOUR_API_KEY_HERE/order/calc';
$data = array(
    'coupon' => 'OZGCNK_1',
    'countryId' => 3350393,
    'periodId' => '30d',
    'quantity' => 5,
    'authorization' => '127.0.0.1',
    'targetSectionId' => 99,
    'targetId' => 0,
    'customTargetName' => 'Another target'
);

$payload = json_encode($data);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
    'Content-Length: ' . strlen($payload)
));

$result = curl_exec($ch);

curl_close($ch);

echo $result;
?>
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.OutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class CalcOrderExample {
    public static void main(String[] args) {
        try {
            URL url = new URL("https://proxy-sale.com/personal/api/v1/YOUR_API_KEY_HERE/order/calc");
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setRequestMethod("POST");
            conn.setRequestProperty("accept", "application/json");
            conn.setRequestProperty("Content-Type", "application/json");
            conn.setDoOutput(true);

            String input = "{\"coupon\": \"OZGCNK_1\",\"countryId\": 3350393,\"periodId\": \"30d\",\"quantity\": 5,\"authorization\": \"127.0.0.1\",\"targetSectionId\": 99,\"targetId\": 0,\"customTargetName\": \"Another target\"}";

            try (OutputStream os = conn.getOutputStream()) {
                byte[] inputBytes = input.getBytes("utf-8");
                os.write(inputBytes, 0, inputBytes.length);
            }

            BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
            String output;
            while ((output = br.readLine()) != null) {
                System.out.println(output);
            }

            conn.disconnect();

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Response examples

If you receive a "warning" in the response, please fix the issue mentioned before making your order.

{
  "status": "success",
  "data": {
    "price": 1.8,
    "warning": "Insufficient funds. Total $4.38. Not enough $4.62",
    "balance": 4.38,
    "total": 9,
    "quantity": 5,
    "currency": "USD",
    "discount": 0
  },
  "errors": []
}
reference list