Product

A collection of endpoints for creating and managing inventories

Copy link List Products

List all previously created products

Query Parameters

perPageinteger
Number of records to fetch per page
pageinteger
The section to retrieve
activeboolean
The state of the product
fromstring
The start date
tostring
The end date

Response

200Product Lists response
statusrequiredboolean
messagerequiredstring
datarequiredarray[object]
metarequiredobject
5 object properties
totalrequiredinteger
skippedrequiredinteger
perPagerequiredstring
pagerequiredinteger
pageCountrequiredinteger
GET/product
curl https://api.paystack.co/product \
  -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.product.list({
  perPage: 100,
  page: 100
});
console.log(response.data);
require "paystack"

paystack = Paystack::Client.new(ENV.fetch("PAYSTACK_SECRET_KEY"))

response = paystack.product.list({
  per_page: 100,
  page: 100
})
puts response.data
Response
{
  "status": true,
  "message": "Products retrieved",
  "data": [
    {
      "id": 795638,
      "name": "Mimshack",
      "description": "Everything cars",
      "product_code": "PROD_22deobcvbht2dfe",
      "slug": "mimshack-yiuedh",
      "currency": "NGN",
      "price": 50000,
      "quantity": 10,
      "quantity_sold": 0,
      "active": true,
      "domain": "test",
      "type": "good",
      "in_stock": true,
      "unlimited": false,
      "metadata": {
        "background_color": "#F5F5F5"
      },
      "files": [],
      "success_message": null,
      "redirect_url": null,
      "split_code": null,
      "notification_emails": null,
      "minimum_orderable": 1,
      "maximum_orderable": null,
      "createdAt": "2022-04-12T11:21:43.000Z",
      "updatedAt": "2022-04-12T11:21:43.000Z",
      "digital_assets": [],
      "variant_options": [],
      "is_shippable": true,
      "shipping_fields": {
        "delivery_note": "disabled"
      },
      "integration": 463433,
      "low_stock_alert": 0
    },
    {
      "id": 682324,
      "name": "Nike Air 23",
      "description": "Just do it!",
      "product_code": "PROD_4vg503b3qga3vul",
      "slug": "nike-air-23-gylbao",
      "currency": "NGN",
      "price": 25000000,
      "quantity": 7,
      "quantity_sold": 0,
      "active": true,
      "domain": "test",
      "type": "good",
      "in_stock": true,
      "unlimited": false,
      "metadata": {
        "background_color": "#05090b"
      },
      "files": [
        {
          "key": "products/2eppxpcv5mqdulp7l410.jpeg",
          "type": "image",
          "path": "https://res.cloudinary.com/paystack/image/upload/public/files/products/2eppxpcv5mqdulp7l410.jpeg",
          "original_filename": "download.jpeg"
        }
      ],
      "success_message": "Thanks for your order",
      "redirect_url": "https://nike.com",
      "split_code": null,
      "notification_emails": null,
      "minimum_orderable": 1,
      "maximum_orderable": null,
      "createdAt": "2022-03-02T11:48:09.000Z",
      "updatedAt": "2022-03-02T11:50:57.000Z",
      "digital_assets": [],
      "variant_options": [],
      "is_shippable": true,
      "shipping_fields": {
        "delivery_note": "optional",
        "shipping_fees": [
          {
            "region": "Ikeja",
            "fee": 100000,
            "currency": "NGN"
          },
          {
            "region": "Yaba",
            "fee": 150000,
            "currency": "NGN"
          },
          {
            "region": "Rest of Lagos",
            "fee": 300000,
            "currency": "NGN"
          }
        ]
      },
      "integration": 463433,
      "low_stock_alert": 0
    },
    {
      "id": 489399,
      "name": "Puff Puff",
      "description": "Crispy flour ball with fluffy interior",
      "product_code": "PROD_ddot3upakgl3ejt",
      "slug": "puff-puff-prqnxc",
      "currency": "NGN",
      "price": 5000,
      "quantity": 100,
      "quantity_sold": 0,
      "active": true,
      "domain": "test",
      "type": "good",
      "in_stock": true,
      "unlimited": false,
      "metadata": {
        "background_color": "#F5F5F5"
      },
      "files": [],
      "success_message": null,
      "redirect_url": null,
      "split_code": null,
      "notification_emails": null,
      "minimum_orderable": 1,
      "maximum_orderable": null,
      "createdAt": "2021-11-08T14:39:37.000Z",
      "updatedAt": "2021-11-08T14:39:37.000Z",
      "digital_assets": [],
      "variant_options": [],
      "is_shippable": true,
      "shipping_fields": {
        "delivery_note": "disabled"
      },
      "integration": 463433,
      "low_stock_alert": 0
    }
  ],
  "meta": {
    "total": 3,
    "skipped": 0,
    "perPage": 50,
    "page": 1,
    "pageCount": 1
  }
}
{
  "status": false,
  "message": "Invalid Key"
}
{
  "status": false,
  "message": "An error occurred",
  "meta": {
    "nextStep": "string"
  },
  "type": "string",
  "code": "validation_error",
  "errorCodeMappingNotFound": true
}

Copy link Create Product

Create a new product on your integration

Request Body

namerequiredstring
Name of product
descriptionrequiredstring
The description of the product
pricerequiredinteger
Price should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR
currencyrequiredstring
Currency in which price is set. Allowed values are: NGN, GHS, ZAR or USD
unlimitedboolean
Set to true if the product has unlimited stock. Leave as false if the product has limited stock
quantityinteger
Number of products in stock. Use if limited is true
split_codestring
The split code if sharing the transaction with partners
metadatastring
Stringified JSON object of custom data

Response

201Product Create response
statusrequiredboolean
messagerequiredstring
datarequiredobject
28 object properties
variants_optionsrequiredarray[object]
variantsrequiredarray[object]
namerequiredstring
descriptionrequiredstring
currencyrequiredstring
pricerequiredinteger
quantityrequiredinteger
typerequiredstring
is_shippablerequiredboolean
unlimitedrequiredboolean
filesrequiredarray[object]
shipping_fieldsrequiredobject
3 object properties
delivery_noterequiredstring
shipping_addressrequiredstring
shipping_feesrequiredarray[object]
integrationrequiredinteger
domainrequiredstring
metadatarequiredobject
1 object property
background_colorrequiredstring
slugrequiredstring
product_coderequiredstring
quantity_soldrequiredinteger
activerequiredboolean
deleted_atrequiredstring
in_stockrequiredboolean
minimum_orderablerequiredinteger
maximum_orderablerequiredinteger
redirect_urlstring
low_stock_alertrequiredboolean
idrequiredinteger
createdAtrequiredstring
updatedAtrequiredstring
POST/product
curl https://api.paystack.co/product \
  -H "Authorization: Bearer YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Cups",
    "description": "Environment friendly paper cups",
    "price": 10000,
    "currency": "NGN"
  }' \
  -X POST
import { Paystack } from "@paystack/paystack-sdk";

const paystack = new Paystack({ secretKey: process.env.PAYSTACK_SECRET_KEY! });

const response = await paystack.product.create({
  name: "Cups",
  description: "Environment friendly paper cups",
  price: 10000,
  currency: "NGN"
});
console.log(response.data);
require "paystack"

paystack = Paystack::Client.new(ENV.fetch("PAYSTACK_SECRET_KEY"))

response = paystack.product.create({
  name: "Cups",
  description: "Environment friendly paper cups",
  price: 10000,
  currency: "NGN"
})
puts response.data
Response
{
  "status": true,
  "message": "Product successfully created",
  "data": {
    "name": "Puff Puff",
    "description": "Crispy flour ball with fluffy interior",
    "currency": "NGN",
    "price": 5000,
    "quantity": 100,
    "is_shippable": true,
    "unlimited": false,
    "integration": 463433,
    "domain": "test",
    "metadata": {
      "background_color": "#F5F5F5"
    },
    "slug": "puff-puff-prqnxc",
    "product_code": "PROD_ddot3upakgl3ejt",
    "quantity_sold": 0,
    "type": "good",
    "shipping_fields": {
      "delivery_note": "disabled"
    },
    "active": true,
    "in_stock": true,
    "minimum_orderable": 1,
    "maximum_orderable": null,
    "low_stock_alert": false,
    "id": 489399,
    "createdAt": "2021-11-08T14:39:37.303Z",
    "updatedAt": "2021-11-08T14:39:37.303Z"
  }
}
{
  "status": false,
  "message": "Invalid Key"
}

Copy link Fetch Product

Fetch a previously created product

Path Parameters

idrequiredinteger
The unique identifier of the product

Response

200Product Fetch response
statusrequiredboolean
messagerequiredstring
datarequiredobject
33 object properties
digital_assetsrequiredarray[object]
integrationrequiredinteger
namerequiredstring
descriptionrequiredstring
product_coderequiredstring
pricerequiredinteger
currencyrequiredstring
quantityrequiredinteger
quantity_soldrequiredstring
typerequiredstring
filesrequiredarray[object]
file_pathrequiredstring
is_shippablerequiredboolean
shipping_fieldsrequiredobject
3 object properties
delivery_noterequiredstring
shipping_addressrequiredstring
shipping_feesrequiredarray[object]
unlimitedrequiredboolean
domainrequiredstring
activerequiredboolean
featuresrequiredstring
in_stockrequiredboolean
metadatarequiredobject
1 object property
background_colorrequiredstring
slugrequiredstring
success_messagerequiredstring
redirect_urlrequiredstring
split_coderequiredstring
notification_emailsrequiredstring
minimum_orderablerequiredinteger
maximum_orderablerequiredstring
low_stock_alertrequiredboolean
stock_thresholdrequiredstring
expires_inrequiredstring
idrequiredinteger
createdAtrequiredstring
updatedAtrequiredstring
GET/product/{id}
curl https://api.paystack.co/product/2196244 \
  -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.product.fetch("2196244");
console.log(response.data);
require "paystack"

paystack = Paystack::Client.new(ENV.fetch("PAYSTACK_SECRET_KEY"))

response = paystack.product.fetch("2196244")
puts response.data
Response
{
  "status": true,
  "message": "Product retrieved",
  "data": {
    "digital_assets": [],
    "integration": 463433,
    "name": "Mimshack",
    "description": "Everything cars",
    "product_code": "PROD_22deobcvbht2dfe",
    "price": 50000,
    "currency": "NGN",
    "quantity": 10,
    "quantity_sold": null,
    "type": "good",
    "files": null,
    "file_path": null,
    "is_shippable": true,
    "shipping_fields": {
      "delivery_note": "disabled"
    },
    "unlimited": false,
    "domain": "test",
    "active": true,
    "features": null,
    "in_stock": true,
    "metadata": {
      "background_color": "#F5F5F5"
    },
    "slug": "mimshack-yiuedh",
    "success_message": null,
    "redirect_url": null,
    "split_code": null,
    "notification_emails": null,
    "minimum_orderable": 1,
    "maximum_orderable": null,
    "low_stock_alert": false,
    "stock_threshold": null,
    "expires_in": null,
    "id": 795638,
    "createdAt": "2022-04-12T11:21:43.000Z",
    "updatedAt": "2022-04-12T11:21:43.000Z"
  }
}
{
  "status": false,
  "message": "An error occurred",
  "meta": {
    "nextStep": "string"
  },
  "type": "string",
  "code": "validation_error",
  "errorCodeMappingNotFound": true
}
{
  "status": false,
  "message": "Product not found"
}

Copy link Update product

Update a previously created product

Path Parameters

idrequiredinteger
The unique identifier of the product

Request Body

namestring
Name of product
descriptionstring
The description of the product
priceinteger
Price should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR
currencystring
Currency in which price is set. Allowed values are: NGN, GHS, ZAR or USD
unlimitedboolean
Set to true if the product has unlimited stock. Leave as false if the product has limited stock
quantityinteger
Number of products in stock. Use if limited is true
split_codestring
The split code if sharing the transaction with partners
metadataobject
JSON object of custom data

Response

200Product Update response
statusrequiredboolean
messagerequiredstring
datarequiredobject
32 object properties
namerequiredstring
descriptionrequiredstring
product_coderequiredstring
pricerequiredinteger
currencyrequiredstring
quantityrequiredinteger
quantity_soldrequiredinteger
typerequiredstring
filesrequiredarray[object]
file_pathrequiredstring
is_shippablerequiredboolean
shipping_fieldsrequiredobject
3 object properties
delivery_noterequiredstring
shipping_addressrequiredstring
shipping_feesrequiredarray[object]
unlimitedrequiredboolean
domainrequiredstring
activerequiredboolean
featuresrequiredstring
in_stockrequiredboolean
metadatarequiredobject
1 object property
background_colorrequiredstring
slugrequiredstring
success_messagerequiredstring
redirect_urlrequiredstring
split_coderequiredstring
notification_emailsrequiredstring
minimum_orderablerequiredinteger
maximum_orderablerequiredstring
low_stock_alertrequiredboolean
stock_thresholdrequiredstring
expires_inrequiredstring
idrequiredinteger
integrationrequiredinteger
createdAtrequiredstring
updatedAtrequiredstring
PUT/product/{id}
curl https://api.paystack.co/product/2196244 \
  -H "Authorization: Bearer YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Spoon",
    "description": "Environment friendly paper spoons"
  }' \
  -X PUT
import { Paystack } from "@paystack/paystack-sdk";

const paystack = new Paystack({ secretKey: process.env.PAYSTACK_SECRET_KEY! });

const response = await paystack.product.update("2196244", {
  name: "Spoon",
  description: "Environment friendly paper spoons"
});
console.log(response.data);
require "paystack"

paystack = Paystack::Client.new(ENV.fetch("PAYSTACK_SECRET_KEY"))

response = paystack.product.update("2196244", {
  name: "Spoon",
  description: "Environment friendly paper spoons"
})
puts response.data
Response
{
  "status": true,
  "message": "Product successfully updated",
  "data": {
    "name": "Prod One",
    "description": "Prod 1",
    "product_code": "PROD_ohc0xq1ajpt2271",
    "price": 20000,
    "currency": "NGN",
    "quantity": 5,
    "quantity_sold": null,
    "type": "good",
    "image_path": "",
    "file_path": "",
    "is_shippable": false,
    "unlimited": false,
    "domain": "test",
    "active": true,
    "features": null,
    "in_stock": true,
    "metadata": null,
    "id": 526,
    "integration": 343288,
    "createdAt": "2019-06-29T14:46:52.000Z",
    "updatedAt": "2019-06-29T15:29:21.000Z"
  }
}
{
  "status": false,
  "message": "Invalid Key"
}
{
  "status": false,
  "message": "An error occurred",
  "meta": {
    "nextStep": "string"
  },
  "type": "string",
  "code": "validation_error",
  "errorCodeMappingNotFound": true
}

Copy link Delete Product

Delete a previously created product

Path Parameters

idrequiredinteger
The unique identifier of the product

Response

200Product Delete response
statusrequiredboolean
messagerequiredstring
DELETE/product/{id}
curl https://api.paystack.co/product/2196244 \
  -H "Authorization: Bearer YOUR_SECRET_KEY" \
  -X DELETE
import { Paystack } from "@paystack/paystack-sdk";

const paystack = new Paystack({ secretKey: process.env.PAYSTACK_SECRET_KEY! });

const response = await paystack.product.delete("2196244");
console.log(response.data);
require "paystack"

paystack = Paystack::Client.new(ENV.fetch("PAYSTACK_SECRET_KEY"))

response = paystack.product.delete_("2196244")
puts response.data
Response
{
  "status": true,
  "message": "Request successful"
}
{
  "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
}