Testing the Mollie API¶
During the process of building your integration, it is important to properly test it. As briefly explained in our
authentication guide, you can access the test mode of the Mollie API in two ways: by
using the Test API key, or, if you are using organization access tokens or app tokens, by providing the
parameter in your API request.
Any payments or other resources you create in test mode are completely isolated from your live mode data. Going back and
forth between test and live mode is as easy as switching out the API key - or toggling the
testmode parameter in
case of the other authentication methods.
Test mode checkout screen¶
When creating payments or orders in test mode, the regular checkout hosted payment pages will be replaced by a test mode
checkout screen. Most test mode payment resources will feature a
checkout URL just like in live mode, which then
allows you to walk through the payment process without spending actual money. You can try out different payment statuses
and see whether your integration handles it correctly.
For test mode recurring payments, the resource will not contain a
checkout URL, because
these payments are executed without any interaction of your customer. Instead, a
changePaymentState URL is added,
which allows you to set the final payment state for these payments.
For paid test mode payments the resource will also include the
changePaymentState URL which allows you to
create a refund or chargeback for that payment directly from our hosted payment page. This
can be used to test refund and chargeback functionality.
Apart from the hosted payment pages and the fact that test mode payments are created instead of real ones, the Mollie API behaves identical in both environments. This includes calling your webhook.
Testing card payments¶
Credit card payments can fail for various reasons ranging from having provided an invalid card number to having the card
issuer reject the payment due to insufficient funds. In the case of a failed credit card payment, the API therefore
failureReason in the payment response to provide more
To test the various failure reasons the Mollie API can return, you can create your test mode card payment with a
specific amount according to the table below. If you then force the payment to the
failed status in the test flow,
the payment response will include the appropriate failure reason.
|Failure reason to trigger||Magic amount|
Testing different types of cards¶
When using our hosted checkout solution to test card payments, you don’t have to fill out any card details to test different statuses. This does mean however that you cannot test different types of cards with our hosted checkout.
For embedded checkout solutions — i.e. when using Mollie Components — you can use the test card numbers below to test different card brands.
|Brand||Card number||Expiry date||CVV|
Note: The card brand above allows you to test the dynamic display of the card logo in the card number field. For the time being, when processed the test payment will default to Mastercard always.