Payments API
Create, retrieve, and manage payments with the Notch Pay API
Payments API
The Payments API allows you to initialize, retrieve, and manage payment transactions. Use these endpoints to accept payments from your customers through various payment methods.
The Payment Object
Payment Object Properties
Unique identifier for the payment
Your custom reference for the payment
Amount of the payment in the smallest currency unit
Three-letter ISO currency code
Status of the payment: pending
, processing
, complete
, failed
, canceled
, expired
ID of the customer making the payment
ID of the payment method used
Description of the payment
Additional data attached to the payment
Timestamp when the payment was created
Timestamp when the payment was completed (if applicable)
API Endpoints
List All Payments
Retrieve a list of payments with pagination.
Query Parameters
Number of items per page (default: 30, max: 100)
Page number (default: 1)
Search by reference
Filter by status
Filter by payment channels (comma-separated)
Start date filter (format: YYYY-MM-DD)
End date filter (format: YYYY-MM-DD)
Retrieve a list of payments with pagination.
Query Parameters
Number of items per page (default: 30, max: 100)
Page number (default: 1)
Search by reference
Filter by status
Filter by payment channels (comma-separated)
Start date filter (format: YYYY-MM-DD)
End date filter (format: YYYY-MM-DD)
Create a Payment
Request Parameters
Amount to charge in the smallest currency unit
Three-letter ISO currency code (e.g., XAF)
Customer’s email address (required if phone
and customer
are not provided)
Customer’s phone number (required if email
and customer
are not provided)
Customer ID or object (required if email
and phone
are not provided)
Description of the payment
Unique reference for the payment
URL to redirect after payment completion
Example Request
Request Parameters
Amount to charge in the smallest currency unit
Three-letter ISO currency code (e.g., XAF)
Customer’s email address (required if phone
and customer
are not provided)
Customer’s phone number (required if email
and customer
are not provided)
Customer ID or object (required if email
and phone
are not provided)
Description of the payment
Unique reference for the payment
URL to redirect after payment completion
Example Request
Process a Payment
Path Parameters
Reference of the payment to process
Request Parameters
Payment channel (e.g., cm.mtn, cm.orange)
Channel-specific data
Client’s IP address
Example Request for MTN Mobile Money
Payment Statuses
pending
Payment has been initialized but not yet processed
processing
Payment is being processed by the payment provider
complete
Payment has been completed
failed
Payment attempt failed
canceled
Payment was canceled by the merchant or customer
expired
Payment expired before completion
Handling Callbacks
Redirect to Callback URL
When a payment is completed, Notch Pay will redirect the customer to the callback
URL you provided when creating the payment. The URL will include the payment reference as a query parameter:
Verify Payment Status
Fulfill the Order
Once you’ve verified that the payment is complete, you can fulfill the order or provide access to the purchased product or service.
Webhooks
Webhooks provide a more reliable way to receive payment notifications than callbacks, as they don’t depend on the customer’s browser. See the Webhooks API documentation for more information.
Error Handling
Best Practices
Store Payment References
Always store the payment ID and reference in your database for future reference and reconciliation.
Verify Payment Status
Always verify the payment status using the API before fulfilling orders or providing services.
Use Webhooks
Set up webhooks for reliable payment notifications, especially for asynchronous payment methods like mobile money.
Idempotent References
Use unique, idempotent references for each payment to prevent duplicate payments and simplify reconciliation.
Error Handling
Implement proper error handling for failed payments, including user-friendly error messages and recovery options.