Method

Make a request to the /v2/invoice/create endpoint

Request

Example

> curl https://pls.senddotssandbox.com/v2/invoice/create \
-X POST \
-H "Authorization: Basic <TOKEN>" \
-H "Content-Type: application/json" \
-d '{
      "amount": 800,
      "expires_in": 3600,
      "items": [
        {
          "name": "Pikachu Digital Pet",
          "unit_amount": 250,
          "quantity": 1,
          "description": "A little Pikachu for your desktop"
        },
        {
          "name": "Charmander Digital Pet",
          "unit_amount": 225,
          "quantity": 2,
          "description": "A ferocius Charmander for your desktop"
        }
      ],
      "breakdown": {
        "items_total": 700,
        "tax": 100,
        "shipping": 0
      },
      "requested_information": ["shipping_address"],
      "metadata": {
        "zappy_user_id": "61f8c2f8263e340016f4d4e8"
      }
    }'

> response = {
    "success": true,
    "invoice": {
        "id": "8f246ca0-4ade-4296-bab4-5a6d37d9af10",
         "payer": null,
        "api_app": {
            "id": "b7a00ae2-e638-4d66-9d46-adf38d810cde",
            "name": "Zappy",
            "user_id": 2
        },
        "amount": 800,
        "expiry": "2020-12-09T00:40:51.107Z",
        "status": "created",
        "link": "https://www.senddotssandbox.com/invoice/8f246ca0-4ade-4296-bab4-5a6d37d9af10",
        "items": [
            {
            "name": "Pikachu Digital Pet",
            "unit_amount": 250,
            "quantity": 1,
            "description": "A little Pikachu for your desktop"
            },
            {
            "name": "Charmander Digital Pet",
            "unit_amount": 225,
            "quantity": 2,
            "description": "A ferocius Charmander for your desktop"
            }
        ],
        "breakdown": {
            "items_total": 700,
            "tax": 100,
            "shipping": 0
        },
        "requested_information": {
            "shipping_address": null
        },
        "metadata": {
            "zappy_user_id": "61f8c2f8263e340016f4d4e8"
        }
    }
}

Parameters

NameTypeRequiredDescription
amountfloat✔️The amount of money to charge
expires_inintegerLength in seconds that an invoice needs to be completed - min: 0, max: 259200 (72 hours)
itemslist[object]List of item objects
item.namestringName of the item
item.unit_amountfloatCost of 1 unit of the item
item.quantityfloatQuantity of this item
item.descriptionstringDescription of the item
breakdownobjectBreakdown of the total amount
breakdown.items_totalfloatTotal of the items (unit_amount * quantity)
breakdown.shippingfloatCost of shipping
breakdown.taxfloatTax
amountfloatTotal amount to charge the
metadataobjectSet of key-value pairs in the format of string. This is attached to the invoice object for storing additional information.

Note that the sum of entries in breakdown must equal amount and the sum of all items must match breakdown.item_total if provided

Styling

The contents of the link can be styled through URL variables and shown to the user embedded in an iFrame or WebView. The variables can be appended to the end of the link. For example:

https://senddotssandbox.com/invoice/e6d60b12-d513-47f3-971e-038b20d11ad7?iframe=true&bgColor=000000&textColor=ffffff

The available variables are:

VariableDescription
iframeIf set to true, the link will be rendered for use in an iframe
bgColorThe background color of the iframe. Set as hex code without the #. eg. 000000
textColorThe text color of the iframe. Set as hex code without the #. eg. ffffff
darkModeIf set to true of the bgColor is ‘dark’.