> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.sqril.io/llms.txt.
> For full documentation content, see https://docs.sqril.io/llms-full.txt.

# Get Quotation

POST https://api.sqril.com/getQuotation
Content-Type: application/json

Returns a quotation with **fee** (total SaaS fee in USD), **percentage_fee**, **fixed_fee**, **amount_usd** (USD notional for the quoted amount), and **exchange_rate** (USD per one unit of the transaction currency for this quotation) for a **PENDING** transaction (the **getQuotation** HTTP handler).

**Authentication**

- **REQUIRED**: Basic Auth `Authorization: Basic base64(client_id:client_secret)`. Body-based credentials are deprecated and not supported.
    
- `exchange_app_id` in the JSON body is **ignored**; the app id always comes from authentication (a mismatch is logged as a warning only).
    

**Request validation (order)**

- `tx_id` (string, **required**).
    
- `customer_id` (string, **required**)
    
    - be provided in request body,
        
    - not contain `/`,
        
    - exist under your account's `registered_customers`, and
        
    - match the `customer_id` bound to the transaction.
        
- `amount` (**optional**): when sent, must be **\> 0** (**400** `INVALID_AMOUNT` / "amount must be greater than 0 when provided").
    
- **401** if authentication fails (`AUTHENTICATION_REQUIRED`).
    

**Transaction checks**

- Loads `transactions/{tx_id}` (**404** `TRANSACTION_NOT_FOUND` if missing).
    
- **403** `TRANSACTION_NOT_OWNED` if the transaction’s `exchange_app_id` does not match the authenticated app, or if `customer_id` does not match the transaction’s bound `customer_id`.
    
- **400** `TRANSACTION_NOT_PENDING` if `status` is not `PENDING`.
    

**Effective amount**

- If the transaction already has a saved `amount` **\> 0**, that value is used and the request `amount` is ignored.
    
- Otherwise the request must supply `amount` **\> 0**; otherwise **400** `INVALID_AMOUNT` ("amount must be greater than 0 (provide in request or ensure transaction has amount saved)").
    

**Pricing**

- **Currency** is taken from stored `qr_data.currency` (fallback **USD** if absent).
    
- **Country** hint: `qr_data.country_code` is passed into `computePayoutPricingFromAccountRates` with the account’s rate rows.
    
- **400** `INVALID_CURRENCY` if pricing cannot be computed (bad amount / missing exchange rate for currency).
    

**`partner_transaction_id`**

- Optional. If the transaction has **no** partner id yet, the first non-empty value **sets** it on the transaction.
    
- If a partner id is **already** stored, omit the field or send the **same** value; a different value returns **400** `INVALID_REQUEST` with: `partner_transaction_id cannot be changed after it was set (for example in decodeQr). Omit the field or send the same value as stored.`
    

**Persistence**

- Updates the transaction with `amount`, `amount_usd`, `fee`, `percentage_fee`, `fixed_fee`, `exchange_rate`, `currency`, `quotation_expires_at` (**30 minutes** from quotation time), and `updated_at`.
    

**Response (200 JSON)**

- `tx_id`, `amount`, `currency`
    
- `exchange_rate`: **10** decimal places in JSON (`formatExchangeRateForApiResponse`)
    
- `amount_usd`, `fee`, `percentage_fee`, `fixed_fee`: **2** decimal places in JSON (`formatUsdForApiResponse`; banker-style rounding per `apiMoneyFormatting`)
    
- `expires_at`: ISO 8601 string
    
- The HTTP response uses rounded values; Firestore may retain higher precision on the transaction document.
    

**Use case:** **decodeQr** → **getQuotation** (lock amount/fees before **executePayout**).

**Precision:** See the collection overview tables for currency input versus USD and exchange-rate field formatting.

Reference: https://docs.sqril.io/sqril-saa-s-api/payout-endpoints/get-quotation

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /getQuotation:
    post:
      operationId: get-quotation
      summary: Get Quotation
      description: >-
        Returns a quotation with **fee** (total SaaS fee in USD),
        **percentage_fee**, **fixed_fee**, **amount_usd** (USD notional for the
        quoted amount), and **exchange_rate** (USD per one unit of the
        transaction currency for this quotation) for a **PENDING** transaction
        (the **getQuotation** HTTP handler).


        **Authentication**


        - **REQUIRED**: Basic Auth `Authorization: Basic
        base64(client_id:client_secret)`. Body-based credentials are deprecated
        and not supported.
            
        - `exchange_app_id` in the JSON body is **ignored**; the app id always
        comes from authentication (a mismatch is logged as a warning only).
            

        **Request validation (order)**


        - `tx_id` (string, **required**).
            
        - `customer_id` (string, **required**)
            
            - be provided in request body,
                
            - not contain `/`,
                
            - exist under your account's `registered_customers`, and
                
            - match the `customer_id` bound to the transaction.
                
        - `amount` (**optional**): when sent, must be **\> 0** (**400**
        `INVALID_AMOUNT` / "amount must be greater than 0 when provided").
            
        - **401** if authentication fails (`AUTHENTICATION_REQUIRED`).
            

        **Transaction checks**


        - Loads `transactions/{tx_id}` (**404** `TRANSACTION_NOT_FOUND` if
        missing).
            
        - **403** `TRANSACTION_NOT_OWNED` if the transaction’s `exchange_app_id`
        does not match the authenticated app, or if `customer_id` does not match
        the transaction’s bound `customer_id`.
            
        - **400** `TRANSACTION_NOT_PENDING` if `status` is not `PENDING`.
            

        **Effective amount**


        - If the transaction already has a saved `amount` **\> 0**, that value
        is used and the request `amount` is ignored.
            
        - Otherwise the request must supply `amount` **\> 0**; otherwise **400**
        `INVALID_AMOUNT` ("amount must be greater than 0 (provide in request or
        ensure transaction has amount saved)").
            

        **Pricing**


        - **Currency** is taken from stored `qr_data.currency` (fallback **USD**
        if absent).
            
        - **Country** hint: `qr_data.country_code` is passed into
        `computePayoutPricingFromAccountRates` with the account’s rate rows.
            
        - **400** `INVALID_CURRENCY` if pricing cannot be computed (bad amount /
        missing exchange rate for currency).
            

        **`partner_transaction_id`**


        - Optional. If the transaction has **no** partner id yet, the first
        non-empty value **sets** it on the transaction.
            
        - If a partner id is **already** stored, omit the field or send the
        **same** value; a different value returns **400** `INVALID_REQUEST`
        with: `partner_transaction_id cannot be changed after it was set (for
        example in decodeQr). Omit the field or send the same value as stored.`
            

        **Persistence**


        - Updates the transaction with `amount`, `amount_usd`, `fee`,
        `percentage_fee`, `fixed_fee`, `exchange_rate`, `currency`,
        `quotation_expires_at` (**30 minutes** from quotation time), and
        `updated_at`.
            

        **Response (200 JSON)**


        - `tx_id`, `amount`, `currency`
            
        - `exchange_rate`: **10** decimal places in JSON
        (`formatExchangeRateForApiResponse`)
            
        - `amount_usd`, `fee`, `percentage_fee`, `fixed_fee`: **2** decimal
        places in JSON (`formatUsdForApiResponse`; banker-style rounding per
        `apiMoneyFormatting`)
            
        - `expires_at`: ISO 8601 string
            
        - The HTTP response uses rounded values; Firestore may retain higher
        precision on the transaction document.
            

        **Use case:** **decodeQr** → **getQuotation** (lock amount/fees before
        **executePayout**).


        **Precision:** See the collection overview tables for currency input
        versus USD and exchange-rate field formatting.
      tags:
        - subpackage_payoutEndpoints
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/Payout Endpoints_Get
                  Quotation_Response_200
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostGetquotationRequestBadRequestError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostGetquotationRequestUnauthorizedError'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostGetquotationRequestNotFoundError'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                tx_id:
                  type: string
                amount:
                  type: integer
                customer_id:
                  type: string
              required:
                - tx_id
                - amount
                - customer_id
servers:
  - url: https://api.sqril.com
  - url: https://your-app.com
components:
  schemas:
    Payout Endpoints_Get Quotation_Response_200:
      type: object
      properties:
        tx_id:
          type: string
        amount:
          type: integer
        currency:
          type: string
        exchange_rate:
          type: number
          format: double
        amount_usd:
          type: number
          format: double
        fee:
          type: number
          format: double
        percentage_fee:
          type: number
          format: double
        fixed_fee:
          type: number
          format: double
        expires_at:
          type: string
          format: date-time
      required:
        - tx_id
        - amount
        - currency
        - exchange_rate
        - amount_usd
        - fee
        - percentage_fee
        - fixed_fee
        - expires_at
      title: Payout Endpoints_Get Quotation_Response_200
    PostGetquotationRequestBadRequestError:
      type: object
      properties:
        error:
          type: string
        error_code:
          type: string
      required:
        - error
        - error_code
      title: PostGetquotationRequestBadRequestError
    PostGetquotationRequestUnauthorizedError:
      type: object
      properties:
        error:
          type: string
        error_code:
          type: string
      required:
        - error
        - error_code
      title: PostGetquotationRequestUnauthorizedError
    PostGetquotationRequestNotFoundError:
      type: object
      properties:
        error:
          type: string
        error_code:
          type: string
        tx_id:
          type: string
      required:
        - error
        - error_code
        - tx_id
      title: PostGetquotationRequestNotFoundError

```

## SDK Code Examples

```python Payout Endpoints_Get Quotation_example
import requests

url = "https://api.sqril.com/getQuotation"

payload = {
    "tx_id": "{{tx_id}}",
    "amount": 200000,
    "customer_id": "{{customer_id}}"
}
headers = {"Content-Type": "application/json"}

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

print(response.json())
```

```javascript Payout Endpoints_Get Quotation_example
const url = 'https://api.sqril.com/getQuotation';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"tx_id":"{{tx_id}}","amount":200000,"customer_id":"{{customer_id}}"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Payout Endpoints_Get Quotation_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.sqril.com/getQuotation"

	payload := strings.NewReader("{\n  \"tx_id\": \"{{tx_id}}\",\n  \"amount\": 200000,\n  \"customer_id\": \"{{customer_id}}\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Payout Endpoints_Get Quotation_example
require 'uri'
require 'net/http'

url = URI("https://api.sqril.com/getQuotation")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"tx_id\": \"{{tx_id}}\",\n  \"amount\": 200000,\n  \"customer_id\": \"{{customer_id}}\"\n}"

response = http.request(request)
puts response.read_body
```

```java Payout Endpoints_Get Quotation_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.sqril.com/getQuotation")
  .header("Content-Type", "application/json")
  .body("{\n  \"tx_id\": \"{{tx_id}}\",\n  \"amount\": 200000,\n  \"customer_id\": \"{{customer_id}}\"\n}")
  .asString();
```

```php Payout Endpoints_Get Quotation_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.sqril.com/getQuotation', [
  'body' => '{
  "tx_id": "{{tx_id}}",
  "amount": 200000,
  "customer_id": "{{customer_id}}"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Payout Endpoints_Get Quotation_example
using RestSharp;

var client = new RestClient("https://api.sqril.com/getQuotation");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"tx_id\": \"{{tx_id}}\",\n  \"amount\": 200000,\n  \"customer_id\": \"{{customer_id}}\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Payout Endpoints_Get Quotation_example
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "tx_id": "{{tx_id}}",
  "amount": 200000,
  "customer_id": "{{customer_id}}"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.sqril.com/getQuotation")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```