Rest Interface (Beta)


REST interface has been deprecated and doesn’t support advanced features like payment page bypass. We recommend using E2 form interface instead.

Paytrail REST interface can be used to create a payment with a server-to-server request and thus limits usage compared to the form interface. With the REST interface, the payment is created in advance by sending payment data as an XML or JSON message over HTTPS. Service returns the response message in the corresponding format.

We offer a PHP package for creating payments with the REST interface easily. You can import the package to your project with Composer like so:

composer require paytrail/rest-module

The package requires PHP 7.2 or newer. The detailed documentation is available on GitHub and Packagist.

If you encounter any problems using the package, please report them to us in GitHub. You can also participate in the package development by submitting us pull requests.


Even though REST interface is marked as beta, it is considered a stable product. Paytrail will not implement backwards incompatible or otherwise breaking changes to it without prior notice.

When using the form interface the payment data is sent from a customer’s browser to Paytrail service, but when using the REST interface customer’s server sends the payment data to Paytrail service in XML or JSON format. The response message is returned in the same format.

When using the REST interface, the data that is sent to the payment service must always be UTF-8 encoded.

Creating a Payment via the REST interface

When using the REST service, always include the following headers:


Sent message type. The message can be sent either in XML or JSON format. Corresponding types are application/xml and application/json.


Interface version. The current REST interface version is 1. Each request sent to the interface must be verified with Basic authentication (Authorization header). Basic authentication sends the Merchant ID as a username and the Merchant secret as a password.

Receiving a Payment Receipt

Payment receipt handling has been documented here.