Generate JWT Token

Credentials

No credentials are documented for this endpoint.

Generates a new JWT token using the client key and seller key.

Parameters

This endpoint takes no path, query or header parameters.

Request body

Content type: application/json

Field Type Required Description
mpl string no
key string no

Request example

{
  "mpl": "MPLMPL",
  "key": "clientkey"
}

Code samples

curl

curl -X POST 'https://sandbox.payme.io/api/auth/token' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "mpl": "MPLMPL",
  "key": "clientkey"
}'

Node.js

const response = await fetch("https://sandbox.payme.io/api/auth/token", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "mpl": "MPLMPL",
    "key": "clientkey"
  }),
});

console.log(await response.text());

Python

import requests

response = requests.post(
    "https://sandbox.payme.io/api/auth/token",
    json={
        "mpl": "MPLMPL",
        "key": "clientkey",
    },
)

print(response.text)

PHP

<?php

$body = <<<'BODY'
{
  "mpl": "MPLMPL",
  "key": "clientkey"
}
BODY;

$ch = curl_init('https://sandbox.payme.io/api/auth/token');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => $body,
]);

$response = curl_exec($ch);
curl_close($ch);

echo $response;

Responses

200 — Token generated successfully. (success)

Field Type Description
access_token string The generated JWT token.
refresh_token string The type of the token, typically 'Bearer'.

400 — Bad Request (error)

Field Type Description
status_code integer
message string
status_error_code integer

401 — Unauthorized (error)

Field Type Description
status_code integer
message string
status_error_code integer

500 — Internal Server Error (error)

Field Type Description
status_code integer
message string
status_error_code integer