B2B & Credit Accounts

Business account requests, account credit checkout, invoices, and customer tokens for API ordering.

Openfront lets a signed-in customer apply for a business account. Once approved, the customer can check out on credit, group unpaid orders into invoices, pay them, and use a customer token to order through the API.

Workflow

Request

On /[countryCode]/account/invoicing, a signed-in customer submits a BusinessAccountRequest with business name, type (wholesale, distribution, reseller, b2b_platform, other), monthly order volume, requested credit limit and a description.

Review

Staff with canManageOrders review requests at /dashboard/platform/business-account-requests. Status is pending, approved, not_approved or requires_info. Staff can add review notes and an approved credit limit.

Account creation

When a request is set to approved, a hook creates an active Account of type business for the user, in the store's default currency, with the approved credit limit (or 100000 minor units if none is given). The account is linked back to the request.

Customer token

A customer with an active business account creates a token from the invoicing page with regenerateCustomerToken. It returns a ctok_ token once and stores only a digest. The token works as a Bearer credential for that user. It expires after CUSTOMER_TOKEN_MAX_AGE_DAYS (default 90). It does not grant dashboard access.

Ordering on account

completeActiveCart called without a paymentSessionId treats the order as an account order. It needs a signed-in user with an active business account. The cart currency must match the account currency. The order total must fit within the available credit (creditLimit minus unpaid balance), checked under a row lock. The order is recorded as an AccountLineItem with an unpaid status.

Invoices

  • getUnpaidLineItemsByRegion(accountId) lists unpaid account lines grouped by region.
  • createInvoiceFromLineItems(accountId, regionId, lineItemIds, dueDate) creates an Invoice in sent status from selected lines.
  • createInvoicePaymentSessions, initiateInvoicePaymentSession, setInvoicePaymentSession and completeInvoicePayment pay an invoice through Stripe or PayPal. Only sent or overdue invoices can be paid. The provider amount must match the invoice total. Retries resume from the recorded step.
  • getCustomerPaidInvoices lists paid invoices for /account/invoices.

Staff see business accounts and their invoices at /dashboard/platform/invoices.

  • Accounts only support one currency. Cross-currency account orders and invoices are refused.
  • Manual invoice tender is refused. No screen records an offline invoice payment.
  • A customer token can register a webhook with registerWebhookEndpoint only for the fulfillment.created event. Other events are refused for customer tokens.

On this page