Payments

The All Aboard API supports three ways to pay for orders, each suited to different use cases.

Payment Methods Overview

  1. Wallet (Pre-paid Credits): Most API integrations use this. You maintain a balance of credits that are deducted when orders are finalized. Designed for automated systems and high-volume operations.

  2. Payment Gateway: For collecting payment directly from end customers. Redirects customers to All Aboard's hosted payment page, then automatically completes the order. Supports credit cards, Apple Pay, Google Pay, and more.

  3. Invoice: Monthly invoicing for vetted commercial clients. Orders are billed at month-end.

Most API users use the wallet system. It's the simplest for programmatic integrations and doesn't require handling customer payment flows.

Payment method scopes

Each payment method requires its own scope on your API key. An order can only be created with a given payment method if the matching scope (payments:wallet, payments:stripe, or payments:invoice) is included in the key. See API Scopes for details.

Wallet (Pre-paid Credits)

The wallet system lets you pre-pay for credits that are used automatically when you finalize orders. This is the recommended approach for most API integrations.

How It Works

  1. Add credits to your wallet via the Dashboard or API
  2. Create orders using createOrder mutation
  3. Finalize orders using finalizeOrder mutation. Credits are deducted automatically.
  4. Monitor balance in the Dashboard

Credits are deducted only when you finalize an order. If you create an order but don't finalize it, no credits are used.

Creating Orders with Wallet

When using wallet credits, you create and finalize orders directly. No payment redirects needed:

graphql
# Step 1: Create the order (pre-books tickets)
mutation CreateOrder {
  createOrder(booking: "booking_00e732j0n6e6j0s7y066j451t0") {
    id
    status
  }
}

# Step 2: Finalize the order (deducts credits, triggers ticket issuance)
mutation FinalizeOrder {
  finalizeOrder(order: "order_55s6n21786s2h667v167163451") {
    id
    status
  }
}
# Step 1: Create the order (pre-books tickets)
mutation CreateOrder {
  createOrder(booking: "booking_d6a4v4m0c5r4t595e3x1g570s2") {
    id
    status
  }
}

# Step 2: Finalize the order (deducts credits, triggers ticket issuance)
mutation FinalizeOrder {
  finalizeOrder(order: "order_66z0w577a321e3w643g033z467") {
    id
    status
  }
}

Both operations happen immediately. The order is created, tickets are pre-booked, then finalized, all in your control.

See Orders for complete details on the order creation flow.

Managing Your Wallet

  • Add credits: Use the Dashboard to top up your wallet balance
  • Check balance: View your current balance and transaction history in the Dashboard
  • Automatic deduction: Credits are deducted when you finalize orders. No manual payment steps.

Payment Gateway

The payment gateway is for collecting payment directly from end customers. The payment flow is hosted on the All Aboard website, so you don't need to set up your own payment processing.

When to Use Payment Gateway

Use the payment gateway when:

  • You're building a customer-facing booking platform
  • You need to collect payment from end users
  • You want card payments, Apple Pay, Google Pay, and similar methods

Most API integrations don't need this; they use wallet credits instead.

How It Works

  1. Create an order with createOrder, then a payment for that order with createPayment. This returns a payment URL.
  2. Redirect customer to the All Aboard payment page
  3. Customer pays on the hosted payment page
  4. Order is finalized automatically after successful payment
  5. Customer is redirected back to your success page

The payment gateway finalizes the order automatically after a successful payment, so you never call finalizeOrder yourself. Create the order up front with createOrder and pass its id to createPayment (see below).

Creating a Payment

Create an order with createOrder, then pass its id to createPayment as orderId. Because you already hold the order id from step 1, interpolate it into your successUrl (and cancelUrl if needed) yourself:

graphql
# Step 1: Create the order (pre-books tickets)
mutation CreateOrder {
  createOrder(booking: "booking_8663q2z1s3r752h0s5f230p5k1") {
    id
  }
}

# Step 2: Initialise payment for that order.
# Build successUrl from the id returned in step 1 (shown here as order_abc123).
mutation CreatePayment {
  createPayment(
    orderId: "order_abc123"
    successUrl: "https://example.com/success/order_abc123"
    cancelUrl: "https://example.com/cancel"
    language: "sv"
  ) {
    url
  }
}
# Step 1: Create the order (pre-books tickets)
mutation CreateOrder {
  createOrder(booking: "booking_f1t686k346g106d2x046b2a3t5") {
    id
  }
}

# Step 2: Initialise payment for that order.
# Build successUrl from the id returned in step 1 (shown here as order_abc123).
mutation CreatePayment {
  createPayment(
    orderId: "order_abc123"
    successUrl: "https://example.com/success/order_abc123"
    cancelUrl: "https://example.com/cancel"
    language: "sv"
  ) {
    url
  }
}

Pass an optional two-letter language tag (e.g. sv) to localise the hosted payment page; omit it, or use en, for the default English page.

Redirect the customer to the returned url (All Aboard's payment page). After payment:

  • They're redirected to your successUrl
  • The order is finalized automatically
  • Tickets begin issuing automatically

Building the success URL

Since you create the order before the payment, you already have its id — interpolate it into successUrl (and cancelUrl) however suits your app, so the return page can look up the order. For example, with the id in the path:

https://example.com/success/order_abc123
https://example.com/success/order_abc123

or as a query parameter:

https://example.com/success?order=order_abc123
https://example.com/success?order=order_abc123

Important Notes

  • Use WebSocket: Creating the order pre-books tickets with operators, which can take up to 30 seconds. Use WebSocket connections on createOrder to avoid timeouts.

  • Single payment per booking: Due to technical limitations, with some operators it is only possible to create one payment attempt per booking. If a customer cancels and you need to retry but get an BOOKING_ALREADY_USED error, create a new booking first.

  • Browser back button: If customers use the browser back button (instead of canceling on the payment page), they return to your site but the payment may still be processing. Handle this gracefully in your UI.

Invoice Billing

Invoice billing is available for vetted commercial clients with established relationships. Orders are accumulated throughout the month and invoiced at month-end.

How It Works

  1. Create orders using createOrder mutation
  2. Finalize orders using finalizeOrder mutation
  3. Orders are tracked for monthly invoicing
  4. Receive invoice at month-end with all orders
  5. Pay invoice via bank transfer

The order creation flow is identical to wallet credits. You use createOrder and finalizeOrder. The difference is billing happens monthly via invoice instead of immediate credit deduction.

Getting Invoice Access

Invoice billing requires a commercial agreement. Contact team@allaboard.eu to discuss invoice billing for your account.

For how fees are charged, how service fees work, and monthly reconciliation, see Fees and Reconciliation.

Choosing a Payment Method

Use Wallet if:

  • You're building an API integration
  • You want simple, programmatic payment handling
  • You're comfortable pre-paying for credits
  • You handle high volumes

Use Payment Gateway if:

  • You're building a customer-facing booking site
  • You need to collect payment from end users
  • You want hosted card payments and security handled by All Aboard

Use Invoice if:

  • You have a commercial agreement with All Aboard
  • You prefer monthly billing over pre-paid credits
  • You're processing high volumes with established billing terms

Most API users start with wallet credits. It's the simplest path and doesn't require payment processing setup.

Next Steps

  • Using wallet? See Orders for details on creating and finalizing orders
  • Using payment gateway? See the examples above for the payment flow
  • Need help choosing? Contact team@allaboard.eu