Test and go live

With BPE_MODE=test the wrapper sends every request to the Buckaroo test environment. No real money is moved, and you can simulate each outcome a payment method supports.


Use test mode

BPE_MODE=test

Set this explicitly. Without BPE_MODE, the wrapper uses live.

Test transactions are stored with is_test set to true, so you can tell them apart in the buckaroo_transactions table.


Receive push messages on your own machine

Buckaroo cannot reach localhost. To test push messages during development, expose your application with a tunnel and use the tunnel's HTTPS address as your application URL, or test on a staging server that is reachable from the internet.


Test data

Test card numbers, test accounts and the way to trigger a specific outcome are listed per payment method on the Test transactions page. Testing explains how the test environment works.


What to test

The successful payment proves the least. These scenarios find the bugs:

ScenarioWhat it proves
A failed paymentThe order is not marked as paid, and the customer sees a usable page
The customer cancelsThe order is released, even though no event is fired for a cancellation
The customer closes the browser before returningYour listener updates the order without the return page
The same push message twiceYour listener is idempotent and does not process the order twice
The customer returns before the push messageThe customer sees a "payment is being processed" page
A full and a partial refundThe refund is stored and linked to the payment
A reused invoice numberYour error handling shows the reason

The closed browser test is the important one. It is the only test that proves your integration does not depend on the customer coming back.


Fake Buckaroo in your own tests

In your automated tests, fake the events to check that your code reacts to them, without calling Buckaroo:

use Buckaroo\Laravel\Events\PayTransactionCompleted;
use Illuminate\Support\Facades\Event;

Event::fake([PayTransactionCompleted::class]);

// run the code that starts or completes a payment

Event::assertDispatched(PayTransactionCompleted::class);

To test a listener, create a BuckarooTransaction with the status you want and pass it to the listener in an event.


Go live

Before you switch to production:

  • The full flow works in test mode, including the return page, your event listeners and refunds
  • The push route is excluded from CSRF verification
  • Your application is reachable from the internet over HTTPS, and the push route returns HTTP 200
  • Buckaroo's push IP addresses and ports are on your allow list. See Push messages
  • The payment methods you need are active for your store in Plaza
  • The migration has run on production
  • The production .env has the right keys and BPE_MODE=live

If you cache your configuration, run php artisan config:cache again after you change .env.

Place one real payment for a small amount, check that it appears in Plaza and that your order is updated, then refund it.



Did this page help you?