List current subscriptions
A simple GET request is sent to /subscriptions endpoint. The same authentication mechanism is used for the request as when calling the webhooks API.
curl -X GET \
https://webhook-api.mypos.com/v1/subscriptions \
-H 'Authorization: Bearer PLpC1CqVE9CYXolbGNBPqz0NYy8asFzG95XcToDsMP'
import requests
requests.get(
url='https://webhook-api.mypos.com/v1/subscriptions',
headers={
'Authorization': 'Bearer PLpC1CqVE9CYXolbGNBPqz0NYy8asFzG95XcToDsMP'
}
)
const request = require("request");
const options = {
method: 'GET',
url: 'https://webhook-api.mypos.com/v1/subscriptions',
headers: {
'Authorization': 'Bearer PLpC1CqVE9CYXolbGNBPqz0NYy8asFzG95XcToDsMP'
}
};
request(options, (error, response, body) => {
});
<?php
$request = new HttpRequest();
$request->setUrl('https://webhook-api.mypos.com/v1/subscriptions');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Authorization' => 'Bearer PLpC1CqVE9CYXolbGNBPqz0NYy8asFzG95XcToDsMP'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
{
"subscriptions": [
{
"created_on": "Thu, 11 Apr 2019 07:09:05 GMT",
"event": "pos.payment.completed",
"filter": null,
"hook": {
"created_on": "Thu, 11 Apr 2019 07:07:58 GMT",
"id": "6217960c-2a2e-4188-9025-af11abf47d5e",
"is_active": true,
"payload_url": "https://google.com",
"secret": "Um6OcCJkN6tOXzUOOmcCyvOcKNFkuNpz"
},
"id": "7db45365-2478-480e-bf34-f6f315f0c0bd"
}
],
"pagination": {
"page": 1,
"size": 20,
"total": 1
}
}
More detailed information about a subscription can be requested by passing the subscription ID as an URL parameter
curl -X GET \
https://webhook-api.mypos.com/v1/subscriptions/7db45365-2478-480e-bf34-f6f315f0c0bd \
-H 'Authorization: Bearer PLpC1CqVE9CYXolbGNBPqz0NYy8asFzG95XcToDsMP'
import requests
requests.get(
url='https://webhook-api.mypos.com/v1/subscriptions/7db45365-2478-480e-bf34-f6f315f0c0bd',
headers={
'Authorization': 'Bearer PLpC1CqVE9CYXolbGNBPqz0NYy8asFzG95XcToDsMP'
}
)
const request = require("request");
const options = {
method: 'GET',
url: 'https://webhook-api.mypos.com/v1/subscriptions/7db45365-2478-480e-bf34-f6f315f0c0bd',
headers: {
'Authorization': 'Bearer PLpC1CqVE9CYXolbGNBPqz0NYy8asFzG95XcToDsMP'
}
};
request(options, (error, response, body) => {
});
<?php
$request = new HttpRequest();
$request->setUrl('https://webhook-api.mypos.com/v1/subscriptions/7db45365-2478-480e-bf34-f6f315f0c0bd');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Authorization' => 'Bearer PLpC1CqVE9CYXolbGNBPqz0NYy8asFzG95XcToDsMP'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
{
"subscription": {
"created_on": "Thu, 11 Apr 2019 07:09:05 GMT",
"event": "pos.payment.completed",
"filter": {
"tids": [
"90004889"
]
},
"hook": {
"created_on": "Thu, 11 Apr 2019 07:07:58 GMT",
"id": "6217960c-2a2e-4188-9025-af11abf47d5e",
"is_active": true,
"payload_url": "https://google.com",
"secret": "Um6OcCJkN6tOXzUOOmcCyvOcKNFkuNpz"
},
"id": "7db45365-2478-480e-bf34-f6f315f0c0bd"
}
}
Request sandbox event notification
Request an event notification to be triggered for the particular subscription for you to receive an example of the structure a real notification will have.
curl -X POST \
https://api.mypos.eu/v1/subscriptions/7db45365-2478-480e-bf34-f6f315f0c0bd/fake \
-H 'Authorization: Bearer PLpC1CqVE9CYXolbGNBPqz0NYy8asFzG95XcToDsMP'
import requests
requests.post(
url='https://webhook-api.mypos.com/v1/subscriptions/7db45365-2478-480e-bf34-f6f315f0c0bd/fake',
headers={
'Authorization': 'Bearer PLpC1CqVE9CYXolbGNBPqz0NYy8asFzG95XcToDsMP'
}
)
const request = require("request");
const options = {
method: 'POST',
url: 'https://webhook-api.mypos.com/v1/subscriptions/7db45365-2478-480e-bf34-f6f315f0c0bd/fake',
headers: {
'Authorization': 'Bearer PLpC1CqVE9CYXolbGNBPqz0NYy8asFzG95XcToDsMP'
}
};
request(options, (error, response, body) => {
});
<?php
$request = new HttpRequest();
$request->setUrl('https://webhook-api.mypos.com/v1/subscriptions/7db45365-2478-480e-bf34-f6f315f0c0bd/fake');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Authorization' => 'Bearer PLpC1CqVE9CYXolbGNBPqz0NYy8asFzG95XcToDsMP'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
{
"notification": {
"event": "pos.payment.completed",
"payload": {
"amount": 9.90,
"currency": "GBP",
"merchant_name": "myPOS Europe Ltd.",
"pan": "*5173",
"tid": 90004374,
"timestamp": 1554981196
},
"response_code": 200,
"retry_count": 0,
"sent_on": "Thu, 11 Apr 2019 11:12:23 GMT",
"url": "https://mywebsite.com/webhook-callback"
}
}