Skip to content

Products

The ProductResource allows you to create and manage inventories on your integration. This is useful for selling physical or digital goods directly through Paystack.

Create Product

Create a product on your integration.

Important: The price should be in the subunit of the supported currency (e.g., kobo for Naira, pesewas for Cedi).

php

$product = paystack()->product()->create([
    'name' => 'Puff Puff',
    'description' => 'Crispy flour ball with fluffy interior',
    'price' => 5000, // 50.00
    'currency' => 'NGN',
    'unlimited' => false,
    'quantity' => 100
]);

Parameters

ParameterTypeRequiredDescription
nameStringYesName of product.
descriptionStringYesA description for this product.
priceIntegerYesPrice should be in the subunit of the supported currency.
currencyStringYesCurrency in which price is set.
unlimitedBooleanNoSet to true if the product has unlimited stock. Leave as false if the product has limited stock.
quantityIntegerNoNumber of products in stock. Use if unlimited is false.

List Products

List products available on your integration.

php
// List all products
$products = paystack()->product()->list();

// Filter products
$filtered = paystack()->product()->list([
    'perPage' => 20,
    'page' => 1,
    'from' => '2023-01-01',
    'to' => '2023-12-31'
]);

Parameters

ParameterTypeDescription
perPageIntegerSpecify how many records you want to retrieve per page. Default: 50.
pageIntegerSpecify exactly what page you want to retrieve. Default: 1.
fromDatetimeA timestamp from which to start listing products.
toDatetimeA timestamp at which to stop listing products.

Fetch Product

Get details of a product on your integration.

php
$id = 489399; // Product ID

$details = paystack()->product()->fetch($id);

Update Product

Update a product's details on your integration.

php
$id = 489399;

$updated = paystack()->product()->update($id, [
    'name' => 'Puff Puff (Large)',
    'price' => 7000,
    'quantity' => 50
]);

Parameters

ParameterTypeDescription
nameStringName of product.
descriptionStringA description for this product.
priceIntegerPrice should be in the subunit of the supported currency.
currencyStringCurrency in which price is set.
unlimitedBooleanSet to true if the product has unlimited stock.
quantityIntegerNumber of products in stock. Use if unlimited is false.

Use Cases

The Products API is ideal for:

  1. E-commerce: Managing inventory for an online store.
  2. Digital Goods: Selling e-books, music, or software.
  3. Event Tickets: Selling limited tickets for an event.
  4. Donations: Creating fixed-price donation items.

By creating products, you can easily generate payment links or embed them on your website, allowing Paystack to handle the checkout process and inventory management for you.

Released under the MIT License.