Pesapal.com
Pesapal Test Cards: How to Test Payments in the Pesapal Sandbox

Pesapal Test Cards: How to Test Payments in the Pesapal Sandbox

On 12 August 2026
M

Before you accept real customer payments via Pesapal, it is important to test your payment integration in the Pesapal Sandbox environment. To test payments in the Pesapal Sandbox, you need Test Cards.

The sandbox enables developers and merchants to practice the card payment process without having to charge a real credit or debit card. It's useful if you want someone to confirm the customer will be able to navigate to your Pesapal checkout page, make a payment, return to your website, and it will update the status of the order.

 

This tutorial details the test card to use, how to complete a test transaction, and what to check before moving your integration to live mode on Pesapal.

Pesapal Test Card Details

For testing a Visa card payment in the Pesapal Sandbox, use the following information:

  • Field : Test value
  • Payment method : Visa
  • Card number: 4111 1111 1111 1111 
  • CVV: 962
  • Expiry date: Any valid future month & year
  • Cardholder information: Use test information

 

Pesapal’s published sandbox guidance lists `4111111111111111` as the test Visa card number, `962` as the CVV, and any future date as the expiry date.

 

 Important Test Card Note

Always verify placeholders on the current Pesapal Sandbox Payment Form. A card's information may change in the Sandbox, and the information on the actual checkout page may override older documentation.

Don't just assume that because it is a commonly used test card number, it will be valid. It is also the number that is typically used for testing with Stripe, and older discussions of Stripe with Pesapal indicate it might raise a failure to authorize in the Pesapal environment.

 

What Is the Pesapal Sandbox?

The Pesapal Sandbox is a testing environment where you can test payments without transferring real money.

It enables you to test:

  • Signing with a sandbox credential.
  • Order submission
  • The payment page that is redirected is from Pesapal.
  • Visa card payments
  • Customer callback URLs
  • Instant Payment Notifications
  • Transaction status queries
  • They are pending, completed and failed order handling.

Pesapal suggests testing the integrations in the sandbox before switching to the live API. The current API is API 3.0, REST/JSON-based; API 2.0 is deprecated.

How to Set Up Pesapal Sandbox Testing

  1. Get Pesapal Test Credentials

Firstly, get sandbox credentials from the Pesapal developer platform.

You will need:

  • Consumer Key for a sandbox instance
  • Consumer secret for a sandbox
  • Pesapal's API 3.0 Sandbox Endpoints

Do not use your production consumer key and secret in the sandbox for testing purposes. Pesapal offers unique test credentials for connection to the demo environment.

Securely store credentials in environment variables or other protected configuration system. Avoid leaking the consumer secret in the public repository, browser source code or in the front-end JS.

  1. Create an Authentication Token

Pass your Sandbox consumer key and consumer secret to the Pesapal `RequestToken` endpoint.

From there, the access token generated by Pesapal is used as a bearer token for any protected API endpoints. Pesapal has separate token-generation endpoints for sandbox and production.

 

Verify your application can:

  • Create a valid token.
  • Store it securely
  • Detect if token has expired
  • When needed, ask for another token
  • Handle authentication errors, without revealing sensitive credentials

 

  1. Please register your IPN URL

Prior to ordering, register an Instant Payment Notification URL.

An IPN (Internet Payment Notification) URL is a place on your website or application where Pesapal will post when the status of a transaction is updated. Pesapal's API 3.0 includes a dedicated endpoint for registering IPNs.

The endpoint of your IPN should be accessible to the public. Normally, a URL that is set to 'localhost' or 'private dev network' cannot receive Pesapal notifications.

If developing locally, use a secure tunnelling service or deploy test endpoint to an accessible staging server.

  1. Submit a Test Order

Order the products in your application and submit them using the Pesapal `SubmitOrderRequest` endpoint.

The request normally contains information such as:

  • Your personalized merchant reference
  • Payment amount
  • Currency
  • Order description
  • Customer’s name
  • Customer’s email address
  • Customer’s phone number
  • Registered IPN ID
  • Callback URL

 

On acceptance by Pesapal, it will return an order tracking ID and a redirect URL. The customer should now be directed to that URL to select a payment method and complete the transaction.

Save the merchant reference and Pesapal order tracking ID in your database before redirecting the customer.

How to Make a Pesapal Test Card Payment

  1. Once your sandbox order has been created:
  2. Click on the redirect URL provided by Pesapal.
  3. 2) Pay by Visa.
  4. Fill in the information of the test customer.
  5. Once on the card payment screen, press the "CARD" button.
  6. Enter `4111111111111111` as the card number.
  7. Enter `962` as the CVV.
  8. Do enter a valid future expiry month and year.
  9. Submit the payment.
  10. Let Pesapal send you back to your callback URL.
  11. To check the status of a transaction, use the order tracking ID returned.

 

A sandbox transaction involves no actual money or card being involved.

 Testing the Callback URL

The callback URL is the page to which the customer will be redirected after completing or abandoning the payment process on Pesapal.

  • Your callback handler should:
  • Get the Pesapal tracking information.
  • Match the images to the sequence
  • Call in Pesapal to get the most up-to-date status of the transaction
  • Displays a suitable message to the customer
  • Don't mark an order as paid if it is only the redirect

A redirect means that a user is coming back to your site. It is not conclusive evidence that Pesapal successfully completed the payment.

When a customer closes their browser before returning, refreshes the callback page, or opens the page multiple times, the callback page is served again. If a customer closes their browser window before going back, refreshes the callback page, or opens it twice, a second copy of the callback page is served. Your payment logic must continue to work safely in all these situations.

Testing Pesapal IPN Notifications

IPN is an acronym that stands for Instant Payment Notification.

Pesapal sends an IPN request when the transaction status changes. This is particularly relevant for transactions that are initially pending and for customers who leave the checkout page without returning to your site.

Your IPN handler should:

  1. Get the order tracking ID and merchant reference.
  2. Associate a notification with an order.
  3. Check the status of the transaction using Pesapal.
  4. Only update the order after validating the response.
  5. Return the appropriate acknowledgment.
  6. Put the notification in your payment records.
  7. Deal with multiple alerts securely.

Not all IPN notifications are successful payments!

Always Query the Transaction Status

For security reasons, the final payment status is not included directly in the callback / IPN request provided by Pesapal. The order tracking ID must be specified in your application to be able to call the `GetTransactionStatus` endpoint.

 

Your integration should correctly handle the following statuses:

1. COMPLETED

The payment went through!

Prior to marking your internal order as "paid", confirm your order has been paid for by checking that:

The result sheets from Texas Instruments and Casio match.

The quantity is the same as the quantity ordered

The currency matches

The transaction hasn't been made before

The amount paid is for the expected customer/orders

2. PENDING

The Result of the transaction is still unknown, as Pesapal is still working on it.

Don't cancel or delete the order but keep it pending or awaiting payment. Do not deliver a product or issue a ticket/confirm a booking until payment is complete.

Your application might try again to update later or wait for another IPN notification.

3. FAILED

The payment could not be processed.

Do not pay the order, and if it is appropriate, give the customer the chance to try again.

Pesapal's integration guide lists the following transaction states as ones that merchants must deal with: `PENDING`, `COMPLETED` and `FAILED`.

 Pesapal Payment Scenarios You Should Test

A successful integration should have more than one successful card transaction.

COMPLETED - Process a Visa payment with the test card and see that the order transitions from pending to paid only in response to a verified `COMPLETED` response.

FAILED - Open Pesapal's payment page and close it without paying. Verify that the order is not paid in your system.

The customer comes back without paying for the item. Go back to the callback page if the transaction was not completed. Your system should check the status: pending or unsuccessful, not confirm payment.

Duplicate callback requests - Refresh the callback page a few times. There should be no duplicate orders, repeated confirmations, or duplicate payments.

Repeated IPN notifications - Repeat the action with the same IPN. Your handler should be idempotent: if you're called twice with the same notification, it must still end up in the same state as it was after the first.

Delayed payment confirmation - Test an ordered item without waiting for it to be added to the order. Verify that the IPN handler can update the order after the customer has already left your site.

Invalid card information - Enter an incorrect expiry date, card number or test information. Ensure your customer is given a clear error and that you still have an unpaid internal order.

Unavailable IPN endpoint - Temporarily return an error from your IPN endpoint and validate that your application does not incorrectly update your order and logs the failure.

The amount and reference don't match - Practice with an internal validation by returning an invalid status back with an unexpected amount, currency, or merchant reference? You should be alerted to the transaction for review rather than it being processed automatically.

 

Does Pesapal Provide Decline and Fraud Test Cards?

Pesapal’s publicly available documentation does not provide an equivalent extensive catalogue of scenario-specific card numbers.

No need to create Pesapal decline, fraud or 3D Secure test cards.

If it is application level testing, then the developer can expect responses like `PENDING`, `COMPLETED`, and `FAILED`. The mocked tests should be used in addition to real end-to-end tests in the Pesapal Sandbox, however.

 

Common Pesapal Sandbox Problems

Using live credentials with sandbox endpoints

Live credentials are configured to point to sandbox endpoints.

Sandbox and production credentials are separate. Make sure the API credentials and environment match.

Using the wrong test card

Use the checkout info on the Pesapal Sandbox form. The details of the Visa test that are published are:

  • Card number: `4111111111111111`
  • CVV: `962`
  • No Expiry Date: Any future date

When an order is placed via the callback, it is marked as paid.

Always query `GetTransactionStatus`. Call back is not payment.

Expects the IPN to include the payment status

 

You are notified about a change in the IPN. Your server is then required to request the actual status from Pesapal.

Using a private IPN URL

Your IPN endpoint needs to be accessible to Pesapal via the internet. Private network and localhost URLs are not accessible for public use.

Payments cannot be processed twice.

Callbacks and IPN notifications may be resent. To make the processing idempotent, use the merchant reference or order tracking ID.

Failing to save the tracking ID

Save order tracking ID from Pesapal once the order is successfully requested. It is necessary to check the status and to handle the transaction later.

Pesapal Sandbox Testing Checklist

Before going live, be sure to check that:

  • Sandbox credentials are stored securely.
  • Authentication tokens can be created and renewed.
  • The IPN URL is registered and publicly available.
  • Customers are not redirected until the order is saved.
  • Order tracking ID is saved in Pesapal.
  • The sandbox Visa card is used to make a test payment.
  • Callback URL is working.
  • Notifications are sent to the IPN endpoint.
  • Does verify transaction with Pesapal. Verifies the transaction status with Pesapal.
  • If the payments are not fulfilled, they will be considered pending payments.
  • Payment attempts that fail are not considered payments.
  • Completed payments are checked as valid before being fulfilled.
  • Duplicate callbacks will not duplicate orders.
  • No duplicate IPNs duplicate fulfilment.
  • Amount, currency and merchant reference checked.
  • The logging of payment requests and responses is secure.
  • Logs do not contain sensitive credentials or card details.

 

Moving From Pesapal Sandbox to Live Payments

After you have tested all of the payment flows, replace the sandbox credentials and API endpoints with production Pesapal credentials and endpoints.

  • Please check that live payments is indeed disabled prior to enabling it:
  • Don't have production knowledge included in your source code.
  • Ensure that the HTTPS protocol is on.
  • Enter the production IPN URL.
  • Update Call Back URL if applicable.
  • Eliminate test card prompts on the checkout facing customer.
  • Carry out a regulated live transaction.
  • Ensure that payment confirmation and order fulfillment are functional.
  • Continue to track errors in IPN delivery and transaction status.

 

A production-ready integration must be able to successfully log in to Pesapal, place orders, redirect the customer to the correct page, handle the callback, and successfully return a payment confirmation back to the client using the transaction-status endpoint, as well as receive the IPN notifications and check all payments via the transaction-status endpoint.

For testing the payment flow, use the Pesapal Sandbox Visa card number of `4111111111111111`, CVV number of `962,` and any future expiry date. First and foremost, don't confirm an order through the redirect only. Ask Pesapal to check the latest status, confirm the transaction details are correct, and ensure that all callbacks and IPN operations are safe to run more than once.

Accept Online Payments for your Business

Convenient, Safe , Secure

Get Started

Subscribe to our Blog