Register Customer by Invoice Token
Creates a customer record and grants portal access using a basketSession GUID token paired with an invoice ID. This endpoint is called at the end of a guest checkout flow — after payment has been completed — to convert the guest into a registered customer. The combination of the invoice ID and the basket session token is used to verify the purchase, create (or link) the customer account, and return a new token that can be used for subsequent token-gated operations on that invoice.
Authentication
No bearer token is required. Authentication is performed via the token query parameter, which must be the basketSession GUID associated with the completed guest checkout session.
Path Parameters
The unique identifier of the invoice generated during guest checkout. This is used alongside the basket session token to locate and validate the
purchase.
Query Parameters
The basketSession GUID token associated with the guest checkout session. This token is typically passed through the checkout completion URL and
ties the anonymous session to the invoice, enabling customer record creation and portal access to be granted.
Response
A new invoice-scoped token returned after successful customer registration. This token can be used for subsequent token-gated requests on this
invoice, such as downloading the invoice PDF via pdfByToken.
Example Response
{
"Token": "eyJhbGciOiJIUzI1NiIsInR..."
}
Usage in Portal
This endpoint is called on the guest checkout completion page immediately after a successful payment. It uses the basketSession GUID (available from the checkout URL or session state) together with the invoice ID to:
- Verify the completed guest purchase.
- Create a new customer record (or link to an existing one).
- Grant the customer portal access.
- Return a fresh token for follow-up token-gated operations (e.g. PDF download).
- File:
src/views/public/checkout/complete/index.tsx
Typical integration pattern
// From src/api/endpoints.ts
// endpoints.billing.invoices.registerByToken = (invoiceId: number, basketSessionToken: string) => ({
// url: `/api/public/billing/invoices/${invoiceId}/registerByToken?token=${basketSessionToken}`,
// type: null as unknown as { Token: string },
// })
// Usage – called after guest checkout payment success
const endpoint = endpoints.billing.invoices.registerByToken(invoice.Id, basketSessionToken)
const result = await httpClient.post<{ Token: string }>(endpoint.url, {})
const invoiceToken = result.data.Token // use for pdfByToken or other token-gated requests
GET /api/public/billing/invoices/{invoiceId}/pdfByToken – Download invoice PDF using a guest token
GET /api/public/billing/invoices/{invoiceId} – Get full invoice details (authenticated)
Error Responses
The provided basketSession token is invalid, has already been used, or has expired.
No invoice exists with the specified ID, or the token does not match the invoice.