Cost Centers

A cost center is a named billing configuration on your sales agent. It determines the commercial terms applied to a booking and how it is paid for. Cost centers are assigned per passenger, so a single order can combine several cost centers. Every agent has at least one – the default cost center, which is used for any passenger you don't assign a cost center to explicitly.

Cost centers let you keep different commercial setups side by side under a single agent. For example, you might have one cost center for your public website and another for a corporate client with negotiated rates, each with its own payment method.

What a Cost Center Controls

Cost centers are set up and configured by All Aboard on request. Contact team@allaboard.eu to create or change one. A cost center captures:

  • Commercial rates: the pricing applied to bookings made against the cost center.
  • Per-provider preferences: provider-specific settings such as commercial contracts, corporate rates, commissions, and price markup. These let you apply different terms per train operator within the same cost center.
  • Service fees: optional fees you add on top of the ticket price, charged to the customer and forwarded to you in full. See Service Fees below.
  • Payment methods: the method(s) orders booked against this cost center can be paid with, namely wallet, payment gateway (Stripe), or invoice. See Payment Methods and API Scopes below.

These settings are configured on request, not through the API. Over the API, cost centers are read-only: you can list them and select which one a passenger is billed against.

Accessing Cost Centers

Cost centers are a property of the SalesAgent type and can be read with the getSalesAgent query. Each CostCenter exposes its id, name, whether it is the default, and its configured paymentMethod.

graphql
query GetCostCenters {
  getSalesAgent {
    uid
    costCenters {
      id
      name
      default
      paymentMethod
    }
  }
}
query GetCostCenters {
  getSalesAgent {
    uid
    costCenters {
      id
      name
      default
      paymentMethod
    }
  }
}

Use the returned id when you want to bill an order against a specific cost center.

Selecting a Cost Center for an Order

If no cost center is requested, the order is billed against the agent's default cost center. To bill against a specific cost center, supply the passengers argument to createBooking and set the cost center id on the passenger(s):

graphql
mutation CreateBooking {
  createBooking(
    offerIds: ["offer_8231w2r0k4w61442f26492w2b1"]
    passengers: [
      { type: ADULT, costCenter: { id: "costcenter_9440w6j773w16352n6s0h6n424" } }
      { type: YOUTH, age: 22, costCenter: { id: "costcenter_9440w6j773w16352n6s0h6n424" } }
    ]
  ) {
    id
  }
}
mutation CreateBooking {
  createBooking(
    offerIds: ["offer_k4h5670380k1j7x551w5z5d4a1"]
    passengers: [
      { type: ADULT, costCenter: { id: "costcenter_9440w6j773w16352n6s0h6n424" } }
      { type: YOUTH, age: 22, costCenter: { id: "costcenter_9440w6j773w16352n6s0h6n424" } }
    ]
  ) {
    id
  }
}

The cost center is set per passenger, so a single order can split passengers across cost centers when needed. Any passenger you leave without a cost center is billed against the agent's default. When you combine multiple cost centers on one order, they must share a payment method. An order is paid with a single method, so the cost centers' supported payment methods have to intersect.

Payment Methods and API Scopes

Every cost center supports one or more payment methods: wallet, payment gateway (Stripe), or invoice. When you book against a cost center, the API key must carry the matching payments:* scope for the payment method used, otherwise the request is rejected:

Cost center payment methodRequired scope
Walletlive:payments:wallet / test:payments:wallet
Payment gateway (Stripe)live:payments:stripe / test:payments:stripe
Invoicelive:payments:invoice / test:payments:invoice

This means the payment method of the cost center in use must match the scopes granted to the API key making the request. See API Scopes for the full list of scopes and how to choose them.

Embeds

Public embeds should use an API key restricted to *:payments:stripe. This ensures customers can only create orders paid through the payment gateway and cannot access your orders or charge your wallet or invoice. See Configuring embeds safely below.

Service Fees

Clients using the embeds can configure service fees on a cost center. Service fees are added on top of the ticket price, charged to the customer through the payment gateway at checkout, and forwarded in full to you.

Service fees can be combined, and each fee can be one of:

  • Fixed price per order: a flat amount added once per order.
  • Fixed price per ticket issued: a flat amount per issued ticket.
  • Percentage of order value: a percentage of the order total.

Because service fees are collected through the payment gateway, they apply to cost centers using the Stripe payment method. They are paid out to you monthly. See Fees and Reconciliation for how service fees appear in your monthly reconciliation.

Configuring Embeds Safely

When you put an embed on a public website, its API key is visible to anyone who views the page. To keep that key safe, restrict it to the payment gateway only:

  • Use an API key scoped to *:payments:stripe (for example live:payments:stripe).
  • Do not grant orders:read, payments:wallet, or payments:invoice to a public embed key.

With only *:payments:stripe, the key cannot read your orders and cannot create orders with any payment method other than Stripe, so customers can pay for their own bookings while the key cannot be abused to access your orders or spend your wallet or invoice credit. Make sure the cost center the embed uses is configured with the payment gateway payment method so it matches this scope.