MENU navbar-image

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

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."
}
 

Request   

POST api/merchants

Headers

Authorization      

Example: Bearer {YOUR_API_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

reference_id   string  optional  

Internal reference id you can choose to use. Example: 398475

contact_name   string   

The name of the business' contact. Example: John Doe

contact_email   string   

The email of the business' contact. Example: johndoe@example.com

company_phone   string  optional  

The phone number for the business. Example: 77344388

business_model_description   string   

A short business model description for the merchant. Example: hic

country   string  optional  

The country for the business is optional, will default to "DK" if not provided. If set to something else than "DK", the information field is required. Example: DK

cvr   string   

The business' VAT number. Example: 36410876

iban   string   

The business' iban number. Example: DK9230055205310542

company_information   string[]  optional  

Optional company information is REQUIRED if country is not set to "DK"

name   string   

Example: iure

address   string   

Example: molestiae

zipcode   string   

Example: eligendi

city   string   

Example: aut

phone   string   

Example: soluta

email   string   

Must be a valid email address. Example: amiya.kuphal@example.org

url   string  optional  

The URL for the business is optional. Example: https://pensopay.com

webhook   string   

URL to send merchant's private keys and tokens to. Example: https://example.com/webhooks

addons   string[]  optional  

Specify which addons should be enabled on creation

mobilepay   boolean  optional  

Enable MobilePay on creation? Example: true

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
            }
        }
    ]
}
 

Request   

GET api/merchants

Headers

Authorization      

Example: Bearer {YOUR_API_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

page   integer  optional  

Which page to display. Must be at least 1. Example: 41

per_page   integer  optional  

How many items to display per page. Must be at least 1. Must not be greater than 50. Example: 5

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
        }
    }
}
 

Request   

GET api/merchants/{merchant_id}

Headers

Authorization      

Example: Bearer {YOUR_API_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

merchant_id   string   

The merchant's VAT or UUID Example: culpa

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."
}
 

Request   

DELETE api/merchants/{merchant_id}

Headers

Authorization      

Example: Bearer {YOUR_API_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

merchant_id   string   

The merchant's VAT or UUID Example: labore

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
        }
 }
 

Request   

PATCH api/merchants/{merchant_id}

Headers

Authorization      

Example: Bearer {YOUR_API_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

merchant_id   string   

The merchant's VAT or UUID Example: iusto

Body Parameters

addons   string[]  optional  
mobilepay   boolean  optional  

Example: true