Skip to content

Add a pin terminal

In this tutorial we describe how to add a pin terminal to our point of sale (POS).

It helps to understand how our App Store works. If you’re new to it, read the App Store documentation or follow our tutorial for Laravel or Vue.js.

Go to the App Store and create an app. It needs to meet these requirements:

  1. The app has a webhook with the payment.request event.
  2. The app category is payment_provider.
  3. The app has a logo and a description.
  4. The app has all the scopes for the devices API.

Use the devices API to set up a new pin terminal device. You’ll find it here: devices API

Add a new device with the following required parameters:

{
name: 'Terminal Reception',
type: 'pin_terminal'
}

Once you’ve added a device with the type pin_terminal, it also appears in the terminal list in the POS application.

Pin terminal listing

Next, add some meta keys, such as payment_endpoint or cancellation_request. You do this with device meta.

{
key: "payment_endpoint",
value: "https://your-app-url.com/payment-request"
}
{
key: "payment_timeout", // (Optional)
value: 120
}
{
key: "cancellation_request", // (Optional)
value: "https://your-app-url.com/cancellation-request"
}

We use a standard payment flow. When a payment is started from our software, we create a new payment with the status pending.

When the user starts the payment, we send the following request to the payment_endpoint you defined for your device:

{
id: 123456,
payment_uid: "pay_dfngjdnfg........."
}

Use the get payment endpoint to retrieve all the payment data, such as the currency and amount.

1. Update the payment status

Update the payment status to locked or open. When a payment is open, the user can delete it manually. When it’s locked, the user can’t delete it.

2. Return success

When the payment succeeds, return the following JSON message:

{
result: "success"
}

When something goes wrong, return the following JSON message and describe the error:

{
error:
{
message: "Clarify what is going wrong in an error message.",
code: 123 // (Optional) status code
}
}

The default timeout is 120 seconds. You can change it with the payment_timeout meta key on your device. The maximum timeout is 300 seconds.

If, for whatever reason, the payment is still pending after 300 seconds, we delete it automatically. The pending status changes to deleted.

This request is optional. If you don’t support cancellation, leave the cancellation_request endpoint in the device meta empty.

{
id: 123456,
payment_uid: "pay_dfngjdnfg........."
}

When the cancellation succeeds, return the following JSON message:

{
result: "success"
}

When something goes wrong, return the following JSON message and describe the error:

{
error:
{
message: "Clarify what is going wrong in an error message.",
code: 123 // (Optional) status code
}
}