Leepa Africa API

Sections

Theme switcher

Headless API

Best for: Advanced integrations requiring full control over the payment flow, UI, and custom business logic.

This method allows you to programmatically create purchase sessions via the platform’s API. You can then:

  • Use the returned checkout link with any of the standard integration methods, or
  • Build your own UI, implement custom signing flows, and handle blockchain transactions directly.

Prerequisites

Before using the Headless API, ensure you have:

  • An API key (see how to create an API key)
  • Familiarity with HTTP requests and handling JSON
  • Capability to manage wallet connections and signature flows (e.g., using MetaMask, WalletConnect)

Summary

With the headless integration flow, the platform allows you to:

  • Create a purchase session per customer
  • Retrieve a typed data message (EIP-712) for signing the purchase message
  • Implement a custom UI for checkout that includes wallet connection + signing experience
  • Submit signed messages to Leepa Africa to initiate blockchain payment
  • Handle webhook events to track payment completion

Flow: Step-by-Step

1. Create a Purchase Session

POST to the platform’s API with product and buyer details (see how to create a purchase session). Response includes a unique purchase_session_id.

2. Request Message to Sign

Use the purchase_session_id as well as customer data to obtain a typed data message describing the purchase (see how to get message) The response returns EIP-712 typed data for user signature.

3. Handle Wallet & Sign Message

Your frontend connects to the wallet (e.g., MetaMask). Prompt the user to sign the provided typed data and store the resulting signature (see how to sign typed data).

4. Submit Signature

POST the signature back to the platform using the Submit Signer Purchase Message API endpoint. The Leepa Africa platform processes and broadcasts the transaction on-chain.

5. Listen for Webhook Events

Receive webhook notifications such as described in our Webhooks section. Use these to unlock access, show success screens, or retry flows for your users.

Was this section helpful?

What made this section unhelpful for you?

On this page
  • Headless API