Developer Preview

Build protected payment flows with TrustLink.

Create TrustLink checkout links from your store or platform using a server-to-server API designed for Ghanaian Mobile Money transactions.

Base URL https://www.trustlinkgh.online/api/v1
cURL POST /v1/escrows
curl -X POST "https://www.trustlinkgh.online/api/v1/escrows" \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_SECRET_API_KEY" \
  -d '{
    "amount": 450.00,
    "description": "Used iPhone 13 Pro",
    "buyerPhone": "+233550000000",
    "customReference": "ORDER-1234"
  }'
Developer Preview Information

The TrustLink Escrow REST API is currently available in Developer Preview mode. Endpoints and request contracts are subject to refinement before final production rollout. Secret API keys must remain strictly on server environments and should never be exposed in client-side JavaScript or mobile app builds.

OVERVIEW

1. Overview

The TrustLink Escrow API allows online stores, marketplaces, and social commerce tools to programmatically issue protected payment links for Ghanaian Mobile Money transactions (MTN MoMo, Telecel Cash, and AT Money).

When an escrow is created via API, TrustLink issues a unique payment contract with a hosted checkout URL. Buyers complete Mobile Money payment on the checkout page, locking funds securely in escrow until item delivery is confirmed.

Key Capabilities:
  • Server-to-server contract creation with instant hosted payment links.
  • Automated WhatsApp invoice delivery to buyer numbers (when provided).
  • Integration support for custom web checkout flows and WooCommerce stores.
GETTING STARTED

2. Quickstart

Get up and running with the TrustLink Escrow API in 5 simple steps:

  1. Create or access a verified vendor account

    Sign up at signup or log into your seller account at login.

  2. Generate your Secret API Key

    Navigate to the Vendor Dashboard Settings tab to generate your unique x-api-key credential.

  3. Store key securely in server environment variables

    Keep your secret key inside server configuration variables (e.g. TRUSTLINK_API_KEY). Never expose it in client-side code.

  4. Send a POST request to create an escrow

    Issue an HTTP POST request to https://www.trustlinkgh.online/api/v1/escrows with required transaction details.

  5. Redirect buyer to checkoutUrl

    Redirect the buyer to the returned checkoutUrl or display it in your store UI to complete Mobile Money authorization.

Security Callout: Never expose your TrustLink secret API key in frontend JavaScript, mobile application code, public repositories, or screenshots.
AUTHENTICATION

3. Authentication

The API uses custom HTTP header authentication via the x-api-key header. Every request from your application server must include this credential.

HTTP Request Header
x-api-key: YOUR_SECRET_API_KEY

If the x-api-key header is omitted, the server returns an HTTP 401 Unauthorized error. If the key is invalid or revoked, the server returns an HTTP 403 Forbidden response.

ENDPOINT · POST /api/v1/escrows

5. Create an Escrow

POST /api/v1/escrows Developer Preview

Creates a new escrow record in state PENDING_PAYMENT and returns a hosted checkout URL for the buyer.

Method POST
Content-Type application/json
Auth Header x-api-key
SCHEMA · REQUEST_BODY

6. Request Fields

The request body must be a JSON object containing the following parameters:

Field Type Required Description Example
amount Number Required Transaction amount in Ghana Cedis (GH₵). Must be greater than 0. 450.00
description String Required Clear item description or order summary for buyer reference. "Used iPhone 13 Pro"
buyerPhone String Optional Buyer's 10-digit Ghanaian phone number (+233 format accepted) for automated WhatsApp invoice delivery. "+233550000000"
buyerEmail String Optional Buyer's email address for receipt notifications. "buyer@example.com"
deliveryDate String Optional Target delivery timeline or date string. "2026-08-10"
redirectUrl String Optional Merchant URL to return the buyer to after payment completion. "https://merchant.com/success"
cancelUrl String Optional Merchant URL to return the buyer to if checkout is cancelled. "https://merchant.com/cancel"
customReference String Optional Merchant's internal order, invoice, or cart ID for reconciliation. "ORDER-1234"

Note: All transactions default to Ghana Cedis (GH₵ / GHS). Additional currency fields are not required.

EXAMPLES · MULTI_LANGUAGE

7. Code Examples & Example Response

curl -X POST "https://www.trustlinkgh.online/api/v1/escrows" \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_SECRET_API_KEY" \
  -d '{
    "amount": 450.00,
    "description": "Used iPhone 13 Pro",
    "buyerPhone": "+233550000000",
    "buyerEmail": "buyer@example.com",
    "customReference": "ORDER-1234"
  }'

Example Response (HTTP 201 Created)

JSON Response Body 201 Created (Example)
{
  "id": "escrow_8f9a2b3c4d",
  "status": "PENDING_PAYMENT",
  "checkoutUrl": "https://www.trustlinkgh.online/checkout.html?id=escrow_8f9a2b3c4d",
  "customReference": "ORDER-1234"
}
HTTP_STATUS · ERRORS

8. Errors & Status Codes

The TrustLink Escrow API returns standard HTTP status codes to indicate request success or failure:

Status Code Cause Example Response Payload Recommended Action
400 Bad Request Missing required fields (amount or description). {"error": "Missing required fields: amount, description"} Ensure both amount and description are supplied in JSON body.
401 Unauthorized Missing x-api-key HTTP header. {"error": "Missing x-api-key header"} Include the x-api-key header in your request dispatch.
403 Forbidden Invalid or revoked API key. {"error": "Invalid API Key"} Verify key value in Dashboard Settings or generate a new key.
500 Server Error Internal database or execution error. {"error": "Failed to create escrow"} Retry request with exponential backoff or contact developer support.
ENUM · ESCROW_STATUS

9. Transaction States

Every escrow contract created in TrustLink follows a strictly monitored transaction state machine. UI elements and Firestore listeners map these constants to official status colors:

PENDING_PAYMENT
FUNDS_ESCROWED
ITEM_SHIPPED
COMPLETED

Exceptions: Escrows under dispute move to DISPUTED and resolve to REFUNDED or authorized completion.

PENDING_PAYMENT Awaiting payment

Escrow link generated; buyer has not yet completed Mobile Money checkout authorization.

FUNDS_ESCROWED Ready to ship

Mobile Money payment verified by gateway; funds securely locked in escrow. Seller notified to dispatch order.

ITEM_SHIPPED In transit

Seller has marked item as shipped or provided tracking waybill. Buyer delivery window active.

COMPLETED Released

Buyer confirms delivery via PIN or tracking link; escrow funds released to seller's wallet.

DISPUTED Under review

Buyer or seller raised a formal dispute; funds frozen pending admin arbitration review.

REFUNDED Returned

Dispute resolved in buyer's favor or contract cancelled; payment refunded back to buyer.

WEBHOOKS · PREVIEW

10. Webhooks Notice

Developer Preview Limitation:

Outbound HTTP webhook delivery for transaction state changes (e.g. escrow.status_changed) is currently under active development and not yet documented for live production use. Developers building integrations should poll payment status or contact TrustLink support for custom webhook configuration.

PLUGINS · WOOCOMMERCE

11. WooCommerce Integration

TrustLink Escrow provides an official WordPress payment gateway plugin for WooCommerce stores located in trustlink-woocommerce-plugin/.

Plugin Capabilities:
  • Adds "TrustLink Escrow (Mobile Money)" to your WooCommerce checkout page.
  • Configurable API URL and Secret API Key in WordPress Admin settings.
  • Automatic order redirection to hosted TrustLink Mobile Money checkout.

To inspect or install the WooCommerce plugin source code, refer to the repository plugin directory.

SECURITY · BEST_PRACTICES

12. API Key Security Guidelines

Protect your integration credentials by following these security rules:

  • Never commit secret keys: Add key configuration files to .gitignore.
  • Server-side requests only: Always invoke the API from secure server code or Cloud Functions. Never call /api/v1/escrows directly from frontend JavaScript in the browser.
  • Rotate compromised keys: If a key is accidentally leaked in a repository or log, immediately revoke it in your Vendor Dashboard Settings and issue a new key.
SUPPORT · CONTACT

13. Developer Support

Need assistance integrating TrustLink Escrow into your platform?

Technical Assistance & Integration Engineering

Our engineering team can assist with sandbox credentials, custom marketplace workflows, and WooCommerce setup.