NAV
Request and response

Introduction

Welcome to the IOP API!

Create Account and login

Login and head to the API page to start

Authentication

The request POST https://api.iop.com/v1/oauth/token

    {
        "grant_type" : "client_credentials",
        "client_id" : "your_client_id",
        "client_secret" : "your_client_secret"
     }

Response

     {
        "token_type": "Bearer",
        "expires_in": 31536000,
        "access_token": "access_token"
     }

URL

POST https://api.iop.com/v1/oauth/token

Headers

Key Value
Accept application/json

Parameters

Parameter Type
grant_type String, required
client_id String, required
client_secret String, required

Response JSON

Parameter Type
token_type String, required
expires_in String, required
access_token String, required

To authorize, use this code:


# You can just pass the correct header with each request

curl "api_endpoint_here"
  -H "Authorization: Bearer authkey1234"

Make sure to replace authkey1234 with your API key.

IOP uses API keys to allow access to the API. You can register a new IOP API key at the API tab.

IOP expects for the API key to be included in all API requests to the server in a header that looks like the following:

Authorization: Bearer key12345!21

Escrow API

The request:



curl "https://api.iop.com/v1/create/escrow-transaction" \
    -X POST \
    -u "email-address:your-api-key" \
    -H "Content-Type: application/json" \
    -d '
{


    "name": "Samsung",
    "description": "The sale of a TV",
    "second_party_email: "customer@email.com",
    "phone_number": "0712345678",
    "amount": 20.00,
    "invoice_number": "INV002",
    "get_redirect_url": "https://api.iop.com/redirect.me/123",
    "post_callback_url": "https://api.iop.com/callback.me/123",


}'

The above command returns JSON structured Response like this:



    [
        {

            "transaction_id": "abcg142csfsgydgf",
            "transaction_link": "https://transactionx@iop.com/22453fsfgsh",


        }
    ]

Webhook Response



    [
        {

            "ioPId": "IoP2334553",
            "transactionId": "22453fsfgsh",
            "invoiceNumber": "INVXXX",
            "transactionAmount": 300.00,
            "transactionCost": 20.00,
            "actualAmount": 320.00,
            "payment_status": "Completed",
            "receiptNumber": "RECPXXXX",
            "transactionDate": "12:30 20/10/2020",
            "payerName": "customer X",
            "phone_Number": "0745123456"



        }
    ]

How Escrow payment works

This applies to payments for goods and services money is released upon delivery of goods

Escrow image

How to create an Escrow API

URL

POST https://api.iop.com/v1/create/escrow-transaction

Headers

Key Value
Accept application/json

Parameters

Parameter Description Type
name Name of the Item String, required
description Item description String, required
second_party_email buyer email String, required
phone_number buyer phone number String, required
amount The Item Amount Integer, required
invoice_number The Invoice number String, required
get_redirect_url redirect back String, required
post_callback_url post callback url String, required

Response JSON

Parameter Type
transaction_id String, required
transaction_link String, required

Payment Gateway

The request:




    curl "https://api.iop.com/v1/create/pgw-transaction" \
        -X POST \
        -u "email-address:your-api-key" \
        -H "Content-Type: application/json" \
        -d '
    {

        "amount": "10",
        "invoice_number": "INV001",
        "redirect_url": "https://redirect.me",
        "post_callback_url": "https://postcallback.me/here"

    }'

The above command returns JSON structured Response like this:



    [
        {

            "transaction_id": "abcg142csfsgydgf",
            "transaction_link": "https://transactionx@iop.com/22453fsfgsh",


        }
    ]

Webhook Response



    [
        {

            "ioPId": "IoP2334553",
            "transactionId": "22453fsfgsh",
            "invoiceNumber": "INVXXX",
            "transactionAmount": 300.00,
            "transactionCost": 20.00,
            "actualAmount": 320.00,
            "payment_status": "Completed",
            "receiptNumber": "RECPXXXX",
            "transactionDate": "12:30 20/10/2020",
            "payerName": "customer X",
            "phone_Number": "0745123456"





        }
    ]


This is for basic payments by use of all payment where escrow service is not necessary.

How DirectPay works

directpay

How to create DirectPay Gateway

URL

POST https://api.iop.com/v1/create/pgw-transaction

Headers

Key Value
Accept application/json

Parameters

Parameter Description Type
amount payment amount Integer, required
invoice_number Invoice String, required
get_redirect_url redirect url String, required
post_callback_url callback url String, required

Response JSON

Parameter Type
transaction_id String, required
transaction_link String, required

LipaPolePole API

The request:




    curl "https://api.iop.com/v1/create/lipapolepole-transaction" \
        -X POST \
        -u "email-address:your-api-key" \
        -H "Content-Type: application/json" \
        -d '
    {

        "item_name": "Bed",
        "item_description": "Sofa Bed",
        "email: "customer@email.com",
        "invoice_number": "INV111",
        "phone_number": "0712345678",
        "item_amount": 200.00,
        "redirect_url": "https://redirect.me",
        "post_callback_url": "https://postcallback.me/here"


    }'

The above command returns JSON structured Response like this:


    [
        {

            "transaction_id": "abcg142csfsgydgf",
            "transaction_link": "https://transactionx@iop.com/22453fsfgsh",


        }
    ]

Webhook Response



        [
            {

                "ioPId": "IoP2334553",
                "transactionId": "22453fsfgsh",
                "invoiceNumber": "INVXXX",
                "transactionAmount": 1000.00,
                "transactionCost": 20.00,
                "actualAmount": 5000.00,
                "payment_status": "Completed",
                "receiptNumber": "RECPXXXX",
                "transactionDate": "12:30 20/10/2020",
                "payerName": "customer X",
                "phone_Number": "0745123456",
                "lipaPolePoleTotalPaid": 1000,
                "lipaPolePoleBalance": 4000




            }
        ]

Sellers can accept payment terms that allows the buyer to pay in instalments until completion of the amount payable then the product is delivered.

How LipaPolePole works

lipapolepole

How to create LipaPolePole Payment API

URL

POST https://api.iop.com/v1/create/lipapolepole-transaction

Headers

Key Value
Accept application/json

Parameters

Parameter Description Type
item_name name of the item String, required
item_description Description of the item String, required
invoice_number Invoice String, required
item_amount The Item Amount Integer, required
get_redirect_url redirect url String, required
post_callback_url callback url String, required

Response JSON

Parameter Type
transaction_id String, required
transaction_link String, required

Agent/Broker Escrow API

The request:



    curl "https://api.iop.com/v1/create/agent-escrow-transaction" \
        -X POST \
        -u "email-address:your-api-key" \
        -H "Content-Type: application/json" \
        -d '
    {

        "item_name": "Fridge",
        "description":"20 litres",
        "broker_email: "broker@email.com",
        "broker_phone_number": "0712345678",
        "buyer_email: "customer@email.com",
        "buyer_phone_number": "0712345678",
        "total_amount": 200.00

    }'

The above command returns JSON structured Response like this:



    [
        {

            "transaction_id": "abcg142csfsgydgf",
            "transaction_link": "https://transactionx@iop.com/22453fsfgsh",


        }
    ]

Assurance of Agents/Brokers fees upon completion of a transaction eg. Car dealers, drop shippers etc

How agent/broker module works

broker

How to create an agent/broker module API

URL

POST https://api.iop.com/v1/create/agent-escrow-transaction

Headers

Key Value
Accept application/json

Parameters

Parameter Description Type
currency KES or USD String, required
item_Name Name of the Item String, required
decription Item descriptioon String, required
broker_email broker email String, required
broker_phone_number broker phone number String, required
buyer_email Customer email String, required
buyer_phone_number Customer phone number String, required
total_amount The Item Amount Float, required

Response JSON

Parameter Type
transaction_id String, required
transaction_link String, required

Escrow Social media Links & Buttons

How to Create an Escrow Button

Parameter Description
Item Name Name of the Item
Item Decription Item Metadata or descriptioon
Third Party transaction ID In case your system has its own Transaction ID
Amount The Item Amount

Button Name Button Link
55 Inch Button Buy with Escrow

Errors

The IOP Escrow Payment API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key is wrong.
403 Forbidden -- The transaction requested is hidden for administrators only.
404 Not Found -- The specified transaction could not be found.
405 Method Not Allowed -- You tried to access a transaction with an invalid method.
406 Not Acceptable -- You requested a format that isn't json.
410 Gone -- The transaction requested has been removed from our servers.
429 Too Many Requests -- You're requesting too many transactions! Slow down!
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.