Payments

Create Payment Intent

Create a new payment intent for the hosted checkout page

Creates a new payment intent and returns a redirect URL to the hosted checkout page.

Endpoint

POST /api/intents

Authentication: Required (API Key)

Description

This endpoint is used to create a payment intent for processing payments through the hosted checkout page. A payment intent serves as the foundation for a transaction, specifying details such as the amount and currency required for payment processing.

Hosted Checkout Flow

Once a payment intent is created, you receive a redirect_url to the hosted checkout page. This URL can be used to redirect users to the checkout page, enabling customers to complete the payment process. Our checkout page manages different multi-step flows and 3DS redirection flows, ensuring a smooth user experience.

Request

Headers

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token with your API key
Content-TypestringYesMust be application/json

Body Parameters

ParameterTypeRequiredDescription
amountintegerYesAmount in minor units (cents). E.g., 1000 = $10.00
currencystringYesISO 4217 currency code (e.g., USD, ZAR, EUR)
reference_idstringYesYour unique transaction reference
purchaser_idstring (min 3 chars)YesYour unique customer identifier
return_urlstring (HTTPS URI)YesURL to redirect customer after payment
allow_remember_credentialsbooleanYesWhether payment credentials can be saved
request_unscheduled_mitbooleanNoRequest permission for future auto-payments (default: false)
require_unscheduled_mitbooleanNoRequire MIT capability (default: false)
capture_modestringNoimmediate or prefer_delay (default: immediate)
purchaser_infoobjectNoCustomer details (email, phone, country, locale)
payment_method_filterobjectNoFilter which payment methods to show
splitobjectNoPayment split configuration for multiple beneficiaries
future_paymentsobjectNoConfiguration for future recurring payments, e.g. mandate instalments. When provided, amount is the initial (pro-rata) payment and future_payments defines the recurring schedule. Required for DebiCheck mandate signing.

Purchaser Info Object

FieldTypeRequiredDescription
emailstringNoCustomer email address
phonestringNoCustomer phone number
countrystringNoISO country code (e.g., ZA)
localestringNoLocale code (e.g., en-ZA)

Payment Method Filter Object

FieldTypeRequiredDescription
filter_typestringYesallow (whitelist) or block (blacklist)
payment_methodsarrayYesList of payment method codes

Split Object

FieldTypeRequiredDescription
split_typestringYesCurrently only AMOUNT supported
splitsarray (min 2)YesList of beneficiary splits
descriptionstringNoOptional split description

See Split Payouts Guide for details.

Future Payments Object

FieldTypeRequiredDescription
typestringNoType of future payments. Only "instalment" is supported. Defaults to "instalment".
frequencystringYesHow often payments should occur. One of: "weekly", "monthly".
countintegerYesNumber of future payments, excluding the initial payment. Minimum: 1.
amountintegerYesDefault amount per future payment in minor units (e.g. cents).
currencystringYesISO 4217 currency code for future payments (e.g. "ZAR").
constraintsobjectYesScheduling and limit constraints. See below.

Future Payment Constraints Object

FieldTypeRequiredDescription
billing_start_datestringYesDate (YYYY-MM-DD) from which billing starts. Must be at least 5 days from today. Actual collection happens on collection_day. If your desired collection day has already passed in the current cycle, move the date to the next cycle.
collection_dayintegerYesDay on which payments are collected. For "weekly": 17 (1 = Monday). For "monthly": 131. Use 31 to target the last day of the month.
max_amountintegerNoMaximum amount per individual future payment in minor units. Must be at least future_payments.amount to allow variable collection amounts.

See Mandates for how to manage a mandate after it has been signed.

The return_url must be a secure HTTPS URL and publicly accessible (not localhost for production).
Currency Decimal Handling: The following currencies do not use 2 decimals:
  • 0 decimals: JPY (Japanese Yen), UGX (Ugandan Shilling)
  • 3 decimals: OMR (Omani Rial), KWD (Kuwaiti Dinar), BHD (Bahraini Dinar), JOD (Jordanian Dinar)
Contact us for PSP-specific currency handling details.

Example Request

curl -X POST https://api.njiapay.com/api/intents \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 10000,
    "currency": "ZAR",
    "reference_id": "order_12345",
    "purchaser_id": "customer_abc",
    "return_url": "https://yoursite.com/payment/callback",
    "allow_remember_credentials": true,
    "request_unscheduled_mit": false,
    "purchaser_info": {
      "email": "customer@example.com",
      "phone": "+27123456789",
      "country": "ZA",
      "locale": "en-ZA"
    }
  }'

Response

Success Response (201 Created)

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "token": "eyJ0eXAiOiJKV1QiLCJhbGc...",
  "redirect_url": "https://pay.njiapay.com/pay/550e8400-e29b-41d4-a716-446655440000?token=eyJ0eXAi..."
}
FieldTypeDescription
idstring (UUID)Unique payment intent identifier
tokenstringIntent authentication token (for iauth parameter)
redirect_urlstringURL to redirect customer to checkout page

Error Responses

401 Unauthorized

{
  "detail": "Invalid or missing API key"
}

Causes:

  • Missing Authorization header
  • Invalid API key
  • Using sandbox key with production URL (or vice versa)

422 Validation Error

{
  "detail": [
    {
      "loc": ["body", "amount"],
      "msg": "ensure this value is greater than or equal to 0",
      "type": "value_error"
    }
  ]
}

Common validation errors:

  • Negative amount
  • Invalid currency code
  • Missing required fields
  • Invalid return_url format
  • Split amounts don't sum to total amount

Important Notes

Allow Remember Credentials

The allow_remember_credentials parameter must be set to true if you plan to:

  • Allow 1-click payments
  • Enable unscheduled Merchant-Initiated Transactions (MIT)
  • Use auto-payment attempts

If you intend to use auto-payments, ensure the original payment intent is successfully completed and meets all prerequisites.

See Auto Payments Guide for details.

Split Payouts

If you want to split the payment between multiple parties, use the split field:

  • Minimum 2 beneficiaries required
  • Sum of splits must equal total amount
  • No duplicate beneficiaries
  • All beneficiaries must have same currency as intent

Before using splits, create beneficiaries using the /api/merchants/{merchant_id}/beneficiaries endpoint.

See Split Payouts Guide for complete details.

Next Steps

After creating a payment intent:

  1. Redirect the customer to the redirect_url
  2. Set up webhook listener to receive payment status updates
  3. Handle return_url callback when customer returns to your site
See the Hosted Checkout Guide for a complete integration walkthrough.