Docs / Core Concepts

Core Concepts

Before you start building, familiarize yourself with the foundational concepts that underpin every PayItFast API integration.

Order Lifecycle

Every transaction in PayItFast -- whether a collection, payout, or ramp order -- follows a predictable lifecycle. Understanding these states is essential for building reliable integrations.

General Flow

At its simplest, an order moves through three primary phases:

Initiated Processing Settled
Status Description What to Do
Initiated The order has been created and is awaiting user action (e.g., payment submission) or system processing. Show the user a pending state. Wait for a webhook or poll the order status endpoint.
Processing Payment has been received and is being verified, converted, or routed to the destination. Inform the user that the payment is being processed. No action is required.
Settled The transaction is complete. Funds have been delivered to the recipient or credited to the account. Update your records. Display a confirmation to the user.
Failed The transaction could not be completed. This can occur due to compliance checks, insufficient funds, or payment errors. Display the failure reason to the user. Optionally allow them to retry.
Note

Different order types (collections, payouts, ramp) may have additional intermediate states. See the Orders & Payments reference for the full state machine for each product.

Quote Caching & Rate Locking

When you request an exchange rate or create a quote, the API returns a quoteId that represents a locked rate for a limited time. This mechanism ensures that the rate your user sees is the rate they get -- as long as the quote has not expired.

How Quotes Work

Quote Expiry

Quotes are valid for 1 minute from the time they are issued. After expiry, the quoteId is no longer usable and a new quote must be fetched. Design your checkout flow to minimize the time between quote retrieval and order creation.

JSON -- Quote Response Example
{
  "quoteId": "qt_8f2a4b6c9d1e",
  "sourceCurrency": "USD",
  "destinationCurrency": "EUR",
  "exchangeRate": 0.9234,
  "sourceAmount": 1000.00,
  "destinationAmount": 918.40,
  "fee": 5.00,
  "expiresAt": "2025-06-15T14:31:00Z"
}

Headless Mode

By default, PayItFast order creation returns a hosted checkout URL where end-users complete their payment. If you want to build a fully custom UI and handle the payment flow entirely within your own application, set headlessMode to true.

When to Use Headless Mode

Required Fields in Headless Mode

When headlessMode=true, the API does not generate a hosted page. You must supply additional fields in the order request:

Field Type Description
headlessMode boolean Set to true to enable API-only integration without the hosted checkout page.
deviceDetails object Information about the end-user's device, including deviceIp, userAgent, and acceptLanguage. Required for compliance and fraud screening.
additionalDetails object Payment-method-specific data. For card payments, includes cardNumber, expiryDate, and cvv. For bank transfers, includes bankCode and accountNumber.
JSON -- Headless Order Request
{
  "headlessMode": true,
  "quoteId": "qt_8f2a4b6c9d1e",
  "userId": "usr_abc123",
  "deviceDetails": {
    "deviceIp": "203.0.113.42",
    "userAgent": "Mozilla/5.0 ...",
    "acceptLanguage": "en-US"
  },
  "additionalDetails": {
    "bankCode": "CHASE",
    "accountNumber": "****7890"
  }
}
Tip

If you do not need a custom UI, simply omit headlessMode (or set it to false) and redirect the user to the checkoutUrl returned in the order response. The hosted checkout handles payment collection, 3DS verification, and error states for you.

Partner Context

The partnerContext field allows you to attach arbitrary metadata to any order. This is a free-form JSON object that PayItFast stores with the order and echoes back in every webhook notification related to that order.

Common Uses

JSON -- Partner Context Example
{
  "partnerContext": {
    "internalOrderId": "ORD-2025-00847",
    "customerId": "cust_xyz789",
    "source": "mobile_app_v3"
  }
}

When you receive a webhook for this order, the partnerContext object is included in the payload, letting you match the event to your internal records without additional API calls.

MID (Merchant ID)

If your organization operates multiple business lines or brands, PayItFast supports a multi-merchant configuration. Each merchant profile has a unique Merchant ID (MID) that determines routing rules, fee structures, and settlement accounts.

How to Use MID

Pass the MID as an HTTP header on every API request that should be scoped to a specific merchant profile:

HTTP Header
MID: merch_acme_payments
Detail Value
Header name MID
Format Alphanumeric string with underscores (e.g., merch_acme_payments)
When required Required when your account has more than one merchant profile configured. Optional if you have a single merchant profile.
Where to find it Available in the PayItFast dashboard under Account > Merchant Profiles.
Important

If your account has multiple merchant profiles and you omit the MID header, the API will return a 400 Bad Request error. Always include it when operating in a multi-merchant setup.

Settlement Models

PayItFast offers flexible settlement options depending on the type of transaction and your operational needs.

Batch Settlement (Fiat)

For fiat transactions, funds are typically settled in batches on a scheduled basis (e.g., daily or weekly). This is the default model for most collection and payout flows.

Instant Settlement (Crypto)

For crypto transactions, settlement is typically instant or near-instant, as the transfer occurs directly on the blockchain.

Instant Fiat Settlement

For eligible corridors, PayItFast supports instant fiat settlement, where funds are delivered to the recipient's bank account in real-time or near-real-time.

Configuration

Settlement models are configured at the merchant profile level. Contact info@payitfast.com to discuss the best settlement model for your use case.

Model Asset Type Timing Batched
Batch Fiat T+0 to T+2 (configurable) Yes
Instant Crypto Crypto Seconds to minutes (network-dependent) No
Instant Fiat Fiat Seconds to minutes (corridor-dependent) No

What's Next

Now that you understand the core concepts, proceed to the API reference to explore specific endpoints: