Orders

An Order represents a sale or transfer that must be previously delivered before it can be invoiced.

Order object

Order line object

Create an order

POST https://api.piriod.com/orders/

This endpoint creates a draft order. To convert a draft order to a real order use Finalize an order API method.

Request Body

{
  "id": "ord_tnlUbv0YSTbzmsx7oH",
  "customer": {
    "id": "cus_APxT9s7X12ilP9Zx9O",
    "name": "Acme Nation LLC",
    "address": "17st, National Sub",
    "state": "IL",
    "country": "US",
    "phone": null,
    "email": "billing@stark.com",
    "website": "https://www.stark.com",
    "aggregations": {
      "balance": 5756.00,
      "sales": 14324.36,
      "sales_current_period": 1873.00
    },
    "tax_settings": {},
    "metadata": {},
    "created": "2020-05-12 15:42:09",
    "updated": "2020-05-12 21:16:12"
  },
  "number": 1726,
  "document": {
    "id": "US2",
    "name": "Order",
    "country": "US",
    "currency": {
      "id": "USD",
      "available": true,
      "conversion": null,
      "country": "US",
      "default": true,
      "is_chargeable": true,
      "name": "Dólar Estadounidense",
      "name_en": "American Dollar",
      "rounded": false
    }
  },
  "test_mode": false,
  "date": "2020-10-21",
  "address": null,
  "carrier_id": null,
  "carrier_name": null,
  "state": null,
  "licence_plate": null,
  "shipping_type": "1",
  "lines": [
    {
      "id": "lin_APxT9s7X12ilP9Zx9O",
      "name": "My physical product",
      "description": null,
      "quantity": 4.0,
      "amount": 500.00,
      "exempt": false,
      "tax": null,
      "tax_percent": 0,
      "total": 2000.00,
      "created": "2020-10-21T12:01:53.430966-04:00",
      "updated": "2020-10-21T12:01:53.430966-04:00"
    }
  ],
  "amount": 2000.00,
  "exempt": null,
  "tax": null,
  "tax_percent": 0,
  "total": 2000.00,
  "local_file": null,
  "tax_agency": {},
  "status": "draft",
  "created": "2020-10-21T09:55:07.138915-04:00",
  "updated": "2020-10-21T12:01:53.430966-04:00"
}

Retrieve an order

GET https://api.piriod.com/orders/{id}/

This endpoint retrieves an order.

Path Parameters

{
  "id": "ord_tnlUbv0YSTbzmsx7oH",
  "customer": {
    "id": "cus_APxT9s7X12ilP9Zx9O",
    "name": "Acme Nation LLC",
    "address": "17st, National Sub",
    "state": "IL",
    "country": "US",
    "phone": null,
    "email": "billing@stark.com",
    "website": "https://www.stark.com",
    "aggregations": {
      "balance": 5756.00,
      "sales": 14324.36,
      "sales_current_period": 1873.00
    },
    "tax_settings": {},
    "metadata": {},
    "created": "2020-05-12 15:42:09",
    "updated": "2020-05-12 21:16:12"
  },
  "number": 1726,
  "document": {
    "id": "US2",
    "name": "Order",
    "country": "US",
    "currency": {
      "id": "USD",
      "available": true,
      "conversion": null,
      "country": "US",
      "default": true,
      "is_chargeable": true,
      "name": "Dólar Estadounidense",
      "name_en": "American Dollar",
      "rounded": false
    }
  },
  "test_mode": false,
  "date": "2020-10-21",
  "address": null,
  "carrier_id": null,
  "carrier_name": null,
  "state": null,
  "licence_plate": null,
  "shipping_type": "1",
  "lines": [
    {
      "id": "lin_APxT9s7X12ilP9Zx9O",
      "name": "My physical product",
      "description": null,
      "quantity": 4.0,
      "amount": 500.00,
      "exempt": false,
      "tax": null,
      "tax_percent": 0,
      "total": 2000.00,
      "created": "2020-10-21T12:01:53.430966-04:00",
      "updated": "2020-10-21T12:01:53.430966-04:00"
    }
  ],
  "amount": 2000.00,
  "exempt": null,
  "tax": null,
  "tax_percent": 0,
  "total": 2000.00,
  "local_file": null,
  "tax_agency": {},
  "status": "draft",
  "created": "2020-10-21T09:55:07.138915-04:00",
  "updated": "2020-10-21T12:01:53.430966-04:00"
}

Update an order

PATCH https://api.piriod.com/orders/{id}/

This endpoint updates an order. Only orders with draft status can be updated.

Path Parameters

Request Body

{
  "id": "ord_tnlUbv0YSTbzmsx7oH",
  "customer": {
    "id": "cus_APxT9s7X12ilP9Zx9O",
    "name": "Acme Nation LLC",
    "address": "17st, National Sub",
    "state": "IL",
    "country": "US",
    "phone": null,
    "email": "billing@stark.com",
    "website": "https://www.stark.com",
    "aggregations": {
      "balance": 5756.00,
      "sales": 14324.36,
      "sales_current_period": 1873.00
    },
    "tax_settings": {},
    "metadata": {},
    "created": "2020-05-12 15:42:09",
    "updated": "2020-05-12 21:16:12"
  },
  "number": 1726,
  "document": {
    "id": "US2",
    "name": "Order",
    "country": "US",
    "currency": {
      "id": "USD",
      "available": true,
      "conversion": null,
      "country": "US",
      "default": true,
      "is_chargeable": true,
      "name": "Dólar Estadounidense",
      "name_en": "American Dollar",
      "rounded": false
    }
  },
  "test_mode": false,
  "date": "2020-10-25",
  "address": null,
  "carrier_id": null,
  "carrier_name": null,
  "state": null,
  "licence_plate": null,
  "shipping_type": "1",
  "lines": [
    {
      "id": "lin_APxT9s7X12ilP9Zx9O",
      "name": "My physical product",
      "description": null,
      "quantity": 4.0,
      "amount": 500.00,
      "exempt": false,
      "tax": null,
      "tax_percent": 0,
      "total": 2000.00,
      "created": "2020-10-21T12:01:53.430966-04:00",
      "updated": "2020-10-21T12:01:53.430966-04:00"
    }
  ],
  "amount": 2000.00,
  "exempt": null,
  "tax": null,
  "tax_percent": 0,
  "total": 2000.00,
  "local_file": null,
  "tax_agency": {},
  "status": "draft",
  "created": "2020-10-21T09:55:07.138915-04:00",
  "updated": "2020-10-21T12:01:53.430966-04:00"
}

Destroy an order

DELETE https://api.piriod.com/orders/{id}/

Destroy an order object. Only orders with draft status can be updated.

Path Parameters

Finalize an order

GET https://api.piriod.com/orders/{id}/finalize/

This endpoint finalize an order. When the order is finalized, it is validated with the tax agency, if the order document type has tax regulations, you will no longer be able to update your data. The status attribute of the order object will become finalized. The local_file attribute of the order object will have a url to get the file that was sent to the tax agency, normally it is a file with an .xml extension.

Path Parameters

{
  "id": "ord_tnlUbv0YSTbzmsx7oH",
  "customer": {
    "id": "cus_APxT9s7X12ilP9Zx9O",
    "name": "Acme Nation LLC",
    "address": "17st, National Sub",
    "state": "IL",
    "country": "US",
    "phone": null,
    "email": "billing@stark.com",
    "website": "https://www.stark.com",
    "aggregations": {
      "balance": 5756.00,
      "sales": 14324.36,
      "sales_current_period": 1873.00
    },
    "tax_settings": {},
    "metadata": {},
    "created": "2020-05-12 15:42:09",
    "updated": "2020-05-12 21:16:12"
  },
  "number": 1726,
  "document": {
    "id": "US2",
    "name": "Order",
    "country": "US",
    "currency": {
      "id": "USD",
      "available": true,
      "conversion": null,
      "country": "US",
      "default": true,
      "is_chargeable": true,
      "name": "Dólar Estadounidense",
      "name_en": "American Dollar",
      "rounded": false
    }
  },
  "test_mode": false,
  "date": "2020-10-25",
  "address": null,
  "carrier_id": null,
  "carrier_name": null,
  "state": null,
  "licence_plate": null,
  "shipping_type": "1",
  "lines": [
    {
      "id": "lin_APxT9s7X12ilP9Zx9O",
      "name": "My physical product",
      "description": null,
      "quantity": 4.0,
      "amount": 500.00,
      "exempt": false,
      "tax": null,
      "tax_percent": 0,
      "total": 2000.00,
      "created": "2020-10-21T12:01:53.430966-04:00",
      "updated": "2020-10-21T12:01:53.430966-04:00"
    }
  ],
  "amount": 2000.00,
  "exempt": null,
  "tax": null,
  "tax_percent": 0,
  "total": 2000.00,
  "local_file": null,
  "tax_agency": {},
  "status": "finalized",
  "created": "2020-10-21T09:55:07.138915-04:00",
  "updated": "2020-10-21T12:01:53.430966-04:00"
}

Retrieve an order PDF

GET https://api.piriod.com/orders/{id}/pdf/

This endpoint retrieves a PDF representation of the order. Returns a Blob encoded in Base64.

Path Parameters

{
    "file": "JVBERi0xLjcKJeLjz9MKNiAwIG9iago8PCAvVHlwZSAvUGFnZS..."
}

Last updated