POST https://sandbox.payme.io/api/oauth2/tokenPOST https://live.payme.io/api/oauth2/tokenclient_secret (required): Your client secretUse this endpoint to obtain an access token using Client Credentials or to refresh an existing token.
This endpoint takes no path, query or header parameters.
Content type: application/x-www-form-urlencoded
| Field | Type | Required | Description |
|---|---|---|---|
grant_type |
string | yes | The grant type |
scope |
string | no | Space-separated scopes |
client_id |
string | yes | Your client ID |
client_secret |
string | yes | Your client secret |
refresh_token |
string | no | Required when grant_type is refresh_token |
{
"grant_type": "client_credentials",
"scope": "partner-api",
"client_id": "your-client-id",
"client_secret": "your-client-secret"
}
curl -X POST 'https://sandbox.payme.io/api/oauth2/token' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'scope=partner-api' \
--data-urlencode 'client_id=your-client-id' \
--data-urlencode 'client_secret=your-client-secret'
const response = await fetch("https://sandbox.payme.io/api/oauth2/token", {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
body: new URLSearchParams({
"grant_type": "client_credentials",
"scope": "partner-api",
"client_id": "your-client-id",
"client_secret": "your-client-secret"
}),
});
console.log(await response.text());
import requests
response = requests.post(
"https://sandbox.payme.io/api/oauth2/token",
data={
"grant_type": "client_credentials",
"scope": "partner-api",
"client_id": "your-client-id",
"client_secret": "your-client-secret",
},
)
print(response.text)
<?php
$ch = curl_init('https://sandbox.payme.io/api/oauth2/token');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Content-Type: application/x-www-form-urlencoded',
],
CURLOPT_POSTFIELDS => http_build_query([
'grant_type' => 'client_credentials',
'scope' => 'partner-api',
'client_id' => 'your-client-id',
'client_secret' => 'your-client-secret',
]),
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
| Field | Type | Description |
|---|---|---|
token_type |
string | |
access_token |
string | JWT access token |
refresh_token |
string | Refresh token |
expires_in |
integer | Access token lifetime in seconds |
refresh_expires_in |
integer | Refresh token lifetime in seconds |
scope |
string | Granted scopes |
| Field | Type | Description |
|---|---|---|
error |
string | |
error_description |
string |