Skip to content

Testing (sandbox) ​

Until SIMPLEPAY_PRODUCTION is true, the SDK calls the SimplePay sandbox (https://sandbox.simplepay.hu/payment/v2). The sandbox has its own merchant account and keys.

Test cards ​

Source: SimplePay – test card numbers. Every card uses expiry 12/28 and CVC 123; any cardholder name works.

Card numberTypeResult
4908 3660 9990 0425VisaSuccessful payment
5587 4020 0001 2011MastercardSuccessful payment
4111 1111 1111 1111VisaFailed payment
4000 0010 0000 0042Visa3DS challenge
6101 3242 9669 0851SZÉPSuccessful SZÉP card payment
6101 3242 1723 7212SZÉPFailed SZÉP card payment
5437 5884 9903 4193MastercardCard registration succeeds, payment fails
6757 6192 9705 7001MaestroCard registration fails, payment succeeds

The 3DS card shows a simulated challenge page: code 000 succeeds, anything else fails. No real SMS or push notification is sent.

Check the source

SimplePay can change the test cards at any time. If one stops working, check the official page.

What to try ​

  • [ ] Successful payment → SUCCESS on the back URL, FINISHED IPN, order paid
  • [ ] Failed payment → FAIL, the customer sees the transaction ID
  • [ ] Cancel on the payment page → CANCEL
  • [ ] 3DS card with 000 and with a wrong code
  • [ ] SZÉP card (if you use it)
  • [ ] Same IPN twice → the order is fulfilled once
  • [ ] IPN with a bad Signature header → 400, order unchanged
  • [ ] Recurring: registration, token charge, card removal

IPN locally ​

The sandbox only sends IPNs to a public address. For local development use a tunnel (cloudflared, ngrok or similar) and set the resulting https address as the IPN URL in the sandbox merchant admin.

Unit tests ​

The SDK uses the global fetch, so replace that in tests. The SDK's own tests do the same (Vitest):

ts
import { vi, it, expect } from 'vitest'
import { startPayment, generateSignature } from 'simplepay-js-sdk'

it('starts a payment', async () => {
  process.env.SIMPLEPAY_MERCHANT_ID_HUF = 'testId'
  process.env.SIMPLEPAY_MERCHANT_KEY_HUF = 'testKey'

  const body = JSON.stringify({ transactionId: '123', paymentUrl: 'https://sandbox.simplepay.hu/pay/x' })
  global.fetch = vi.fn().mockResolvedValue({
    ok: true,
    headers: { get: () => generateSignature(body, 'testKey') }, // validly signed response
    text: async () => body,
  }) as unknown as typeof fetch

  const response = await startPayment({ orderRef: 'T1', total: 100, customerEmail: '[email protected]' })
  expect(response.paymentUrl).toContain('sandbox')
})

To test an IPN endpoint, put generateSignature(ipnBody, key) in the Signature header.

Unofficial community SDK. Not affiliated with or endorsed by SimplePay Zrt. MIT License.