Skip to content
Last updated

Adding line items to a payment

Audience: All users (Merchants, Developers, Testers)

Environment: Sandbox / Production

Introduction

If you run an ecommerce shop, chances are you want your customer to be able to see their bought items on the checkout page, before or during the payment. Helix-Pay allows you to do that easily.

Using the API

  1. Use the POST /payments endpoint as usual
  2. Send a line_items property as part of the metadata field in the request body

Example

{
  "amount": 2498,
  "currency": "EUR",
  "description": "Order #12111",
  "metadata": {
    "line_items": [
      {
        "name": "Red T-shirt",
        "price": 999,
        "quantity": 1,
        "description": "A basic cotton T-shirt"
      },
      {
        "name": "Cargo Pants",
        "price": 1499,
        "quantity": 2,
        "description": "Some nice cargo pants"
      }
    ]
  }
}

Line Item Definition

Here is the definition of a line item. It is written as a Typescript interface, but it can be adapted to any programming language.

interface LineItem {
  name: string;
  price: number; // needs to be in the lowest denomination, same as the `amount` field
  quantity: number;
  description?: string; // optional
}

Checking for line items

Once you create a payment that has line items, you will see them in two places:

  1. In the Helix-Pay portal, as part of the corresponding payment details page
  2. On the Helix-Pay checkout page