Orders

Attachments are how you share things in Protocol — they allow you to send all sorts of files to your contacts and groups. On this page, we'll dive into the different attachment endpoints you can use to manage attachments programmatically. We'll look at how to query, upload, update, and delete attachments.

The Order object

The order object contains all the information about an order.

Properties

  • Name
    id
    Type
    string
    Description

    Unique identifier for the order.

  • Name
    product_id
    Type
    string
    Description

    Unique identifier for the Product associated with the order.

  • Name
    payment_request_id
    Type
    string
    Description

    Unique identifier for the Payment Request associated with the order.

  • Name
    product_type
    Type
    enum
    Description

    Product type determined from whether the order is from a Product or a Payment Request.

    Possible values are:

    • product
    • payment_request
  • Name
    email
    Type
    string
    Description

    The customer's email address.

  • Name
    ip_address
    Type
    string
    Description

    The customer's IP address.

  • Name
    country_code
    Type
    string
    Description

    The customer's ISO 3166-1 Alpha-2 country code.

  • Name
    payment_gateway
    Type
    enum
    Description

    The payment gateway used for the order. The following payment gateways are supported:

    • paypal
    • stripe
    • cashapp
    • bitcoin
    • ethereum
    • litecoin
    • bitcoin_cash
    • perfect_money
    • skrill
    • dash
    • ripple
    • zcash
    • nano
    • digibyte
    • dogecoin
    • monero
    • bnb
    • polygon
  • Name
    status
    Type
    integer
    Description

    The current status of the order. This will be replaced with an enum string in the future. Possible statuses are:

    • 0 - Not paid
    • 1 - Expired
    • 5 - Bad card
    • 10 - Blocked
    • 11 - Canceled
    • 50 - Fraudulent match
    • 51 - Chargeback/Reversal
    • 52 - High risk
    • 53 - Partially paid cryptocurrency
    • 54 - Confirming cryptocurrency
    • 55 - Pending
    • 56 - Refunded
    • 100 - Completed
  • Name
    currency
    Type
    string
    Description

    The ISO 4217 currency code used for this order.

  • Name
    value
    Type
    decimal
    Description

    The value of the order in currency.

  • Name
    amounts
    Type
    object
    Description

    A key-value object of the order amount in all supported currencies.

  • Name
    exchange_rates
    Type
    object
    Description

    A key-value object of the exchange rates used to determine the amounts.

  • Name
    quantity
    Type
    integer
    Description

    Quantity of the product purchased. Default is 1.

  • Name
    delivered
    Type
    string
    Description

    The delivered product that the customer purchased. Default is null.

  • Name
    crypto_address
    Type
    string
    Description

    The cryptocurrency address the customer pays for this order.

  • Name
    crypto_value
    Type
    integer
    Description

    The cryptocurrency value required to complete this order. This is represented in the equivalent of satoshis.

  • Name
    crypto_received
    Type
    integer
    Description

    The cryptocurrency value received for this order so far.

  • Name
    crypto_confirmations
    Type
    integer
    Description

    The current number of cryptocurrency confirmations.

  • Name
    crypto_exchange_rates
    Type
    object
    Description

    A key-value object of the exchange rates used to determine the amount of the crypto_value property.

  • Name
    tax_inclusivity
    Type
    float
    Description

    The tax type used for this order with possible options being inclusive or exclusive. Defaults to null if no tax is applied.

  • Name
    tax_rate
    Type
    float
    Description

    The tax rate used for this order. Defaults to null.

  • Name
    tax_amount
    Type
    float
    Description

    The amount of tax applied to this order in the currency. Defaults to null.

  • Name
    event_logs
    Type
    array
    Description
    Events that have occurred for this order.
    • Name
      event_type
      Type
      enum
      Description

      The type of event. Possible events are:

      • completed
      • delivered
      • delivery_email_opened
      • received_payment
      • crypto_confirming
      • refunded
      • manually_processed
      • reversed
      • reversal_reversed
      • delivered_goods_replaced
      • blocked
      • partial_crypto_payment
    • Name
      metadata
      Type
      object
      Description

      Any extra metadata associated with the event.

    • Name
      created_at
      Type
      timestamp
      Description

      The time at which the event occurred.

  • Name
    metadata
    Type
    object
    Description

    Metadata key/value object containing custom input name and value or extra metadata set during Payment API creation.

  • Name
    expires_at
    Type
    timestamp
    Description

    Timestamp of when the order expires if it is a cryptocurrency payment.

  • Name
    warranty_expires_at
    Type
    timestamp
    Description

    Timestamp of when the order's warranty expires.

  • Name
    created_at
    Type
    timestamp
    Description

    Timestamp of when the order was created.

  • Name
    updated_at
    Type
    timestamp
    Description

    Timestamp of when the order was last updated.


GET/v2/orders

List all orders

This endpoint allows you to retrieve a paginated list of all your orders. By default, a maximum of 20 orders are shown per page.

Optional attributes

  • Name
    page
    Type
    integer
    Description

    The page number. Defaults to 1

  • Name
    per_page
    Type
    integer
    Description

    Records per page. Defaults to 20.

Request

GET
/api/v2/orders
curl -G https://selly.io/api/v2/orders \
  -H "Authorization: Bearer {token}" \
  -d page=1

Response

[
  {
    "id": "58ec23f4-32ec-4f35-875c-4918e030e939",
    "product_id": "8069720f",
    "product_type": "product",
    "email": "customer@example.com",
    "ip_address": "172.18.0.9",
    "country_code": "US",
    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
    "value": "14.18",
    "quantity": 1,
    "currency": "USD",
    "payment_gateway": "paypal",
    "risk_level": 14,
    "status": 100,
    "delivered": "SERIAL-123456",
    "crypto_value": null,
    "crypto_address": null,
    "crypto_received": 0,
    "crypto_confirmations": 0,
    "crypto_exchange_rates": null,
    "referral": null,
    "amounts": {
        "AED": 52.07,
        "ARS": 11405.58,
        "AUD": 20.96,
        "AZN": 24.12,
        "BRL": 69.34,
        "CAD": 18.93,
        "CHF": 12.18,
        "CNY": 101.25,
        "CRC": 7538.06,
        "CZK": 316.26,
        "DKK": 96.24,
        "EUR": 12.9,
        "GBP": 11.2,
        "HKD": 110.72,
        "HUF": 4930.88,
        "ILS": 51.29,
        "INR": 1180.1,
        "ISK": 1949.18,
        "JPY": 2023.13,
        "KRW": 18422.7,
        "MXN": 241.77,
        "MYR": 66.01,
        "NGN": 11691.64,
        "NOK": 146.14,
        "NZD": 22.63,
        "PHP": 787.09,
        "PKR": 3959.06,
        "PLN": 56.05,
        "QAR": 51.63,
        "RON": 64.16,
        "RUB": 1304.66,
        "SAR": 53.12,
        "SEK": 143.25,
        "SGD": 18.83,
        "THB": 494.02,
        "TRY": 413.3,
        "TWD": 456.37,
        "USD": 14.18,
        "ZAR": 275.94
    },
    "exchange_rates": {
        "AED": 3.672,
        "ARS": 804.343,
        "AUD": 1.478,
        "AZN": 1.701,
        "BRL": 4.89,
        "CAD": 1.335,
        "CHF": 0.859,
        "CNY": 7.14,
        "CRC": 531.598,
        "CZK": 22.303,
        "DKK": 6.787,
        "EUR": 0.91,
        "GBP": 0.79,
        "HKD": 7.808,
        "HUF": 347.735,
        "ILS": 3.617,
        "INR": 83.223,
        "ISK": 137.46,
        "JPY": 142.675,
        "KRW": 1299.203,
        "MXN": 17.05,
        "MYR": 4.655,
        "NGN": 824.516,
        "NOK": 10.306,
        "NZD": 1.596,
        "PHP": 55.507,
        "PKR": 279.2,
        "PLN": 3.953,
        "QAR": 3.641,
        "RON": 4.525,
        "RUB": 92.007,
        "SAR": 3.746,
        "SEK": 10.102,
        "SGD": 1.328,
        "THB": 34.839,
        "TRY": 29.147,
        "TWD": 32.184,
        "USD": 1.0,
        "ZAR": 19.46
    },
    "usd_value": "14.18",
    "tax_inclusivity": "exclusive",
    "tax_rate": "5.0",
    "tax_amount": "0.68",
    "coupon_id": null,
    "discount_type": null,
    "discount_amount": null,
    "discount_currency": null,
    "discount_percentage": null,
    "event_logs": [
        {
            "event_type": "completed",
            "metadata": null,
            "created_at": "2023-12-21T14:56:40.198+00:00"
        }
    ],
    "metadata": {},
    "warranty_expires_at": null,
    "expires_at": null,
    "created_at": "2023-12-21T13:21:37.000+00:00",
    "updated_at": "2023-12-21T14:56:40.000+00:00"
  },
  {
    "id": "058da777-4367-4485-a27d-4209e2f1aeee",
    // ...
  }
]

GET/v2/orders/:id

Retrieve an order

This endpoint allows you to retrieve an order by providing the order id. Refer to the list at the top of this page to see which properties are included with order objects.

Request

GET
/api/v2/orders/:id
curl https://selly.io/api/v2/orders/58ec23f4-32ec-4f35-875c-4918e030e939 \
  -H "Authorization: Bearer {token}"

Response

{
  "id": "58ec23f4-32ec-4f35-875c-4918e030e939",
  "product_id": "8069720f",
  "product_type": "product",
  "email": "customer@example.com",
  "ip_address": "172.18.0.9",
  "country_code": "US",
  "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
  "value": "14.18",
  "quantity": 1,
  "currency": "USD",
  "payment_gateway": "paypal",
  "risk_level": 14,
  "status": 100,
  "delivered": "SERIAL-123456",
  "crypto_value": null,
  "crypto_address": null,
  "crypto_received": 0,
  "crypto_confirmations": 0,
  "crypto_exchange_rates": null,
  "referral": null,
  "amounts": {
      "AED": 52.07,
      "ARS": 11405.58,
      "AUD": 20.96,
      "AZN": 24.12,
      "BRL": 69.34,
      "CAD": 18.93,
      "CHF": 12.18,
      "CNY": 101.25,
      "CRC": 7538.06,
      "CZK": 316.26,
      "DKK": 96.24,
      "EUR": 12.9,
      "GBP": 11.2,
      "HKD": 110.72,
      "HUF": 4930.88,
      "ILS": 51.29,
      "INR": 1180.1,
      "ISK": 1949.18,
      "JPY": 2023.13,
      "KRW": 18422.7,
      "MXN": 241.77,
      "MYR": 66.01,
      "NGN": 11691.64,
      "NOK": 146.14,
      "NZD": 22.63,
      "PHP": 787.09,
      "PKR": 3959.06,
      "PLN": 56.05,
      "QAR": 51.63,
      "RON": 64.16,
      "RUB": 1304.66,
      "SAR": 53.12,
      "SEK": 143.25,
      "SGD": 18.83,
      "THB": 494.02,
      "TRY": 413.3,
      "TWD": 456.37,
      "USD": 14.18,
      "ZAR": 275.94
  },
  "exchange_rates": {
      "AED": 3.672,
      "ARS": 804.343,
      "AUD": 1.478,
      "AZN": 1.701,
      "BRL": 4.89,
      "CAD": 1.335,
      "CHF": 0.859,
      "CNY": 7.14,
      "CRC": 531.598,
      "CZK": 22.303,
      "DKK": 6.787,
      "EUR": 0.91,
      "GBP": 0.79,
      "HKD": 7.808,
      "HUF": 347.735,
      "ILS": 3.617,
      "INR": 83.223,
      "ISK": 137.46,
      "JPY": 142.675,
      "KRW": 1299.203,
      "MXN": 17.05,
      "MYR": 4.655,
      "NGN": 824.516,
      "NOK": 10.306,
      "NZD": 1.596,
      "PHP": 55.507,
      "PKR": 279.2,
      "PLN": 3.953,
      "QAR": 3.641,
      "RON": 4.525,
      "RUB": 92.007,
      "SAR": 3.746,
      "SEK": 10.102,
      "SGD": 1.328,
      "THB": 34.839,
      "TRY": 29.147,
      "TWD": 32.184,
      "USD": 1.0,
      "ZAR": 19.46
  },
  "usd_value": "14.18",
  "tax_inclusivity": "exclusive",
  "tax_rate": "5.0",
  "tax_amount": "0.68",
  "coupon_id": null,
  "discount_type": null,
  "discount_amount": null,
  "discount_currency": null,
  "discount_percentage": null,
  "event_logs": [
      {
          "event_type": "completed",
          "metadata": null,
          "created_at": "2023-12-21T14:56:40.198+00:00"
      }
  ],
  "metadata": {},
  "warranty_expires_at": null,
  "expires_at": null,
  "created_at": "2023-12-21T13:21:37.000+00:00",
  "updated_at": "2023-12-21T14:56:40.000+00:00"
}