Updating an item

Companies can update their existing items by submitting a PATCH request to the Loop API.

The itemId is used as the unique identifier so it must be supplied correctly in order to update a specific item. Fields that are read only and cannot be updated via the API are: id, createdAt, updatedAt.

You can use the GET endpoint to get the item's details, copy/paste the response into the body of the PATCH and change the values you want to update.

PATCH//api/v1/items
Authorization
Header parameters
Body
namestring

The name of the item

Example: "The Professional Plan"
amountnumber (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"
frequencyCountnumber (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"
externalIdstring

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
priceMetadatastring

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

Example: "Increases to $200 after 2 weeks"
typeIdnumber (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
itemId*string

The external ID of the item

Example: "2a697faf-8fdb-4aab-be20-64db0cef7dd5"
Response

Ok

Body
items*array of GeneralItemResponse (object)
Request
const response = await fetch('//api/v1/items', {
    method: 'PATCH',
    headers: {
      "entity-id": "text",
      "Content-Type": "application/json"
    },
    body: JSON.stringify([
      {
        "itemId": "2a697faf-8fdb-4aab-be20-64db0cef7dd5"
      }
    ]),
});
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