Order
A collection of endpoints for creating and managing orders
Copy link List Orders
List the previously created orders
Query Parameters
Number of records to fetch per page
The section to retrieve
The start date
The end date
Response
200Order List response
6 object properties
GET
/ordercurl https://api.paystack.co/order \
-H "Authorization: Bearer YOUR_SECRET_KEY"import { Paystack } from "@paystack/paystack-sdk";
const paystack = new Paystack({ secretKey: process.env.PAYSTACK_SECRET_KEY! });
const response = await paystack.order.list({
perPage: 100,
page: 100
});
console.log(response.data);require "paystack"
paystack = Paystack::Client.new(ENV.fetch("PAYSTACK_SECRET_KEY"))
response = paystack.order.list({
per_page: 100,
page: 100
})
puts response.dataResponse
{
"status": true,
"message": "Orders retrieved",
"data": [
{
"id": 12345,
"code": "ORD_abc123def456",
"amount": 20000,
"currency": "NGN",
"status": "success",
"customer": {
"email": "[email protected]"
},
"createdAt": "2024-11-01T12:00:00.000Z"
}
],
"meta": {
"total": 1,
"skipped": 0,
"perPage": 50,
"page": 1,
"pageCount": 1
}
}{
"status": false,
"message": "An error occurred",
"meta": {
"nextStep": "string"
},
"type": "string",
"code": "validation_error",
"errorCodeMappingNotFound": true
}{
"status": false,
"message": "An error occurred",
"meta": {
"nextStep": "string"
},
"type": "string",
"code": "validation_error",
"errorCodeMappingNotFound": true
}Copy link Create Order
Create an order for selected items
Request Body
The email of the customer placing the order
The customer's first name
The customer's last name
The customer's mobile number
Currency in which amount is set
EnumGHSKESNGNUSDZAR
The shipping details of the order
6 object properties
The address of for the delivery
The city of the delivery address
The state of the delivery address
The country of the delivery address
The cost of delivery
Extra details to be aware of for the delivery
A flag to indicate if the order is for someone else
A flag to indicate if the someone else should pay for the order
Response
200Order Create response
24 object properties
14 object properties
3 object properties
POST
/ordercurl https://api.paystack.co/order \
-H "Authorization: Bearer YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"first_name": "Jane",
"last_name": "Doe",
"phone": "+2348123456789",
"currency": "GHS",
"items": [],
"shipping": {}
}' \
-X POSTimport { Paystack } from "@paystack/paystack-sdk";
const paystack = new Paystack({ secretKey: process.env.PAYSTACK_SECRET_KEY! });
const response = await paystack.order.create({
email: "[email protected]",
first_name: "Jane",
last_name: "Doe",
phone: "+2348123456789",
currency: "GHS",
items: [],
shipping: {}
});
console.log(response.data);require "paystack"
paystack = Paystack::Client.new(ENV.fetch("PAYSTACK_SECRET_KEY"))
response = paystack.order.create({
email: "[email protected]",
first_name: "Jane",
last_name: "Doe",
phone: "+2348123456789",
currency: "GHS",
items: [],
shipping: {}
})
puts response.dataResponse
{
"status": true,
"message": "Order created",
"data": {
"id": 12345,
"code": "ORD_abc123def456",
"amount": 20000,
"currency": "NGN",
"status": "pending",
"customer": {
"id": 297346561,
"email": "[email protected]"
},
"line_items": [
{
"product": {
"id": 2196244,
"name": "Sample Product"
},
"quantity": 2,
"amount": 20000
}
],
"createdAt": "2024-11-01T12:00:00.000Z"
}
}{
"status": false,
"message": "An error occurred",
"meta": {
"nextStep": "string"
},
"type": "string",
"code": "validation_error",
"errorCodeMappingNotFound": true
}Copy link Fetch Order
Fetch the details of a previously created order
Path Parameters
The unique identifier of the order
Response
200Order Fetch response
30 object properties
9 object properties
9 object properties
GET
/order/{id}curl https://api.paystack.co/order/1559046 \
-H "Authorization: Bearer YOUR_SECRET_KEY"import { Paystack } from "@paystack/paystack-sdk";
const paystack = new Paystack({ secretKey: process.env.PAYSTACK_SECRET_KEY! });
const response = await paystack.order.fetch("1559046");
console.log(response.data);require "paystack"
paystack = Paystack::Client.new(ENV.fetch("PAYSTACK_SECRET_KEY"))
response = paystack.order.fetch("1559046")
puts response.dataResponse
{
"status": true,
"message": "Order retrieved",
"data": {
"id": 12345,
"code": "ORD_abc123def456",
"amount": 20000,
"currency": "NGN",
"status": "success",
"customer": {
"id": 297346561,
"email": "[email protected]"
},
"line_items": [
{
"product": {
"id": 2196244,
"name": "Sample Product"
},
"quantity": 2,
"amount": 20000
}
],
"createdAt": "2024-11-01T12:00:00.000Z"
}
}{
"status": false,
"message": "An error occurred",
"meta": {
"nextStep": "string"
},
"type": "string",
"code": "validation_error",
"errorCodeMappingNotFound": true
}{
"status": false,
"message": "An error occurred",
"meta": {
"nextStep": "string"
},
"type": "string",
"code": "validation_error",
"errorCodeMappingNotFound": true
}Copy link Fetch Product Orders
Fetch all orders for a particular product
Path Parameters
The unique identifier of the order
Response
200Order Fetch Product response
6 object properties
GET
/order/product/{id}curl https://api.paystack.co/order/product/1559046 \
-H "Authorization: Bearer YOUR_SECRET_KEY"import { Paystack } from "@paystack/paystack-sdk";
const paystack = new Paystack({ secretKey: process.env.PAYSTACK_SECRET_KEY! });
const response = await paystack.order.product("1559046");
console.log(response.data);require "paystack"
paystack = Paystack::Client.new(ENV.fetch("PAYSTACK_SECRET_KEY"))
response = paystack.order.product("1559046")
puts response.dataResponse
{
"status": true,
"message": "Product orders retrieved",
"data": [
{
"id": 12345,
"code": "ORD_abc123def456",
"amount": 20000,
"currency": "NGN",
"status": "success",
"customer": {
"email": "[email protected]"
},
"createdAt": "2024-11-01T12:00:00.000Z"
}
],
"meta": {
"total": 1,
"skipped": 0,
"perPage": 50,
"page": 1,
"pageCount": 1
}
}{
"status": false,
"message": "An error occurred",
"meta": {
"nextStep": "string"
},
"type": "string",
"code": "validation_error",
"errorCodeMappingNotFound": true
}{
"status": false,
"message": "An error occurred",
"meta": {
"nextStep": "string"
},
"type": "string",
"code": "validation_error",
"errorCodeMappingNotFound": true
}Copy link Validate Order
Validate a pay for me order
Path Parameters
The unique code of a previously created order
Response
200Order Validate response
24 object properties
4 object properties
9 object properties
GET
/order/{code}/validatecurl https://api.paystack.co/order/ORD_6z0lqwpmxrm7dsp/validate \
-H "Authorization: Bearer YOUR_SECRET_KEY"import { Paystack } from "@paystack/paystack-sdk";
const paystack = new Paystack({ secretKey: process.env.PAYSTACK_SECRET_KEY! });
const response = await paystack.order.validate("ORD_6z0lqwpmxrm7dsp");
console.log(response.data);require "paystack"
paystack = Paystack::Client.new(ENV.fetch("PAYSTACK_SECRET_KEY"))
response = paystack.order.validate("ORD_6z0lqwpmxrm7dsp")
puts response.dataResponse
{
"status": true,
"message": "Order is valid",
"data": {
"id": 12345,
"code": "ORD_abc123def456",
"amount": 20000,
"currency": "NGN",
"status": "pending",
"valid": true
}
}{
"status": false,
"message": "An error occurred",
"meta": {
"nextStep": "string"
},
"type": "string",
"code": "validation_error",
"errorCodeMappingNotFound": true
}{
"status": false,
"message": "An error occurred",
"meta": {
"nextStep": "string"
},
"type": "string",
"code": "validation_error",
"errorCodeMappingNotFound": true
}