Interface: CreateOrderPayload

Defined in: packages/pesa/src/types/order.ts:53

Payload for creating a payment order.

Pass this to PesaInstance.createOrder to initiate a payment. The SDK validates required fields before forwarding to the provider.

Example

const order = await pesa.createOrder({
  amount:    15000,
  currency:  'TZS',
  reference: 'order_abc123',
  customer:  {
    name:  'Juma Ali',
    phone: '255712345678',
    email: '[email protected]',
  },
  description: 'Monthly subscription',
});

Properties

PropertyTypeDescriptionDefined in
amountnumberAmount in whole TZS. 15000 = TZS 15,000. Must be > 0.packages/pesa/src/types/order.ts:55
currency"TZS"Currency code. Currently only 'TZS'.packages/pesa/src/types/order.ts:57
customer{ email?: string; name: string; phone: string; }Customer details.packages/pesa/src/types/order.ts:66
customer.email?stringCustomer's email address (optional).packages/pesa/src/types/order.ts:75
customer.namestringCustomer's full name.packages/pesa/src/types/order.ts:68
customer.phonestringMobile money phone number in MSISDN format: 255XXXXXXXXX. Local formats like 07XX are rejected.packages/pesa/src/types/order.ts:73
description?stringOptional human-readable description of the order.packages/pesa/src/types/order.ts:64
metadata?Record<string, unknown>Arbitrary metadata attached to the order.packages/pesa/src/types/order.ts:83
redirectUrl?stringRequired for redirect-based providers (DPO, Pesapal). URL the customer is sent to after completing payment.packages/pesa/src/types/order.ts:81
referencestringYour internal order identifier. Must be unique. Used for idempotency — the same reference won't be charged twice.packages/pesa/src/types/order.ts:62

On this page