Parameters

amount
integer
required

Amount of the invoice that client have to pay

currency
'usd' | 'btc' | 'eth' | 'ton' | 'usdt-erc20' | 'usdt-trc20' | 'usdc-erc20'
required

The currency of the invoice. If set to usd then the invoice will be created without coin network assigned to it, in that case user will be able to choose the coin network manually in the checkout page. For any other input the coin network will be assigned automatically assigned to invoice

title
string

Title of the invoice

description
string

Description of the invoice.

post_paid_text
string
deprecated

Text that will be shown user only after successful payment.

DO NOT use this for storing any important for the order information, it will be not accessible shortly after the invoice has been paid.

custom_data
json

Custom data allows you store any combination of valid json data in the invoice. It will be accessible in a webhook for the invoice, meaning you can not store any invoice information manually in your database and only read it from this field

simulated_invoice
bool
default:"false"

Whether or not the invoice is simulated. Simulated invoices are intended for testing and development. Such invoices are not subject to fees, are not affecting statistics and can be marked as paid from the dashboard to trigger webhooks and test integration.

Note that you cannot use simulated invoices for real payments as they are not being monitored for transactions, you can only mark them as paid in console

live_wallet
string

Wallet address for live wallet. If provided, API will use that provided wallet instead of one provided in dashboard, useful for one time or highly dynamic wallets

redirect_url
string

If set, after payment, once the payment is successful, user will be presented with button to be redirected to specified URL

Response:

id
uuid/string

id of the invoice as string, specifically UUID

amount
float

Amount of the invoice

currency
string

Currency of the invoice

fiat_amount_usd
float

The invoice amount in USD

created_at
integer

Time of creation of invoice, UNIX timestamp

valid_until
integer

Time of when invoice expires, UNIX timestamp

status
string

Current status of the invoice

Link to checkout page, defaults to checkout.squaredinc.co/invoice_id, if you have custom domain configured it will automatically switch to customdomain.com/invoice_id without any additional configuration

wallet
string

Wallet address of the invoice, where user will be asked to transfer funds

Example

from squaredinc_sdk import SquaredSDK

squared = SquaredSDK(
    api_key="your-api-key"
)

invoice = squared.create_invoice(
    amount=10,
    currency="usd",
    title="My First invoice:)",
    description="This is the example of Squared Inc. invoice created with Python SDK",
    post_paid_text="Your first invoice has been paid!",
    custom_data={
        "customer_id": "cust_12345",
        "is_first_time_order": True,
        "tags": ["new-customer", "promo"],
        "product": {"name": "Basic Plan", "id": "prod_123"}
    },
    simulated_invoice=False
)
print(invoice)

Return

Create invoice API will return the invoice object:

 {
  "id": "e2c2903b-0f18-4a06-8e7a-94d3689f5c9c",
  "amount": 10.00000113,
  "currency": "ton",
  "fiat_amount_usd": 35.95,
  "created_at": 1748435780,
  "valid_until": 1748439380,
  "status": "pending_payment",
  "link": "https://checkout.squaredinc.co/e2c2903b-0f18-4a06-8e7a-94d3689f5c9c",
  "wallet_address": "EQCdKxKwSCRI0_ASdAHKQ2qnyNT24EP4zTFOHQJc33estL5m",
  "redirect_url": "https://example.com/user_id/profile/subscription"
}