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
priceshould 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
| Parameter | Type | Required | Description |
|---|---|---|---|
name | String | Yes | Name of product. |
description | String | Yes | A description for this product. |
price | Integer | Yes | Price should be in the subunit of the supported currency. |
currency | String | Yes | Currency in which price is set. |
unlimited | Boolean | No | Set to true if the product has unlimited stock. Leave as false if the product has limited stock. |
quantity | Integer | No | Number 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
| Parameter | Type | Description |
|---|---|---|
perPage | Integer | Specify how many records you want to retrieve per page. Default: 50. |
page | Integer | Specify exactly what page you want to retrieve. Default: 1. |
from | Datetime | A timestamp from which to start listing products. |
to | Datetime | A 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
| Parameter | Type | Description |
|---|---|---|
name | String | Name of product. |
description | String | A description for this product. |
price | Integer | Price should be in the subunit of the supported currency. |
currency | String | Currency in which price is set. |
unlimited | Boolean | Set to true if the product has unlimited stock. |
quantity | Integer | Number of products in stock. Use if unlimited is false. |
Use Cases
The Products API is ideal for:
- E-commerce: Managing inventory for an online store.
- Digital Goods: Selling e-books, music, or software.
- Event Tickets: Selling limited tickets for an event.
- 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.
