Authentication via API Key

As a customer, you can connect to the API via an API key which allows you to access your own company informations.

Create a new API key from the PayFit app

  1. Log in PayFit as an admin of your company.
  2. Go to https://app.payfit.com/integrations/hub/api and click on “Create a key”.
  3. Configure your key with an explicit label and the appropriate scopes
  4. Copy your newly created key and save it securely. You will not be able to access it again in the PayFit interface for security reasons.

Authenticate your request

Your API key will only give you access to your own company.

Once your token is ready, you can use it to request our API. Just pass the token to the API in the Authorization header of your request, as a bearer, like in the below example :

curl --request GET \
     --url https://partner-api.payfit.com/<endpoint> \
     --header 'Authorization: Bearer YOUR-API-KEY'

How to retrieve your companyId ?

Your token is now stored on your server.

The access_token is valid for your company but you need to retrieve your companyId, so you can request the introspection POST endpoint https://oauth.payfit.com/introspect with the following cURL command:

curl -X POST \
https://oauth.payfit.com/introspect \
-H 'Authorization: Bearer YOUR-API-KEY' \
-H 'Content-Type: application/json' \
-d '{ "token": "YOUR-API-KEY" }'

This request will return a JSON response with the company_id:

{
"active": true,
"scope": "scope1 scope2",
"company_id": "the_company_id",
"token_type": "bearer"
}

From now on, the value company_id is yours. Store it and use it on all your requests to call the API.

Continue with the API

You can now authenticate any request available through the API reference.