Skip to main content
If you aren’t using Shopify or Square, or if you need to pull data from multiple sources, you can easily implement a Custom Backend.

Implementation

To create a custom backend, you simply need to implement one or more of the core interfaces: ProductBackend, CartBackend, or OrderBackend.

Example: MySQL/Postgres Backend

Using your Backend

Once implemented, pass your custom class to the gateway:

Hybrid Backends

You can also mix and match. For example, use Shopify for product data but a Custom API for complex loyalty points or custom fulfillment rules.

Best Practices

  • Timeout Management: Ensure your custom backend methods have sensible timeouts to prevent blocking the LLM interaction.
  • Validation: Use Zod within your backend to validate data coming from your internal services.
  • Error Mapping: Map your internal database errors to the gateway’s Standard Error Types.