Skip to main content
POST

Authorizations

Authorization
string
header
required

API Key Authentication

Use your API key in the Authorization header:

Key Types:

Secret Keys (Server-Side Only):

  • Format: tybrite_sk_live_* (production) or tybrite_sk_test_* (sandbox)
  • Full read/write access to all endpoints
  • ⚠️ NEVER expose in client-side code or public repositories
  • Required for: write operations, authentication, payment verification, AI recommendations

Publishable Keys (Client-Safe):

  • Format: tybrite_pk_live_* (production) or tybrite_pk_test_* (sandbox)
  • Read-only access (GET requests only, plus POST semantic search)
  • βœ… Safe for client-side JavaScript, mobile apps, and public code
  • Allowed for: browsing products, search, CMS content, pricing queries

Endpoint-Specific Requirements:

  • Authentication endpoints (/v1/auth/*): Secret key required
  • Payment verification (POST /v1/payments/verify): Secret key required
  • AI Recommendations (POST /v1/recommendations): Secret key required
  • Semantic Search (POST /v1/search): Both key types allowed (read-only operation)
  • All write operations: Secret key required
  • All read operations: Both key types allowed

Using a publishable key for restricted operations returns 403 Forbidden.

Headers

Idempotency-Key
string
required

Unique key to prevent duplicate payment initialization (e.g., payment-{timestamp}-{random}). If you retry a request with the same key, the original payment initialization is returned.

X-Timestamp
integer
required

Unix timestamp in seconds (current time). Must be within 5 minutes of server time. Used to prevent replay attacks.

X-Signature
string
required

HMAC-SHA256 signature of the payload (timestamp + "." + request_body), base64-encoded. Sign using your HMAC secret from the Integrations page (Developer section).

Body

application/json
provider
string
required

Payment provider to use. The built-in providers are stripe, paypal, paystack, and mpesa. A store that has connected its own payment provider can also pass that provider's identifier here β€” the same value returned as provider (with custom_provider: true) by GET /v1/payments/methods.

Example:

"stripe"

amount
number<float>
required

Payment amount in MAJOR currency units β€” 100.00 is one hundred dollars, not one dollar. This matches every other amount in the API: catalog prices, order totals and refunds are all major units. Conversion to a processor's minor units (Stripe cents, Paystack kobo) happens server-side; never send minor units here.

When order_id is supplied the amount must equal that order's total to the cent, or the request is rejected with amount_mismatch. Sending 10000 for a 100.00 order fails that check rather than charging a hundred times over.

Required range: x >= 0.01
Example:

100

currency
string

Currency code (ISO 4217). Case-insensitive β€” it is normalised to whatever the chosen processor expects, so usd and USD behave identically. Required for Stripe and Paystack.

  • Stripe: Defaults to store's default currency
  • PayPal: Defaults to store's default currency
  • Paystack: Must be one of NGN, GHS, ZAR, KES, USD
  • M-Pesa: Always KES (ignored)
Example:

"usd"

email
string<email>

Customer email (required for Stripe and Paystack)

Example:

"john.doe@example.com"

phone
string

Customer phone number (required for M-Pesa)

  • M-Pesa: Format 254XXXXXXXXX (Kenya)
Example:

"254712345678"

country
string

ISO 3166-1 alpha-2 country code for the payer. Passed through to a payment method the merchant has added themselves, which may use it to offer the local payment options for that country. The built-in methods ignore it.

Example:

"US"

order_id
string<uuid>

Optional order ID to link payment to an order

Example:

"880e8400-e29b-41d4-a716-446655440003"

idempotency_key
string

Optional idempotency key to prevent duplicate payments

Example:

"pay-2026-02-10-abc123"

metadata
object

Optional metadata to attach to the payment

Example:
success_url
string<uri>

Redirect URL after successful payment (Stripe only)

Example:

"https://example.com/payment-success"

cancel_url
string<uri>

Redirect URL after cancelled payment (Stripe only)

Example:

"https://example.com/payment-cancelled"

callback_url
string<uri>

Webhook callback URL (Paystack only)

Example:

"https://example.com/webhooks/paystack"

Response

Payment initialized successfully

success
boolean
Example:

true

provider
string
Example:

"stripe"

type
string
Example:

"redirect"

reference
string
Example:

"PAY-12345678-ABC123"

checkout_url
string<uri>
Example:

"https://checkout.stripe.com/c/pay/..."

session_id
string
Example:

"cs_test_..."

environment
string
Example:

"test"

expires_at
string<date-time>