● SANDBOX · TEST MODE

Form 3 · Smart address

The full form, minus the lines the buyer's country has no answer for. Street and postal code stay everywhere; the state line appears only where it is part of an address.

One option: fields: { billingDetails: { address: 'if_required' } }. Try it: pick United States and the state line is there; switch to United Kingdom and it is gone, together with whatever was typed in it. Fewer fields is measurably better conversion, and this costs no AVS input.

1 · Your test keys

The secret key is POSTed only to /api/demo/intent, never to the SDK. Allowed domains on the pk must include this host.

2 · Pay

Test card (NMI sandbox). 4111 1111 1111 1111 · any future expiry · CVV 123. NMI answers a repeat of the same card and amount within a minute with Duplicate transaction; wait a minute between tries. Change the country and watch the address block reshape.

After a successful payment the green box shows charge.billing_details from the receipt. For a country without states, state is simply absent.

3 · The integration

// 1. Your server, with the secret key: // POST /v1/payment_intents -> { client_secret } // 2. This page, with the publishable key: const wp = WorthyPayments('pk_test_…'); wp.mountPaymentElement('#payment', { clientSecret, fields: { billingDetails: { address: 'if_required' } }, // per-country address onSuccess: (r) => { /* r.paymentIntentId, r.transactionId, r.charge */ }, onError: (e) => { /* e.code === 'card_declined' on a decline */ }, });

4 · Log

Waiting for a key.