Off-chain integration

Introduction

Off-chain integration is one of the cheapest and most efficient way to enable fiat payments for your customers. This type of integration can support the sales of both traditional in-game items (web2) and NFTs (web3).

Poko will require an API to get item details from merchants and will return a payload with all the purchasing details to the merchants, who can then deliver the item to the buyers themselves.

High Level Overview

In order to integrate off-chain, the merchant must have the ability to deliver the item to the buyer once receiving payload from Poko. In the case of an NFT purchase, the merchant must be able to mint the NFT and send to buyers on-chain. The Off-Chain Integration operates in the following manner:

  1. A customer completes the checkout process on Poko's widget.

  2. Poko notifies the merchant of payment completion by calling a standardized endpoint implemented by them.

  3. The merchant transfers the NFT to the designated wallet address supplied by Poko, which corresponds to the buyer's address.

  4. Poko facilitates automated settlement.

How to integrate off-chain flow

Step 1: Set up 2 merchant endpoints

  • Get item information. This allows Poko to fetch basic information from your server about the item the customer is going to buy.

    • GET /get-item/:id

      Sample Response:

      {
          "message": "Item Fetched successfully",
          "data": {
              "id": "c4678973-0d85-4198-acde-15fdda32fddb",
              "itemName": "Poko's Item",
              "price": 10,
              "cryptoCurrency": "USDC",
              "available": true
          }
      }
  • Send the item to the buyer. This allows Poko to instruct the merchant to send the purchased item to the customer. Poko handles transaction monitoring with information provided by the transaction status endpoint.

    • Post /webhook - Payload sample:

      {
        "orderId": "d482ee0e-1c98-4dda-bc5c-654d20e61373",
        "itemId": "cdh_30days",
        "quantity": 1,
        "price": 240,
        "totalTokenAmount": 240,
        "totalFiatUsdAmount": 0.65,
        "userID": "NFFlxMGZG8qU3",
        "createdAt": "2023-05-17T17:30:16.606Z",
        "orderCompletedAt": "2023-05-17T17:30:16.606Z"
      }

Step: 2: Request Poko to configure the endpoints

  • Request Poko to configure the endpoints and get the testing widgets

Step 3: Integrate the widget

Step 4: Switch to production mode

  • Request Poko to go live

Last updated