Authorization
The Splice Payment API uses Basic Authentication for all endpoints.
To authenticate your requests, you need to include an Authorization header with a Base64-encoded string of your username and password.
How to Perform Basic Authentication
- Encode your credentials: Combine your username and password into a single string with a colon separating them (username:password).
- Encode this string using Base64.
- Add the Authorization header: Include an Authorization header in your HTTP request with the value
Basic {base64encoded_credentials}
.
Authorization: Basic Base64Encode(username:password)
Here's how you can generate the Base64-encoded string in a few programming languages:
Python
import base64
credentials = 'username:password'
encoded_credentials = base64.b64encode(credentials.encode('utf-8')).decode('utf-8')
print(f'Basic {encoded_credentials}')
JavaScript
const credentials = 'username:password';
const encodedCredentials = btoa(credentials);
console.log(`Basic ${encodedCredentials}`);
Using Authentication in API Requests
Once you have your encoded credentials, include them in the Authorization
header of your API requests. Here's an example using cURL to get all financial institutions:
curl --request GET \
--url https://sandbox.splice.africa/institutions \
--header 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmA='
Best practices
Always keep your credentials secure and never share them in client-side code or public repositories.
Next steps
You may proceed to the next section learn more about how we use webhooks for payment notifications.
Or you can start interacting with our sandbox and exploring the rest of the endpoints here: API Reference
If you have any questions, you can reach out to us on email support@splice.africa or join our Discord server. We are always online and happy to help.