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
enum<string>
required

Payment provider to use

Available options:
stripe,
paypal,
paystack,
mpesa
Example:

"stripe"

amount
number<float>
required

Payment amount (must be greater than 0)

Required range: x >= 0.01
Example:

100

currency
string

Currency code (ISO 4217). 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)

phone
string

Customer phone number (required for M-Pesa)

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

"254712345678"

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>