Introduction
This documentation aims to provide all the information you need to work with our API.
Base URL
http://localhost
Authenticating requests
To authenticate requests, include an Authorization header with the value "Bearer {YOUR_API_TOKEN}".
All authenticated endpoints are marked with a requires authentication badge in the documentation below.
You can retrieve your token by visiting going to this form.
Merchants
Endpoints for managing merchants.
Changes
- 2024-06-17: Support for non-DK countries added, requires input in
company_informationarray-field. - 2024-06-17: The
informationfield has been renamed tocompany_information.
Create a merchant
requires authentication
If a webhook is not provided, the request will take up to 10 seconds.
If a webhook is provided, the request will use the webhook to inform when the merchant creation process is done.
Example request:
curl --request POST \
"http://merchant.pensopay.com/api/merchants" \
--header "Authorization: Bearer {YOUR_API_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"reference_id\": \"398475\",
\"contact_name\": \"John Doe\",
\"contact_email\": \"johndoe@example.com\",
\"company_phone\": \"77344388\",
\"business_model_description\": \"hic\",
\"country\": \"DK\",
\"cvr\": \"36410876\",
\"iban\": \"DK9230055205310542\",
\"company_information\": [
\"sapiente\"
],
\"url\": \"https:\\/\\/pensopay.com\",
\"webhook\": \"https:\\/\\/example.com\\/webhooks\",
\"addons\": [
\"asperiores\"
]
}"
const url = new URL(
"http://merchant.pensopay.com/api/merchants"
);
const headers = {
"Authorization": "Bearer {YOUR_API_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"reference_id": "398475",
"contact_name": "John Doe",
"contact_email": "johndoe@example.com",
"company_phone": "77344388",
"business_model_description": "hic",
"country": "DK",
"cvr": "36410876",
"iban": "DK9230055205310542",
"company_information": [
"sapiente"
],
"url": "https:\/\/pensopay.com",
"webhook": "https:\/\/example.com\/webhooks",
"addons": [
"asperiores"
]
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'http://merchant.pensopay.com/api/merchants';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_API_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'reference_id' => '398475',
'contact_name' => 'John Doe',
'contact_email' => 'johndoe@example.com',
'company_phone' => '77344388',
'business_model_description' => 'hic',
'country' => 'DK',
'cvr' => '36410876',
'iban' => 'DK9230055205310542',
'company_information' => [
'sapiente',
],
'url' => 'https://pensopay.com',
'webhook' => 'https://example.com/webhooks',
'addons' => [
'asperiores',
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (201, Successful request without a webhook):
{
"data": {
"uuid": "3af2082e-e6c6-4a53-be24-2741eff37a3d",
"reference_id": 398475,
"state": "live_awaiting_approval",
"country": "DK",
"cvr": "36410876",
"contact_name": "John Doe",
"contact_email": "johndoe@pensopay.com",
"url": "https://pensopay.com",
"company_information": {
"cvr": 36410876,
"city": "Vejle",
"name": "PENSOPAY A/S",
"email": "contact@pensopay.com",
"phone": "77344388",
"address": "Roms Hule 4, 3. sal",
"zipcode": 7100
},
"created_at": "2022-04-20T13:37:00.000000Z",
"credentials": {
"pensopay": {
"token": "9037c9b0b8690aa148b2d28b9d2a949e8a664055570df4c5b964c503a2047422",
"account_id": 112233,
"private_key": "b9f11f2b2cd3feb6b682322890dc7d9946a20d118a84607451291c298bd60f78"
}
},
"addons": {
"mobilepay": true
}
}
}
Example response (401, Unauthorized (missing or invalid API token)):
{
"message": "Unauthenticated."
}
Example response (403, Insufficient API token permissions):
{
"message": "This action is unauthorized."
}
Example response (422, Validation error of input):
{
"message": "The given data was invalid.",
"errors": {
"contact_name": [
"The name field is required."
],
"contact_email": [
"The email field is required."
],
"iban": [
"The iban field is required."
],
"cvr": [
"The cvr field is invalid."
]
}
Example response (500, Internal server error):
{
"message": "An internal error occured. Pensopay has been notified."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
List merchants
requires authentication
List all merchants created by authenticated user
Example request:
curl --request GET \
--get "http://merchant.pensopay.com/api/merchants?page=41&per_page=5" \
--header "Authorization: Bearer {YOUR_API_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://merchant.pensopay.com/api/merchants"
);
const params = {
"page": "41",
"per_page": "5",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_API_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'http://merchant.pensopay.com/api/merchants';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_API_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'page' => '41',
'per_page' => '5',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200, Collection of merchants created):
{
"data": [
{
"uuid": "3af2082e-e6c6-4a53-be24-2741eff37a0d",
"reference_id": 398475,
"state": "live_awaiting_approval",
"cvr": "36410876",
"contact_name": "John Doe",
"contact_email": "johndoe@pensopay.com",
"url": "https://pensopay.com",
"company_information": {
"cvr": 36410876,
"city": "Vejle",
"name": "PENSOPAY A/S",
"email": "contact@pensopay.com",
"phone": "77344388",
"address": "Roms Hule 4, 3. sal",
"zipcode": 7100
},
"created_at": "2022-04-20T13:37:00.000000Z",
"credentials": {
"pensopay": {
"token": "9837c9b0b8690aa148b2d28b9d2a949e8a664055570df4c5b964c503a1047422",
"account_id": 112233,
"private_key": "b9f10f2b2cd3feb6b682322890cc7d9946a20d118a84607451291c298bd60f78"
}
},
"addons": {
"mobilepay": true
}
}
]
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Show single merchant
requires authentication
Example request:
curl --request GET \
--get "http://merchant.pensopay.com/api/merchants/culpa" \
--header "Authorization: Bearer {YOUR_API_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://merchant.pensopay.com/api/merchants/culpa"
);
const headers = {
"Authorization": "Bearer {YOUR_API_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'http://merchant.pensopay.com/api/merchants/culpa';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_API_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200, Merchant):
{
"data": {
"uuid": "3af2082e-e6c6-4a53-be24-2741eff37a0d",
"reference_id": 398475,
"state": "live_awaiting_approval",
"cvr": "36410876",
"contact_name": "John Doe",
"contact_email": "johndoe@pensopay.com",
"url": "https://pensopay.com",
"company_information": {
"cvr": 36410876,
"city": "Vejle",
"name": "PENSOPAY A/S",
"email": "contact@pensopay.com",
"phone": "77344388",
"address": "Roms Hule 4, 3. sal",
"zipcode": 7100
},
"created_at": "2022-04-20T13:37:00.000000Z",
"credentials": {
"pensopay": {
"token": "9837c9b0b8690aa148b2d28b9d2a949e8a664055570df4c5b964c503a1047422",
"account_id": 112233,
"private_key": "b9f10f2b2cd3feb6b682322890cc7d9946a20d118a84607451291c298bd60f78"
}
},
"addons": {
"mobilepay": true
}
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Request merchant off-boarding
requires authentication
Example request:
curl --request DELETE \
"http://merchant.pensopay.com/api/merchants/labore" \
--header "Authorization: Bearer {YOUR_API_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://merchant.pensopay.com/api/merchants/labore"
);
const headers = {
"Authorization": "Bearer {YOUR_API_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'http://merchant.pensopay.com/api/merchants/labore';
$response = $client->delete(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_API_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (204, Successful request):
Empty response
Example response (401, Unauthorized (missing or invalid API token)):
{
"message": "Unauthenticated."
}
Example response (403, Insufficient API token permissions):
{
"message": "This action is unauthorized."
}
Example response (500, Internal server error):
{
"message": "An internal error occured. Pensopay has been notified."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Update a merchant
requires authentication
Partially update a merchant.
Example request:
curl --request PATCH \
"http://merchant.pensopay.com/api/merchants/iusto" \
--header "Authorization: Bearer {YOUR_API_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
const url = new URL(
"http://merchant.pensopay.com/api/merchants/iusto"
);
const headers = {
"Authorization": "Bearer {YOUR_API_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "PATCH",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'http://merchant.pensopay.com/api/merchants/iusto';
$response = $client->patch(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_API_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200, Update merchant):
{
"data": {
"uuid": "3af2082e-e6c6-4a53-be24-2741eff37a0d",
"reference_id": 398475,
"state": "live_awaiting_approval",
"cvr": "36410876",
"contact_name": "John Doe",
"contact_email": "johndoe@pensopay.com",
"url": "https://pensopay.com",
"company_information": {
"cvr": 36410876,
"city": "Vejle",
"name": "PENSOPAY A/S",
"email": "contact@pensopay.com",
"phone": "77344388",
"address": "Roms Hule 4, 3. sal",
"zipcode": 7100
},
"created_at": "2022-04-20T13:37:00.000000Z",
"credentials": {
"pensopay": {
"token": "9837c9b0b8690aa148b2d28b9d2a949e8a664055570df4c5b964c503a1047422",
"account_id": 112233,
"private_key": "b9f10f2b2cd3feb6b682322890cc7d9946a20d118a84607451291c298bd60f78"
}
},
"addons": {
"mobilepay": true
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.