To start using the paysafecard API you must meet the following requirements:
- Have an active Mollie partner ID: After you log in, you wil be able to see it on the Account page.
- Have an active payment profile.
- Have enabled the paysafecard service in your account. The requirements can be found on the Diensten page.
(Please note that the Diensten/Services page is currently only available in Dutch)
Examples & Modules
Download our ready-to-use example script here:
How does the paysafecard API work?
To create a paysafecard payment you need to go follow these steps:
- Request a new payment from us, with your
amountin cents you want to receive from your customer. We return the payment details including the unique
URLof the prepared payment. Please store this data in your own database.
- Checking the status of the payment. The API gives you a report in the background at the specified
reporturlwhen the payment status changes. With this information, you can check the new status of your payment.
- The customer returns on the returnurl. The customer is sent to the
returnurlafter the payment is complete, so he or she can continue the payment process in your website. Here, if you wish, you can show your customer what the latest payment status is. There is an overview of possible statuses later in this document.
Our API works with HTTP requests. Simply send us HTTP requests with the parameters as GET variables.
Step 1: Request a new payment with the paysafecard API
To prepare a new paysafecard payment you need to specify some parameters. In the table below you can find the parameters you need to create a new paysafecard payment. All parameters are required.
Example prepare request:
https://secure.mollie.nl/xml/paysafecard/prepare/?partnerid=[your partner id]&amount=123&profile_key=1a2b3c4d
You can find the table with the request parameter explanations below:
||Your Mollie Partner ID. You can find this on the account details page. The payment is linked to your account using your partner ID.|
||Mollie Profile Key. You can find the profile_key of your profile on the Profielen page. You can also create a new profile on that page.|
||Amount of the payment. GIVEN IN CENTS! So, if you want to receive EUR 10.00, please request like this:
||This is the URL payment notification reports will be sent to. These happen in the background and will be sent once the payment status changes. These don't provide information about the payment, like the paid status. You will have to ask for the updated status using the check-status API, as shown in Step 2. This is a security feature, so nobody else can call your reporturl with fake payment information. The payment noticication report will include the transaction_id of the payment, so you will be able to match it to a created payment.|
||This URL is where your customers will be sent to after the payment (whether successful or not) has been completed. It is possible your customer will reach this page before you get the actual payment status. You can show the most current payment status on this page. We provide the transaction_id as GET variable so you can will be able to match the customer to a payment.|
||This parameter is a unique customer reference that you keep for the customer, for example by generating it with your customer's account ID or IP address. (You're not allowed to use capitals or spaces with this parameter)|
This is an example of how the answer would look like:
The XML answer explained:
||This is the alphanumeric combination that corresponds to the payment you prepared. It is advised to save this ID with the payment in your database, so you can look for it in a report, or when your customer visits the returnurl.|
||The amount like you requested it, just as a check|
||This is the URL where you should redirect your customer to, so they can actually complete the prepared payment at paysafecard.|
Step 2: Checking the status of the payment
When you were preparing the payment, you also sent us the
reporturl. At this URL you will need a script thats checks the payment status with us. This check gives you the current state of the payment. It is advised to save any status updates in your database.
- Notice: When the callback to the reporturl fails (like when the connection fails or the HTTP status is not 200), Mollie will request 10 times with different time intervals to the reporturl again. If it won't succeed you get an error notice in your error log at your Dashboard.
Example check-status request:
https://secure.mollie.nl/xml/paysafecard/check-status/?partnerid=[your partner id]&transaction_id=[transaction_id]
The parameters are explained below:
||Your Mollie Partner ID. You can find this on the account details page. To this account we assign the payment.|
||This is the alphanumeric combination that corresponds to the payment you prepared. With it, you can request a status update about a particular payment.|
This is an example the answer would look like:
For security reasons, once you receive a final status, you cannot check the status again. If you try to check for a second time, you will get a custom error code. The final statuses are 'Success', 'Cancelled' and 'Expired'.
The check-status parameters are explained below:
||This is the alphanumeric combination that corresponds to the payment you prepared. It is advised to store this ID in your database, so you can use for it in a report, or to match a customer sent to the returnurl.|
||The amount like you requested it, just as a check.|
||'true' or 'false'. Gives your the paid status. Notice, you can only check the final status once. If you check a second time, you will get 'false'. This is to protect against fraud for your customers.|
Gives you the exact status we get from paysafecard, if available. Possible statuses are:
Step 3: The customer returns on the returnurl
After the payment has been completed, the customer will be sent to the
returnurl, provided when the payment was first made (step 1). A GET variable
transaction_id, will have been added to this URL. This will allow you to match the customer to the payment. If you've already got the final state, you can show it here to your customer.
In rare situations, it may be possible your customer will reach the returnurl before we called the reporturl. This can happen when there is a failure with paysafecard that may delay us recieving the the final state of the payment.
In these situations, it's important to know that we only report you when we got the final state. So, it's possible your customer will reach the returnurl when the payment in still pending in your system.
Overview error codes
All the possible error codes that are returned by the API are listed below:
|-1||We've failed to create the payment due an unknown error|
|-2||Missing parameter: [missing parameters will be here]|
|-3||This account doesn't exist or is suspended|
|-5||Amount is too low. Minimal amount is [the minimal amount will be here]|
|-6||Amount is too high. Maximum amount is [the maximum amount will be here]|
|-7||There is a problem with the 'reporturl' you have provided: [your request url will be here]|
|-8||There is a problem with the 'returnurl' you have provided: [your request url will be here]|
|-11||Payments are disabled for this customer|