Merx

Testing and production

By default Merx is in testing mode.

Merx has one switch for the whole shop. While production is false, every payment runs against the test environment of your payment provider and no money moves. Setting it to true is what turns the shop into a real one.

/site/config/config.php
<?php

return [
  'wagnerwagner.merx.production' => true,
];

What the switch changes

production swaps the test keys for the live ones. Nothing else moves — blueprints, pricing rules, tax rules, hooks and templates behave the same either way, so a shop that works in testing works in production.

One key is the exception. Merx picks the Stripe secret key itself, but the publishable key goes into your own checkout template, where Merx cannot switch it for you. The Stripe Elements guide reads it from the same option — if you hard-coded the test key instead, the live shop will keep talking to Stripe’s test mode.

Test before you switch

A test payment goes through the same gateway, the same hooks and the same order page as a real one. It’s worth running one per gateway you offer.

  • Stripe takes its test cards — 4242 4242 4242 4242 with any future expiry succeeds, and there are numbers for declines and for authentication prompts.
  • PayPal needs a sandbox account from the developer dashboard to pay with. See the PayPal guide.
  • Invoice involves no provider at all, so it behaves identically in both modes.

Check that the order page is written, the order number is what you expect, and your confirmation mail arrives.

Going live

production is the last thing you change, not the first. Before you flip it:

  1. Put the live keys on the server, in /site/config/env.php — the live Stripe secret and publishable key, the live PayPal client ID and secret. See Stripe/PayPal secrets.
  2. Set production to true on the server only, so your local install keeps using the test keys.
  3. Create the Stripe webhook again on the live side and replace stripe.webhook_signing_secret with the live one. There’s only one of those options, and a test secret rejects every live webhook. See Stripe webhooks.
  4. Set your license key.
  5. Make sure order pages are not reachable by search engines or listed anywhere. See Security.

Then buy something from your own shop with a real card, check that it arrives in the Stripe or PayPal dashboard, and refund it.

License

Merx is commercial software, and a shop in production needs a license. Set it with the license option and the Panel will show it under the plugin.

/site/config/env.php
<?php

return [
  'wagnerwagner.merx.license' => 'MERX2-XXXXXXX-XXXXXXX',
];

You can buy a license for each domain you run Merx on.