Adding child entities

Optional feature typically used for platforms (e.g. creator platform or payroll platforms)

Platforms such as creator platforms or payroll platforms can utilize Loop to collect or send crypto payments on their platform.

When the Loop contract is deployed, an entity is created with the following fields (below). Loop allows for users to create child entities linked to the parent.

Child entities have the same fields as parent. Thus, each child has its own custom checkout page (even if not relevant for a specific use case), list of accepted tokens, inbound treasury, items, etc. An entity must be created before Items such as subscriptions or one-time payments are created. However, you can create an entity and configure the items in the same request by providing the details.

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

The name of the entity using Loop

Example: "Professional"
inboundTreasuries*object

The addresses of the wallets receiving transfers per network

logoUrl*string

URL link to the entity's logo

Example: "https://www.loopcrypto.xyz/logo.svg"
websiteUrl*string

URL link to the entity's website

Example: "https://www.loopcrypto.xyz"
signupRedirectUrlstring

URL to redirect on signup for entity

Example: "https://www.loopcrypto.xyz/success"
delegatedSigningboolean

A flag to indicate if the entity is using delegated signing

Example: true
chargebeeEnabledboolean

(Optional) A flag to indicate if the entity is using Chargebee

Example: true
chargebeeSiteNamestring

(Optional) The name of the Chargebee site

Example: "loopcrypto"
chargebeeApiKeystring

(Optional) The API key for the Chargebee site

Example: "test_1234567890"
stripeEnabledboolean

(Optional) A flag to indicate if the entity is using Stripe

Example: true
quickBooksEnabledboolean

(Optional) A flag to indicate if the entity is using QuickBooks

Example: true
stripeApiKeystring

(Optional) The API key for the Stripe account

Example: "sk_test_1234567890"
externalAccountIdstring

(Optional) The external account ID for an entity.

Example: "acct_1234567890"
backgroundStylestring

(Optional) Customizable CSS style to personalize the user experience, defaults to #f5f5f5

Example: "linear-gradient(180deg, #000000 0%, #45E0A8 100%), #45E0A8"
itemsarray of CreateItemRequest (object)

(Optional) A list of items to create and be linked to the entity

emailstring

(Optional) Email for child user

replyTostring

(Optional) The email address to use as the reply-to address for company emails

Example: "reply@mycompany.com"
cancellationDaysThresholdnumber (double)

(Optional) The number of days a payment is retried before an agreement is cancelled

Example: 137
Response

Ok

Body
name*string

The name of the entity using Loop

Example: "Professional"
inboundTreasuries*object

The addresses of the wallets receiving transfers per network

logoUrl*string

URL link to the entity's logo

Example: "https://www.loopcrypto.xyz/logo.svg"
websiteUrl*string

URL link to the entity's website

Example: "https://www.loopcrypto.xyz"
signupRedirectUrl*nullable string

URL to redirect on signup for entity

Example: "https://www.loopcrypto.xyz/success"
delegatedSigningboolean

A flag to indicate if the entity is using delegated signing

Example: true
entityId*string

The ID of the entity, found on the Company Dashboard

Example: "9906361a-7114-4756-9e7c-0752fd8378e8"
backgroundStyle*string

Customizable CSS style to personalize the user experience, defaults to #f5f5f5

Example: "linear-gradient(180deg, #000000 0%, #45E0A8 100%), #45E0A8"
items*array of GeneralItemResponse (object)

A list of items linked to the entity

userCreated*boolean

Whether a user was created for the entity

Example: true
replyTostring

The email address to use as the reply-to address for company emails

Example: "reply@mycompany.com"
cancellationDaysThreshold*number (double)

The number of days a payment is retried before an agreement is cancelled

Example: 7
Request
const response = await fetch('//api/v1/entities', {
    method: 'POST',
    headers: {
      "entity-id": "text",
      "Content-Type": "application/json"
    },
    body: JSON.stringify([
      {
        "name": "Professional",
        "inboundTreasuries": {},
        "logoUrl": "https://www.loopcrypto.xyz/logo.svg",
        "websiteUrl": "https://www.loopcrypto.xyz"
      }
    ]),
});
const data = await response.json();
Response
{
  "name": "Professional",
  "inboundTreasuries": {
    "1": [
      "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
      "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
    ]
  },
  "logoUrl": "https://www.loopcrypto.xyz/logo.svg",
  "websiteUrl": "https://www.loopcrypto.xyz",
  "signupRedirectUrl": "https://www.loopcrypto.xyz/success",
  "delegatedSigning": true,
  "entityId": "9906361a-7114-4756-9e7c-0752fd8378e8",
  "backgroundStyle": "linear-gradient(180deg, #000000 0%, #45E0A8 100%), #45E0A8",
  "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
    }
  ],
  "userCreated": true,
  "replyTo": "reply@mycompany.com",
  "cancellationDaysThreshold": 7
}

Last updated