Adding items

The instructions below provide the details for adding items using the API. You can also add an item via the Company Dashboard by going to the Subscriptions page and clicking "Add a subscription", or going to the one-time payments page and clicking "Create a one-time payment".

POST//api/v1/items
Authorization
Header parameters
Body
name*string

The name of the item

Example: "The Professional Plan"
amount*number (double)

The amount of the item, denoted in USD. Setting the value to 0 means the item's price is variable rate, and the price will be displayed as "Price varies" on the checkout page

Example: 29.99
frequencystring

The frequency with which to charge the item. Valid values: [HOUR, DAY, WEEK, MONTH, YEAR]

Example: "WEEK"
frequencyCount*number (double)

The frequency count with which to charge the item. Used in combination with frequency e.g. every 2 weeks, every 1 month. A frequency count of 0 denotes a one time payment

Example: 2
acceptedTokensGroupedViewTokenAddresses (object)
entityIdstring

The ID of the entity. Found on your company dashboard

Example: "4d1f3191-935b-40c5-b91e-37e1e3700bac"
externalIdnullable string

External subscription ID if applicable. E.g Stripe Subscription ID

Example: "orbf9e15-e54b-11ec-b21b-06d24995f946"
activeboolean

True means agreements can still be made with this item.

Example: true
priceMetadatanullable string

Optional details related to the payment amount displayed in the cart on the hosted payment page

Example: "Increases to $200 after 2 weeks"
typeId*number (double)

Classification of the item. See the GET call to get the most current list

Example: "1"
categoryIdnumber (double)

The merchant category code (also known as an MCC) ID

Example: 10
autoInvoiceboolean

Defaults to false. If true, then invoices will be automatically generated via the auto-invoicing feature. Delegated signing must be turned on for the entity and an inbound treasury wallet. Please contact Loop (support@loopcrypto.xyz) to have these enabled

Example: false
initialOffsetnumber (double)

Specified in days. Says when the first invoice should be created relative to the date/time of the Item's creation

Example: 1
Response

Ok

Body
items*array of GeneralItemResponse (object)
Request
const response = await fetch('//api/v1/items', {
    method: 'POST',
    headers: {
      "entity-id": "text",
      "Content-Type": "application/json"
    },
    body: JSON.stringify([
      {
        "name": "The Professional Plan",
        "amount": 29.99,
        "frequencyCount": 2,
        "typeId": "1"
      }
    ]),
});
const data = await response.json();
Response
{
  "items": [
    {
      "name": "The Professional Plan",
      "amount": 29.99,
      "frequency": "MONTH",
      "frequencyCount": 1,
      "acceptedTokens": {},
      "externalId": "price_1ObTC0EsKlmFX3FHDjZnmim1",
      "active": true,
      "priceMetadata": "Increases to $200 after 2 weeks",
      "autoInvoice": true,
      "initialOffset": 1,
      "itemId": "2a697faf-8fdb-4aab-be20-64db0cef7dd5",
      "entityId": "4d1f3191-935b-40c5-b91e-37e1e3700bac",
      "url": "https://checkout.loopcrypto.xyz/4d1f3191-935b-40c5-b91e-37e1e3700bac/2a697faf-8fdb-4aab-be20-64db0cef7dd5",
      "type": "Subscription",
      "category": "Books, Periodicals, and Newspapers",
      "categoryCode": 5192
    }
  ]
}

Last updated