Test environment
dpay.pl provides a test mode that allows you to test your integration without charging real accounts. Test transactions are visible in the admin panel but do not generate actual money flows.
Enabling test mode
- Log in to panel.dpay.pl.
- Go to Payment Points > Services.
- Select the service you want to test.
- Enable the Test mode toggle.
Test mode is available immediately after creating a service - you do not need to wait for account verification to start integrating.
What happens in test mode?
- No real charges - no money is debited from customer accounts
- Transactions visible in the panel - all test transactions appear in the transaction history with a test label
- IPN works normally - IPN notifications are sent to your endpoint just as in production mode
- Full API - all endpoints work identically to production
Testing IPN locally
During development, your server typically runs on localhost, which is not accessible from the internet. To allow dpay.pl to send IPN notifications to your local server, use a tunneling tool.
ngrok
ngrok creates an HTTPS tunnel to your local server:
# Start a tunnel (assuming your server runs on port 3000)
ngrok http 3000
ngrok will generate a public address, e.g. https://abc123.ngrok-free.app. Use it as the url_ipn:
{
"url_ipn": "https://abc123.ngrok-free.app/api/ipn"
}
Alternatives
- Cloudflare Tunnel - a free tunnel from Cloudflare
- localtunnel - a simple open-source tool (
npx localtunnel --port 3000)
Keep in mind that the tunnel address changes after each restart (in the free version of ngrok). Update the url_ipn in your test requests accordingly.
Testing scenarios
Successful payment
- Register a transaction via the API with valid data.
- The customer is redirected to the payment gateway.
- After approving the payment - the IPN is sent to your endpoint with the
paidstatus. - The customer is redirected to
url_success.
Canceled payment
- Register a transaction via the API.
- On the gateway, the customer selects the cancel option.
- The customer is redirected to
url_fail.
IPN unavailable (retry)
- Temporarily disable your IPN endpoint (e.g. stop the server).
- Register and complete a test transaction.
- dpay.pl will retry IPN delivery (up to 10 attempts with exponential backoff).
- Restart the server - the IPN will be delivered on the next attempt.
- Check the IPN delivery history for the transaction in the panel.
Testing refunds
- Complete a successful test transaction.
- Call the refund endpoint with the
transaction_idof the paid transaction. - Check the API response and the transaction status in the panel.
Verifying API responses
In test mode, API responses have the same format as in production. Make sure your application correctly handles:
| Scenario | What to verify |
|---|---|
| Successful registration | error: false field, presence of transactionId and URL in msg |
| Checksum error | 400 response with Invalid checksum message |
| IPN | signature verification, idempotency, 200 OK response |
| Refund | success status in the response, refunded_amount update |
Checklist before going to production
Before disabling test mode, make sure that:
- Checksum - generated correctly for all request types (registration, refund)
- IPN - endpoint works, verifies the signature (
signature), responds with200 OK - Idempotency - IPN processed only once per transaction
- Amount verification - the amount from the IPN is compared with the order amount in the database
- Error handling - the application correctly handles API errors (400, 401, 500)
- HTTPS - all URLs (
url_success,url_fail,url_ipn) use HTTPS - Secret Hash - stored securely in environment variables, not in code
- Refunds - if you use refunds, both full and partial refunds have been tested
- Logging - incoming IPNs and API responses are logged for diagnostic purposes
Once all points are met, disable test mode in the panel - your service is ready for production.