curl --request POST \
--url https://sandbox-b2b.ripio.com/oauth2/token/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form grant_type=client_credentials \
--form client_id=DzZTzx2iam7jdaCZA85VRpKut10qDy6SGDsTYHTJ \
--form client_secret=UcIKFqnh1EHg1nC2eL6dN9NTbFjXUuXn0J3QBxPUfyXKKXLfiVxCN19UNucd9W7fiKbUCs5cIOC6GvnKAHuTEPTCVKQSaAf8wP0KIIPR7qkl0rLpFq3oJTvUFslg6D9Wimport requests
url = "https://sandbox-b2b.ripio.com/oauth2/token/"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"grant_type\"\r\n\r\nclient_credentials\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"client_id\"\r\n\r\nDzZTzx2iam7jdaCZA85VRpKut10qDy6SGDsTYHTJ\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"client_secret\"\r\n\r\nUcIKFqnh1EHg1nC2eL6dN9NTbFjXUuXn0J3QBxPUfyXKKXLfiVxCN19UNucd9W7fiKbUCs5cIOC6GvnKAHuTEPTCVKQSaAf8wP0KIIPR7qkl0rLpFq3oJTvUFslg6D9W\r\n-----011000010111000001101001--"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "multipart/form-data"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const form = new FormData();
form.append('grant_type', 'client_credentials');
form.append('client_id', 'DzZTzx2iam7jdaCZA85VRpKut10qDy6SGDsTYHTJ');
form.append('client_secret', 'UcIKFqnh1EHg1nC2eL6dN9NTbFjXUuXn0J3QBxPUfyXKKXLfiVxCN19UNucd9W7fiKbUCs5cIOC6GvnKAHuTEPTCVKQSaAf8wP0KIIPR7qkl0rLpFq3oJTvUFslg6D9W');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://sandbox-b2b.ripio.com/oauth2/token/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox-b2b.ripio.com/oauth2/token/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"grant_type\"\r\n\r\nclient_credentials\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"client_id\"\r\n\r\nDzZTzx2iam7jdaCZA85VRpKut10qDy6SGDsTYHTJ\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"client_secret\"\r\n\r\nUcIKFqnh1EHg1nC2eL6dN9NTbFjXUuXn0J3QBxPUfyXKKXLfiVxCN19UNucd9W7fiKbUCs5cIOC6GvnKAHuTEPTCVKQSaAf8wP0KIIPR7qkl0rLpFq3oJTvUFslg6D9W\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox-b2b.ripio.com/oauth2/token/"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"grant_type\"\r\n\r\nclient_credentials\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"client_id\"\r\n\r\nDzZTzx2iam7jdaCZA85VRpKut10qDy6SGDsTYHTJ\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"client_secret\"\r\n\r\nUcIKFqnh1EHg1nC2eL6dN9NTbFjXUuXn0J3QBxPUfyXKKXLfiVxCN19UNucd9W7fiKbUCs5cIOC6GvnKAHuTEPTCVKQSaAf8wP0KIIPR7qkl0rLpFq3oJTvUFslg6D9W\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox-b2b.ripio.com/oauth2/token/")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"grant_type\"\r\n\r\nclient_credentials\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"client_id\"\r\n\r\nDzZTzx2iam7jdaCZA85VRpKut10qDy6SGDsTYHTJ\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"client_secret\"\r\n\r\nUcIKFqnh1EHg1nC2eL6dN9NTbFjXUuXn0J3QBxPUfyXKKXLfiVxCN19UNucd9W7fiKbUCs5cIOC6GvnKAHuTEPTCVKQSaAf8wP0KIIPR7qkl0rLpFq3oJTvUFslg6D9W\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-b2b.ripio.com/oauth2/token/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"grant_type\"\r\n\r\nclient_credentials\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"client_id\"\r\n\r\nDzZTzx2iam7jdaCZA85VRpKut10qDy6SGDsTYHTJ\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"client_secret\"\r\n\r\nUcIKFqnh1EHg1nC2eL6dN9NTbFjXUuXn0J3QBxPUfyXKKXLfiVxCN19UNucd9W7fiKbUCs5cIOC6GvnKAHuTEPTCVKQSaAf8wP0KIIPR7qkl0rLpFq3oJTvUFslg6D9W\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"access_token": "gAgXJcRMnGP6TG9vFcepgP6OMtProD",
"expires_in": 36000,
"token_type": "Bearer",
"scope": "read write"
}{
"error": "invalid_client"
}Get Access Token
Every call to the API has to be authenticated with an OAuth2 Token. In order to request this token, you will need to have sandbox or production API Keys (client_id and client_secret) that will allow to negotiate an ephemeral access token.
To generate the access token, you should call this endpoint providing the header Authorization with the following schema: Basic CREDENTIAL where CREDENTIAL should be specified as a string with the formatclient_id:client_secret encoded in Base64.
curl --request POST \
--url https://sandbox-b2b.ripio.com/oauth2/token/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form grant_type=client_credentials \
--form client_id=DzZTzx2iam7jdaCZA85VRpKut10qDy6SGDsTYHTJ \
--form client_secret=UcIKFqnh1EHg1nC2eL6dN9NTbFjXUuXn0J3QBxPUfyXKKXLfiVxCN19UNucd9W7fiKbUCs5cIOC6GvnKAHuTEPTCVKQSaAf8wP0KIIPR7qkl0rLpFq3oJTvUFslg6D9Wimport requests
url = "https://sandbox-b2b.ripio.com/oauth2/token/"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"grant_type\"\r\n\r\nclient_credentials\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"client_id\"\r\n\r\nDzZTzx2iam7jdaCZA85VRpKut10qDy6SGDsTYHTJ\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"client_secret\"\r\n\r\nUcIKFqnh1EHg1nC2eL6dN9NTbFjXUuXn0J3QBxPUfyXKKXLfiVxCN19UNucd9W7fiKbUCs5cIOC6GvnKAHuTEPTCVKQSaAf8wP0KIIPR7qkl0rLpFq3oJTvUFslg6D9W\r\n-----011000010111000001101001--"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "multipart/form-data"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const form = new FormData();
form.append('grant_type', 'client_credentials');
form.append('client_id', 'DzZTzx2iam7jdaCZA85VRpKut10qDy6SGDsTYHTJ');
form.append('client_secret', 'UcIKFqnh1EHg1nC2eL6dN9NTbFjXUuXn0J3QBxPUfyXKKXLfiVxCN19UNucd9W7fiKbUCs5cIOC6GvnKAHuTEPTCVKQSaAf8wP0KIIPR7qkl0rLpFq3oJTvUFslg6D9W');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://sandbox-b2b.ripio.com/oauth2/token/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox-b2b.ripio.com/oauth2/token/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"grant_type\"\r\n\r\nclient_credentials\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"client_id\"\r\n\r\nDzZTzx2iam7jdaCZA85VRpKut10qDy6SGDsTYHTJ\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"client_secret\"\r\n\r\nUcIKFqnh1EHg1nC2eL6dN9NTbFjXUuXn0J3QBxPUfyXKKXLfiVxCN19UNucd9W7fiKbUCs5cIOC6GvnKAHuTEPTCVKQSaAf8wP0KIIPR7qkl0rLpFq3oJTvUFslg6D9W\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox-b2b.ripio.com/oauth2/token/"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"grant_type\"\r\n\r\nclient_credentials\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"client_id\"\r\n\r\nDzZTzx2iam7jdaCZA85VRpKut10qDy6SGDsTYHTJ\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"client_secret\"\r\n\r\nUcIKFqnh1EHg1nC2eL6dN9NTbFjXUuXn0J3QBxPUfyXKKXLfiVxCN19UNucd9W7fiKbUCs5cIOC6GvnKAHuTEPTCVKQSaAf8wP0KIIPR7qkl0rLpFq3oJTvUFslg6D9W\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox-b2b.ripio.com/oauth2/token/")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"grant_type\"\r\n\r\nclient_credentials\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"client_id\"\r\n\r\nDzZTzx2iam7jdaCZA85VRpKut10qDy6SGDsTYHTJ\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"client_secret\"\r\n\r\nUcIKFqnh1EHg1nC2eL6dN9NTbFjXUuXn0J3QBxPUfyXKKXLfiVxCN19UNucd9W7fiKbUCs5cIOC6GvnKAHuTEPTCVKQSaAf8wP0KIIPR7qkl0rLpFq3oJTvUFslg6D9W\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-b2b.ripio.com/oauth2/token/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"grant_type\"\r\n\r\nclient_credentials\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"client_id\"\r\n\r\nDzZTzx2iam7jdaCZA85VRpKut10qDy6SGDsTYHTJ\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"client_secret\"\r\n\r\nUcIKFqnh1EHg1nC2eL6dN9NTbFjXUuXn0J3QBxPUfyXKKXLfiVxCN19UNucd9W7fiKbUCs5cIOC6GvnKAHuTEPTCVKQSaAf8wP0KIIPR7qkl0rLpFq3oJTvUFslg6D9W\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"access_token": "gAgXJcRMnGP6TG9vFcepgP6OMtProD",
"expires_in": 36000,
"token_type": "Bearer",
"scope": "read write"
}{
"error": "invalid_client"
}Authorizations
B2B’s White Label API uses OAuth2. Currently there is only one supported authentication flow:
- clientCredentials allows you to access your own B2B account (First-Party Integration) and performs transactions against the public API. This oauth2 flow is well suited for this API, as it allows machine-to-machine communication.
Every call to the API has to be authenticated with an OAuth2 Token. In order to request this token, you will need to have sandbox or production API Keys (client id and client secret) that will be needed to generate a credential in order to negotiate an ephemeral access token.
Every request must be accompianed by an Authorization header with a value that follows the following schema: Bearer ACCESS_TOKEN
Headers
Basic CREDENTIAL
Body
Response
Successful response
Was this page helpful?