REST API Architecture
APIs that adhere to the REST architectural constraints are called RESTful APIs, or simply REST APIs. The Paysafe HTTP-based REST APIs are defined with the following aspects:
- Standard HTTP methods
For example: GET, POST, DELETE, and PUT - Base API endpoint
For example: https://api.test.paysafe.com/cardpayments/v1/accounts/account_id/auths - JSON Content-Type header
All Paysafe REST APIs use Content-Type: application/json - Basic Access Authorization header
This consists of Authorization: followed by the authorization method, a space, and then the Base64 encoded version of your API key username and password separated by a colon. For example:
Authorization: Basic NTUwMzAtMTAwMTA2MjY5MDpCLXFhMi0wLTU3OWI2YWVjLTAtMzAyYzAyMTQ3Y
Most REST API testing tools, such as the Postman REST Client, can create this header automatically from your API key user name and password.
For more details about Basic access authentication, see this Wikipedia article. - Body of the request
The body of the request is a payload in JSON format.
This table describes the supported HTTP methods.
HTTP Method | Description |
---|---|
GET | Request details from the Paysafe payment platform, such as the status of a transaction. |
POST | Send details to the Paysafe payment platform, such as an authorization or settlement request. POST is also used to create a new entity e.g. a customer's address. |
DELETE | Delete a record or transaction from the Paysafe payment platform. |
PUT | Change or update an existing record on the Paysafe payment platform. |
Testing API Calls Using a REST Client
You can use a browser-based REST client, such as Postman or the Advanced REST client, to send test API requests to the Paysafe platform. The figure below shows an example of how to configure and send a request using Postman. This functionality enables you to try out the API using a standard web browser on your local PC.