# Veracity Pay – Nets Easy flavour

Base URL `https://pay.veracity.se/nets/v1` (instead of https://test.api.dibspayment.eu/v1). Auth: `Authorization: $NETS_EASY_SECRET_KEY` (no "Bearer", like Nets). Only `integrationType: "HostedPaymentPage"`.

```
NETS_EASY_BASE_URL=https://pay.veracity.se/nets
NETS_EASY_SECRET_KEY=vp_sk_test_…
```

1. `POST /v1/payments` with `order.items[]` (grossTotalAmount, taxRate 2500 = 25%, taxAmount), `order.amount` (the sum), `checkout.returnUrl`, `cancelUrl`, `termsUrl`, `charge`, `notifications.webHooks[]` → `{ paymentId, hostedPaymentPageUrl }`. Redirect the customer to hostedPaymentPageUrl.
2. The customer returns to `returnUrl?paymentid=…`. Read `GET /v1/payments/{paymentId}`: `payment.summary.reservedAmount`, `paymentDetails`.
3. `POST /v1/payments/{id}/charges` { amount } → chargeId; refunds via `POST /v1/charges/{chargeId}/refunds`; cancel via `POST /v1/payments/{id}/cancels`.
4. Webhooks go to the URLs in `notifications.webHooks` with your `authorization` value in the Authorization header: payment.created, payment.reservation.created.v2, payment.checkout.completed, payment.reservation.failed, payment.charge.created.v2, payment.refund.completed, payment.cancel.created.

### Test outcomes

- Hosted checkout: a "Test mode" panel picks approve, decline (with a reason), 3-D Secure, pending, timeout or provider error.
- Magic cards: `4242424242424242` Visa – succeeds; `5555555555554444` Mastercard – succeeds; `4000000000000002` Declined: card declined; `4000000000009995` Declined: insufficient funds; `4000000000000069` Declined: expired card; `4100000000000019` Declined: suspected fraud; `4000000000003220` Requires 3-D Secure authentication; `4000000000000150` Pending, succeeds after 5 s; `4000000000000168` Pending, fails after 5 s; `4000000000000119` Provider error (500); `4000000000000184` Timeout – the session expires; `4000000000000341` Succeeds, but renewals fail.
- Magic amounts (total ends in these öre/cents, at least 1.00): `.01` Declined: card declined; `.02` Declined: insufficient funds; `.03` Declined: expired card; `.04` Declined: suspected fraud; `.05` Declined: credit check failed (invoice); `.06` Requires an extra authentication step; `.07` Pending, succeeds after 5 s; `.08` Pending, fails after 5 s; `.09` Timeout – the session expires.
- `metadata[veracity_test_outcome]` on a Checkout Session or PaymentIntent: `approve`, `decline_card_declined`, `decline_insufficient_funds`, `decline_expired_card`, `decline_fraudulent`, `decline_credit_rejected`, `challenge`, `pending_succeed`, `pending_fail`, `timeout`, `provider_error` (`metadata[veracity_test_delay]` seconds for pending/timeout).
- Without a browser: `POST /v1/test_helpers/checkout/sessions/{id}/complete` with `outcome` (MCP tool `complete_checkout`).
- Next renewal of a subscription: `POST /v1/test_helpers/subscriptions/{id}/next_charge_outcome` with `outcome` = approve | insufficient_funds | restricted_card | timeout (MCP tool `set_next_charge_outcome`).
- Time: `POST /v1/test_helpers/advance_clock` with `months` / `days` (MCP tool `advance_clock`); renewals are charged without a code and send invoice.paid or invoice.payment_failed.