Authentication & Webhook Setup

Authentication & Webhook Setup

Firstly, you'll need to make sure that you can authenticate to the API and setup your webhook endpoints. The Fiat Republic API uses the OAuth 2.0 client credentials authentication flow and requires a Bearer Token to authenticate requests. All API calls must include a Bearer Token in the Authorisation header.

Step 1: Create a Client ID and Secret

Create your Client ID from the Developers section on the Dashboard.

📘

Client Secret

Your Client Secret will be displayed only once so ensure that you copy and store it in a secure location.


Step 2: Authenticate and Generate a Token

Generate your Bearer Token by sending your Client ID, Client Secret and Scope in the request body of the Create API Token endpoint.

curl --request POST \
     --url https://sandbox.fiatrepublic.com/passport/oauth/token \
     --header 'Accept: application/json' \
     --header 'Content-Type: application/x-www-form-urlencoded' \
     --data '
{
	grant_type: "client_credentials"
	scope: "PAYMENTS"
	client_id: "your_client_id"
	client_secret: "your_client_secret"
}
'
{
   "access_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJI...",
   "token_type":"bearer",
   "expires_in":3599,
   "refresh_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1..."
}

📘

Bearer Token

Bearer Tokens are valid for for 60 minutes.


Step 3: Setup Webhook Endpoints

Create a webhook endpoint by selecting "Add Endpoint" on the Webhooks page on the Dashboard. The webhook endpoints will listen to relevant events triggered by the creation and changes to and/or of entities.

🚧

Most POST requests on Fiat Republic are processed asynchronously and therefore we highly recommend that you make use of Webhooks in your integration.

We recommend that at the very least, you subscribe to the following events:

  1. VIRTUAL_ACCOUNT.STATUS_UPDATED - To get notified when bank details are assigned to a Virtual Account and its status is updated to ACTIVE
  2. PAYMENT.CREATED - To get notified when a new incoming or outgoing payment is created
  3. PAYMENT.STATUS_UPDATED - To get notified of status changes on Payments

📘

Receiving Webhook Events

For testing purposes, you can make use of webhook.site to temporarily setup and receive webhook events.