Learn how to properly test your ZenPay integration before deploying to production.
ZenPay provides a dedicated test environment that mirrors our production system. This allows you to test your integration thoroughly without processing real payments or affecting your live data.
pk_test_xxxxx - Test publishable key
sk_test_xxxxx - Test secret key
pk_live_xxxxx - Live publishable key
sk_live_xxxxx - Live secret keyAPI keys are prefixed to indicate their environment
Use these test cards to simulate various payment scenarios without processing real transactions.
Note: For testing international payments, use test card numbers with postal codes from different countries. Each test card can be used with any valid expiration date in the future and any random CVC number.
| Card Number | Brand | CVC | Date | Result |
|---|---|---|---|---|
4242 4242 4242 4242 | Visa | Any 3 digits | Any future date | Success |
4000 0025 0000 3155 | Visa | Any 3 digits | Any future date | Requires Authentication |
4000 0000 0000 9995 | Visa | Any 3 digits | Any future date | Insufficient Funds |
4000 0000 0000 0002 | Visa | Any 3 digits | Any future date | Card Declined |
5555 5555 5555 4444 | Mastercard | Any 3 digits | Any future date | Success |
3782 8224 6310 005 | American Express | Any 4 digits | Any future date | Success |
To properly test your webhook integration, you need to follow these steps:
Create an endpoint on your server to receive webhook events. For local development, you can use tools like ngrok or localtunnel to expose your local server to the internet.
# Example: Exposing a local server on port 3000
ngrok http 3000Go to the Developers → Webhooks section in your ZenPay Dashboard and add your webhook URL. Make sure to select the events you want to receive.
You can trigger test webhook events in several ways:
Always verify that the webhooks you receive are sent by ZenPay by checking the signature:
// Node.js example
const event = zenpay.webhooks.constructEvent(
payload,
signature,
webhookSecret
);
// If the signature is invalid, constructEvent will throw an errorUse our checkout testing tools to simulate the full payment flow from the customer's perspective, including form validation, error handling, and success states.
Don't just test the happy path. Use our test cards to trigger various error scenarios and ensure your application handles them gracefully, providing appropriate feedback to users.
Confirm that the entire payment flow works as expected, from collecting payment information to fulfilling orders or granting access to content after successful payments.
Implement automated tests for your ZenPay integration to catch regressions early. Our API is designed to be testable, with predictable responses for test cards and scenarios.
Once you've thoroughly tested your integration, follow these steps to go live:
Ensure all required business information is provided and verified in your ZenPay account.
Replace your test API keys with live keys. Make sure to update all instances, including your webhook endpoints.
Make a small real payment to verify that your production setup works correctly. You can refund this payment immediately after verification.
Set up monitoring and alerting for payment failures, webhook delivery issues, and other critical events to quickly identify and resolve any problems.