Skipping screens

Typical flow

A typical user order follows these steps:

  1. Amount Selection: The user opens the "Amount" page, selects their country and preferred payment method, chooses a cryptocurrency, enters the desired amount, and clicks "Next".

  2. Wallet Connection: The user is taken to the Wallet page, where they connect their wallet via MetaMask, WalletConnect, or another supported option. Once the wallet is successfully connected, the user is automatically redirected to the next step.

  3. Authentication: On the Auth page, the user enters their email address and submits a one-time password (OTP) sent to them.

    • If the order amount exceeds a certain threshold, the user is prompted to complete KYC verification by submitting ID document details, photos, and a selfie.

  4. Order Details: The user reviews the order details, fills in any required additional information (e.g., phone number, bank type), and clicks "Transfer Funds" to create the order. This redirects them to the next page.

  5. Transfer Instructions: The user receives instructions on how to transfer funds to the agent handling the order. After sending the funds, the user clicks "Confirm". Once the transaction is approved, the cryptocurrency is delivered to the user's wallet.

Most of the provided pages can be skipped, so a user journey would be much shorter.

Skipping the Amount page

To skip the Amount page, the next URL parameters must be predefined:

  • countryIsoCode

  • network

  • asset

  • currency

  • amount

  • source (from your merchant dashboard)

So, if you want to create an order for Nigeria via bank transfer for 2 CELO USDT, the URL will be the next:

https://pay.fonbnk.com/wallet?source=xsdf_2&network=CELO&asset=USDT&amount=2&currency=crypto&paymentChannel=bank&countryIsoCode=NG You've skipped the Amount page by opening the wallet page with preconfigured order params.

Skipping the Wallet page

To skip the wallet page, we need to add 2 more parameters to the existing ones:

  • address

  • signature

"address" param contains the user's wallet address, and a signature is a JWT token (HS256 encryption algorithm) generated using the "URL signature secret" value as a secret (from the merchant dashboard). You must add some unique value to the token payload to make each token unique because we don't allow to create more than 1 order using the same signature. During testing, you can generate a JWT signature using this website: https://jwt.io/.

An example of a token generation in typescript:

import * as jsonwebtoken from 'jsonwebtoken';
import { v4 as uuid } from 'uuid';

const token = jsonwebtoken.sign(
    {
      uid: uuid(),
    },
    YOUR_SIGNATURE_SECRET,
    {
      algorithm: 'HS256',
    },
 );

So, if you want to skip the wallet page, the URL should look like this: https://pay.fonbnk.com/auth?source=xsdf_2&network=CELO&asset=USDT&amount=2&currency=crypto&paymentChannel=bank&countryIsoCode=NG&address=0x91b0a33dbcb10f8331eD3627B94e5a9B1591269f&signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOiJ3ZmVuZmVrbndmZWtud2Zua2plMzIyMjEzMTIzMTIzMTIzIn0.bkFNaPYEeLNoUv7RhCWWROdbsGgJCQQp9Xpk628EoJA You've skipped the Wallet page by opening the Auth page with preconfigured order params and wallet address with signature.

Skipping the Auth page

To skip the auth page, you must log in on behalf of a user and provide his access and refresh tokens to the URL.

This step requires you to interact with our Merchant API. Here you can find how to send requests.

You must call this endpoint with user email and country ISO code and in the response you'll get the access and refresh tokens.

{​
  "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",​
  "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"​
​}

After getting the tokens, you must add them to the URL as "at" and "rt" params, so the URL would look like this:

https://pay.fonbnk.com/swap?source=xsdf_2&network=CELO&asset=USDT&amount=2&currency=crypto&paymentChannel=bank&countryIsoCode=NG&address=0x91b0a33dbcb10f8331eD3627B94e5a9B1591269f&signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOiJ3ZmVuZmVrbndmZWtud2Zua2plMzIyMjEzMTIzMTIzMTIzIn0.bkFNaPYEeLNoUv7RhCWWROdbsGgJCQQp9Xpk628EoJA&at=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9&rt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9 You've skipped the Auth page by opening the Order page with preconfigured order params, wallet address with signature, and already logged-in user via access and refresh token URL params.

Skipping KYC

KYC step can be skipped only by removing the KYC requirement from the merchant, so we don't ask for KYC for this merchant's orders. This can be done by contacting our support team and only if you do KYC on your side already.

Skipping the Order page

To skip the order page you must predefine 2 more URL parameters:

  • quoteId

  • requiredFields

Both of these params you get from the best offer API endpoint with includeRequiredFields param present. The response will be like this:

{
  "quoteId": "6878df150d6289ffdedcd6f4",
  ...,
  "requiredFields": {
    "phoneNumber": {
      "label": "Your phone number",
      "sellerLabel": "Buyer's phone number",
      "type": "phone",
      "required": true
    }
  }
}

Now you must fill a required field object, stringify it and encode for URL safety and provide quoteId and requiredFields to the URL. Required fields encoding example:

const values = {
  phoneNumber: "2346034088631"
};
const encoded = encodeURIComponent(JSON.stringify(values));
// %7B%22phoneNumber%22%3A%222346034088631%22%7D

Now, you must add all the parameters to the /auto-order page, aslo the flow=onramp must be added because this page can be used for off-ramps too:

https://pay.fonbnk.com/auto-order?source=xsdf_2&network=CELO&asset=USDT&amount=2&currency=crypto&paymentChannel=bank&countryIsoCode=NG&address=0x91b0a33dbcb10f8331eD3627B94e5a9B1591269f&signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOiJ3ZmVuZmVrbndmZWtud2Zua2plMzIyMjEzMTIzMTIzMTIzIn0.bkFNaPYEeLNoUv7RhCWWROdbsGgJCQQp9Xpk628EoJA&at=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9&rt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9&quoteId=6878df150d6289ffdedcd6f4&requiredFields=%7B%22phoneNumber%22%3A%222346034088631%22%7D&flow=onramp When a user lands on this page, an order will be created automatically, and a user will see the transfer instructions page.

You can use /auto-order page for all the cases above; just provide as much info as you can to this page and it'll automatically redirect to the appropriate page, don't forget to add the flow=onramp param there.

Last updated