Verify payment status
Verify the status of a payment transaction using the payment reference. This endpoint queries the payment provider’s API to get the current status.
⚠️ SECRET KEY REQUIRED
This endpoint requires a secret key (tybrite_sk_*). Publishable keys will return 403 Forbidden.
Why Secret Key? Payment verification accesses sensitive transaction data and provider APIs that should only be called from secure server-side environments. This prevents unauthorized access to payment status information.
Provider-Specific Verification:
Stripe:
- Pass the
referencereturned by initialize, or itssession_id; a PaymentIntent id (pi_...) or charge id (ch_...) from a Stripe event is also accepted - Returns
successonce the Checkout Session is paid, otherwise Stripe’s ownpayment_status(for exampleunpaid) - Includes the Checkout Session id, the order it was opened for, and the PaymentIntent
PayPal:
- Pass the PayPal order id as the
reference - Captures the buyer-approved order
- Returns status
successonce the capture completes
Paystack:
- Queries Paystack Transaction Verification API
- Returns payment status and transaction details
- Includes the channel, customer email and payment time.
M-Pesa:
- Queries M-Pesa STK Push Query API
- Returns the transaction status from Safaricom
- Returns the STK query result code and description
A store’s own payment provider:
- Pass the
referencereturned by initialize - Asks the provider for the payment’s status and relays it as
status - When the provider reports the payment as paid, the order the reference was opened for is marked paid, exactly as for
the built-in providers. The order is the one recorded when the payment was initialized, never one named by the
provider. It is marked paid only when the provider confirms an amount that covers the order total in the order’s
currency; otherwise
statusisamount_mismatchand the order stays unpaid. Repeating the call changes nothing.
Note: Despite using POST method (for request body), this is a read operation for most providers; for PayPal it captures the approved order.
Response signature
A call made with a secret key returns X-Signature and X-Signature-Timestamp when the store has a
signing secret, so the caller can verify that the payment status is the one the platform produced. Verification is described under
Get order (GET /v1/orders/{id}).
Key Type Support:
- ✅ Secret keys (full access)
- ❌ Publishable keys (forbidden - returns 403)
- ❌ Marketplace operator keys (forbidden - returns 403). Verification reads one store’s payment providers;
a marketplace checkout is settled by the processor’s notification, and the shopper’s orders and their
payment status are on
GET /v1/customers/me.
curl --request POST \
--url https://api.tybritelabs.com/v1/payments/verify \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"provider": "stripe",
"reference": "PAY-12345678-ABC123"
}
'{
"provider": "stripe",
"reference": "cs_test_a1b2c3...",
"status": "success",
"amount": 100,
"currency": "usd",
"customer_email": "john.doe@example.com",
"payment_intent": "pi_3ABC123...",
"metadata": {
"payment_reference": "PAY-12345678-ABC123",
"order_id": "880e8400-e29b-41d4-a716-446655440003"
}
}Authorizations
API Key Authentication
Use your API key in the Authorization header:
Authorization: Bearer tybrite_sk_live_YOUR_KEY
Key Types:
Secret Keys (Server-Side Only):
- Format:
tybrite_sk_live_*(production) ortybrite_sk_test_*(sandbox) - Full read/write access to all endpoints
- ⚠️ NEVER expose in client-side code or public repositories
- Required for: every write a shopper does not make for themselves, authentication, payment verification, AI recommendations
Publishable Keys (Client-Safe):
- Format:
tybrite_pk_live_*(production) ortybrite_pk_test_*(sandbox) - Catalogue reads, plus the actions a shopper takes for themselves
- ✅ Safe for client-side JavaScript, mobile apps, and public code
- Allowed for: browsing products, search, CMS content, pricing queries, cart and wishlist, reviews, storefront events, and the Agent API's quotes, cart drafts and checkout intents
Endpoint-Specific Requirements:
- Authentication endpoints (
/v1/auth/*): state-changingPOSTcalls require a secret key, for store and marketplace keys alike;GET /v1/auth/meaccepts either key - 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) - Shopper actions (cart, wishlist, reviews, storefront events, Agent API quotes, cart drafts and checkout intents): Both key types allowed
- All other write operations: Secret key required
- All read operations: Both key types allowed
Using a publishable key for restricted operations returns 403 Forbidden.
Limited publishable keys:
A publishable key can be limited to the products that carry one tag (for example starter:jewellery), created from
the store's Developers page. The limit applies to the key, never to the shopper: shopper sign-up and sign-in stay store-wide.
- Reads return only the slice: products (with their facets, filters, search, brands and specifications), categories and
subcategories that hold in-slice products, collections, promotions, posts and lookbooks that carry the tag, reviews of
in-slice products, prices, discovery lists and the store information summary, with every count computed on the slice.
A product outside the slice answers
404, as if it did not exist. - A write that names a product or variant outside the slice (adding to the cart or wishlist, reserving stock, an order line,
a review, a promotion calculation, a storefront event) answers
403with the error codeout_of_scope, and nothing is written or reserved. An order is refused as a whole. - A route that carries no slice behaviour is not available to the key: it answers
403withendpoint_not_allowed. - Orders placed through such a key record the tag on the order's attribution as
key_scope. - Secret keys and connected-app keys cannot be limited.
- Responses are cached per key limit: a limited key never receives a response cached for the whole store, and the reverse.
Body
Response
Payment verification successful
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
Stripe verification response
curl --request POST \
--url https://api.tybritelabs.com/v1/payments/verify \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"provider": "stripe",
"reference": "PAY-12345678-ABC123"
}
'{
"provider": "stripe",
"reference": "cs_test_a1b2c3...",
"status": "success",
"amount": 100,
"currency": "usd",
"customer_email": "john.doe@example.com",
"payment_intent": "pi_3ABC123...",
"metadata": {
"payment_reference": "PAY-12345678-ABC123",
"order_id": "880e8400-e29b-41d4-a716-446655440003"
}
}
