How to use the API

This guide covers everything you need to get started with the FarPay API, including obtaining your API key and understanding request requirements.

Quick Start

Generating an API Key

To access FarPay's API, you need to generate an API key:

  1. Log in to your FarPay account.
  2. Navigate to Settings → API Access.
  3. Click Generate.
  4. Save the generated key securely — you will use it to authenticate your API requests.

Common for all requests

All requests must comply to following terms.

Term

Description

API Key

A key - the identifyer, that is added to the header of each request in FarPay API

Accept

The accept term in the header, asks the API to deliver the results in a given format. Available formats are:

  • application/json
  • application/xml

Using the API Key

To authenticate your request, include the API key in the X-API-KEY header of your HTTP request. Here’s an example using curl:

`curl -X GET \
  --header 'Accept: application/json' \
  --header 'X-API-KEY: {api-key}' \
  'https://api.farpay.io/v2/customers'

Replace {api-key} with your actual API key.

Error Handling

If the provided API key is invalid or unauthorized, the API will return the following error message:

{
  "Message": "9000::X-API-KEY is not authenticated"
}

Possible Reasons

Possible Reasons:

  • The API key has been deleted.
  • The API key has been regenerated, and you're using an old one.

Best Practices

Although API keys do not expire, it is recommended to rotate them at least every 6 months.

Store your API keys securely and avoid exposing them in public code or logs.

Remove any unused or compromised keys from the FarPay dashboard immediately.

Core Concepts

ResourceDescriptionEndpointStatus
CustomersManage customer information and payment agreements/customers
OrdersCreate payment flows and agreements/orders
InvoicesGenerate and manage invoices/invoices
PaymentsTrack payment history and process refunds/payments
AgreementsManage recurring payment instruments/agreements
SubscriptionsHandle subscription-based recurring payments/subscriptionsDeprecated
Payment SetsAccess aggregated payment information/paymentsets
DeliveriesUpload files for batch processing/deliveries

Payment Methods Supported

  • MobilePay - Mobile payment solution
  • Cards - Visa, MasterCard, Dankort
  • Betalingsservice - Direct debit for private customers
  • Leverandørservice - Direct debit for businesses

Date Formats

  • Input dates: YYYY-MM-DD
  • Response dates: YYYY-MM-DDTHH:mm:ssZ