Products


 

Our API provide you with a variety of product types -

 S/N  Product Type  Description
 1.  Product  These are tangible products. The flow of buying this type
of product has an extra step of address
 2.  Event  These are for events or more like digital products (not bills). The flow does not include the address because it
usually does not include it.
 3.  Invoice  This is for creating invoice

 

 Name Type Required Description
   String   Yes  produnt name
 qty  Number   Yes  product quantity
 desc  String   Yes  description of the product
 type / product_type  String  Yes  type of product to be created
 case_quantity  Number  optional  
 case_price  Number  optional  
 weight  Number   Yes  weight of the
 product_code  Number  Yes  This is the returned 'code' when a product is successfully created

 

Creating a Product


   curl -X POST \
     '{{base-url}}/{merchant_id}/products'

payload

    {
      "name": "test",
      "qty": "1",
      "price": "23232",
      "desc": "testing",
      "type": "product",
      "case_quantity":
      "23",
      "case_price": "12",
      "weight" : "223"
    }

Response :

    {
        "status": "success",
        "data": {
            "code": "285429"
        }
    }

 

Edit a Product

Products can be edited and updated through authorised merchant by calling on the following endpoint


   curl -X PUT \
     '{{base-url}}/{merchant_id}/product/code/{product_code}'

Payload :

    {
        "name": "test",
        "qty": "1",
        "price": "23232",
        "desc": "tetsting",
        "type": "product",
        "case_quantity":
        "23",
        "case_price": "12",
        "weight" : "2293"
    }
Response :

    {
        "status": "success",
        "data": {
            "message": "Product successfully updated"
        }
    }

 

Delete a product

Products can be deleted by passing it code to the query in a DELETE request.

   curl -X DELETE \
     '{{base-url}}/{merchant_id}/product/code/{product_code}'

Response :
    {
        "status": "success",
        "data": {
            "message": "Product successfully deleted"
        }
    }

 

Get all created products by type

To fetch the list of all available product, send a query to this endpoint.

   curl -X DELETE \
     '{{base-url}}/{merchant_id}/products/{product_type}'
Expected response :
    {
        "status": "success",
        "data": [
            {
                "code": "059288",
                "name": "test",
                "price": 23232,
                "desc": "tetsting",
                "type": "product",
                "case_quantity": 23,
                "case_price": 12,
                "weight": "product",
                "created": "2023-06-26 14:54:29",
                "updated": "2023-06-26 14:54:29"
            },
            .
            .
            .
        ]
    }

 

Get product by product code

A single product can be fetched with its product_code

   curl -X GET \
     'https://tft-spark.co/ogaranya/v1/{merchant_id}/product/code/{product_code}'

Expected Response :
    {
        "status": "success",
        "data": {
            "code": "059288",
            "name": "test",
            "price": 23232,
            "desc": "testing",
            "type": "product",
            "case_quantity": 23,
            "case_price": 12,
            "weight": "223",
            "created": "2023-06-26 14:54:29",
            "updated": "2023-06-26 14:54:29"
        }
    }