Skip to main content

Hosted Checkout Pages

Hosted checkout pages are customizable payment pages created using predefined templates. These pages provide a secure and consistent checkout experience for users.

Templates and Types

There are two primary structures:

1. Checkout Page Template

Defines the layout and configuration for the checkout page. This template is the basis for creating actual checkout pages and includes related payment types.

The structure of a checkout page template is:

type CheckoutPageTemplate = {
id: string;
organisation_id: string;
Organisation: Organisation;
name: string;
status: string;
created_at: Date;
updated_at: Date;
deleted_at: Date | null;
CheckoutPageTemplateOnPaymentTypes: CheckoutPageTemplateOnPaymentType[];
};

2. Checkout Page

Represents an individual checkout page generated based on the template. This page holds transaction-specific details, such as the transaction ID, currency, amount, and itemized details.

The structure of a checkout page is:

type CheckoutPage = {
id: string;
organisation_id: string;
status: string;
selected_transaction_id: string | null;
currency_code: string;
amount: number;
line_items: any;
expired_at: Date;
created_at: Date;
updated_at: Date;
deleted_at: Date | null;
};

3. CheckoutPageTemplateOnPaymentType

A join table linking CheckoutPageTemplate with PaymentType. This relationship allows a checkout page template to support multiple payment types, enhancing flexibility and compatibility with various payment methods.

Its structure is:

interface CheckoutPageTemplateOnPaymentType {
checkout_page_template_id: string;
payment_type_type: string;
CheckoutPageTemplate: CheckoutPageTemplate;
PaymentType: PaymentType;
created_at: Date;
updated_at: Date;
deleted_at?: Date;
}

This join table "hydrates" the CheckoutPageTemplate with available PaymentType options.

Relationships

The following visual illustrates the relationship between these entities: image

  • Checkout Page Template has a many-to-one relationship with Organisation.
  • Checkout Page instances are based on a Checkout Page Template.
  • CheckoutPageTemplateOnPaymentType allows each Checkout Page Template to support multiple Payment Types.

State Transition Diagram