Search Overlay

Making API Calls

Before making your first API call, you need to have some or all of the following information ready:

  • API endpoint – the URL to which you send your request; its format depends on the type of API call.
  • API key – you receive this when you sign up for a Test account and obtain access to the Paysafe Back Office. You must include it in the Authorization HTTPS header for most API requests. Log in to the Back Office, choose Settings > API Key and make a note of your API Key User name and Password; the password is also available in Base64 encoded format.
  • Account number – some API calls require an account number (Account ID), where it is included either in the API endpoint (e.g. Card Payments, 3D Secure and Direct Debit) or in the body of the request (e.g. Hosted, extendedOptions). You receive your account number when you sign up for a Test account and obtain access to the Paysafe Back Office -  log in, choose Accounts, and copy your account number from the Account column.
  • Message body – this must be valid JSON and contain valid Paysafe JSON objects as required for the type of request. Not all API calls require a message body – GET requests do not require a body, for example.
  • Resource ID – some API calls require a resource ID in the API endpoint – to refer to a resource that has been created in a previous step, for example.

Merchant Account Credentials

Most API calls, although not all, require you to include the following credentials:

Credentials Description Example
API Key

Your API key is available in two forms:

  • Username and password; or
  • Base64 encoded

Username – 66040-1001062690

Password – B-qa2-0-579b6aec-0-606c02147caae097f4392898ca08ae736e51d3093af388d90214528ac70b69c0359d3173d12480d07275ca54a7c7

Account ID

A unique account number that must be included in Card Payments, 3D Secure, Direct Debit, and Alternate Payments API requests, but is not needed for other types of API request. Different accounts support different payment method/ currency combinations.

1001062690

Example

The following code snippet provides an example of the above credentials, included in a cURL request:

curl -X POST https://api.test.paysafe.com/subscriptionsplans/v1/
-u 66040-1001062690:B-qa2-0-579b6aec-0-606c02147caae097f4392898ca08ae736e51d3093af388d90214528ac70b69c0359d3173d12480d07275ca54a7c7 \
-H 'Content-Type: application/json'

Note the format to include in your API request as shown above:

  • 66040-1001062690 – the number sequence before the colon is your user name, to be included in the API endpoint.
  • B-qa2-0-579b6aec-0-… – the number sequence after the colon is your password.
  • The user name and password should be Base64 encoded before being included in your API request. You can do this manually or automate it using a tool. For more information, see Authentication.

Troubleshooting API Requests

Below is a brief list of issues that can result in problems:

  • Not sending the request over HTTPS.
  • Failure to include the correct authentication details (i.e. your API key) – a common error is adding spaces before or after the API key.
  • Incorrect JSON syntax in the body of your request.
  • Specifying the incorrect HTTP method – for most API requests this is POST, while requests for retrieving information from the Paysafe platform use GET.
  • Forgetting to change the account number (account ID) in the endpoint to your actual account number for those calls that require it.
  • Using an account number (account ID) that does not support the request type.

For further details, see Troubleshooting.