Examples and tools

Code libraries

These are example implementations of the communication with the Trustly API using PHP, Python and Java. It implements the standard Payments API as well as gives stubs for executing calls against the API used by the backoffice.

The documentation within this code will only cover the code itself, not how you should use Trustly API or the software flows and call patterns.

This code is provided as-is, use it as inspiration, reference or drop it directly into your own project and use it.

If you find any problem in the code or want to extend it feel free to fork it and send us a pull request.

PHP example: https://github.com/trustly/trustly-client-php.

Python example: https://github.com/trustly/trustly-client-python.

Java example: https://github.com/trustly/trustly-client-java.

.NET example: https://www.nuget.org/packages/trustly-api-client/ or https://github.com/trustly/trustly-client-net/

(Note: the .NET code example is under development, so it might not work properly with all API methods).

Tools

This page can be used to verify serialisation and to test signature. You can download the private key used here to test on your system to verify that your signing is done correctly.

This page can be helpful during the integration process, and here you can view the notifications that Trustly has sent in the test environment for a particular order by entering your processing account username (username used in the API calls) and an OrderID. If a notification has not been delivered successfully, you will see the error message for the failed notification here as well.

You will also find a cURL command here for every notification, so that you can send the notification yourself. You will also be able to submit notification responses on this page, but to do this you will have to send an additional attribute ("HoldNotifications" : "1") in the Deposit/Withdraw call for which you want to submit the notification responses. This will be helpful if your development server is not reachable from the internet.

📘

The notification test page will only be available for orders created in the test environment.