> ## Documentation Index
> Fetch the complete documentation index at: https://docs.prava.space/llms.txt
> Use this file to discover all available pages before exploring further.

# Test your integration

> Verify your receiver, test event delivery, and check retries and secret rotation in sandbox.

Use sandbox to test your receiver before you activate production delivery. You can use your existing backend or the [optional receiver examples](https://docs.prava.space/webhooks/receiver-examples.md).

> [!TIP]
>
> A temporary HTTPS tunnel can forward requests to a local receiver. Keep the tunnel running, and update the endpoint if its public URL changes.

## What each test proves

| Test | How | Proves |
| - | - | - |
| Verification | **Verify destination** | Your receiver checks the signature and echoes the challenge. |
| Direct test event | **Send test event** in the dashboard | Connectivity and signature handling. Sent straight to your receiver. |
| Queued test event | API test with `queued: true` on an active endpoint | Queued delivery, including automatic retries and replay. |
| Secret rotation | Queued tests during the 24-hour overlap | Both the old and new secrets are accepted. |
| Lifecycle events | Real sandbox payment, card-enrollment or mandate-setup flows | The events your integration actually receives. |

None of the synthetic tests prove that a payment or enrollment happened.

## Verify and send a test event

1. Create a sandbox endpoint in **Webhooks**, select the event types you need, and save its one-time signing secret.
2. Configure your receiver with that secret and the expected application and environment.
3. Click **Verify destination**. Your receiver must validate the signature and return the exact challenge in a small JSON response with a `2xx` status.
4. Select a subscribed event type and click **Send test event**. Confirm your receiver accepts it.

Synthetic events have `test: true`. Accept them to validate delivery, but don't charge, enroll a card or perform other business side effects for them.

## Test automatic retries and replay

The dashboard's **Send test event** goes directly to your receiver. To exercise queued delivery and its automatic retries, activate the verified endpoint and call `POST /v1/webhook-endpoints/{endpointId}/test` with the application's sandbox secret API key:

```json theme={null}
{
  "type": "payment.credentials_ready",
  "queued": true
}
```

The selected type must be subscribed. See the [Webhook API](https://docs.prava.space/webhooks/api.md) for authentication and request details.

1. On a controlled test receiver, reject the first synthetic delivery with `503`.
2. Accept its retry with `204`.
3. Check **Delivery history** for both attempts.
4. Open the accepted queued delivery and select **Replay retained event**. The replay should be accepted, but it shouldn't create a second inbox record or repeat business side effects. Its delivery ID changes; its event ID and original body stay the same.

The optional Node example supports the reject-then-accept behavior in sandbox only, with `reject_attempts: 1` in its configuration. Set it back to `0` after testing.

## Test secret rotation

1. Save the current signing secret, rotate once, and save the replacement.
2. During the 24-hour overlap, configure your controlled receiver with **only the old secret** and send a queued test. It should be accepted.
3. Repeat with **only the replacement secret**. It should also be accepted.
4. Leave the receiver configured with the replacement secret.

Use queued tests for this check, because direct test requests use the current secret. Another rotation is blocked until the overlap ends. After the overlap expires, a receiver with only the old secret should reject new deliveries; restore the replacement secret so retries can succeed.

## Test actual lifecycle events

Run the supported sandbox payment, full card-enrollment or mandate-setup flow with the same application. Then compare the persisted API result with the [expected event](https://docs.prava.space/webhooks/events.md), delivery history and your receiver inbox.

* Check the event's application, environment, resource ID and version.
* Actual lifecycle events aren't marked `test: true`.
* Test completion, failure, cancellation and expiry as separate cases.
* Check that removing a subscription stops new automatic deliveries for that event type.
* Creating a session alone doesn't necessarily produce an event.
* Explicit sandbox payment-success simulation produces the payment events described below.

### Test payment simulation

Use the existing request option on a sandbox checkout or supported quote-backed
mandate charge:

```json theme={null}
{"sandbox_simulation":{"stage":"payment","outcome":"success"}}
```

1. Subscribe the verified receiver to `payment.credentials_ready` and `payment.succeeded`.
2. Complete the supported payment flow. For checkout recovery, start with a stale
   saved card, retry with a new card, and complete verification.
3. Check `payment.credentials_ready`: it uses `outcome_source: "prava_issued"`
   and includes the actual attempt's `data.card_id` when an owned card is bound.
4. Check `payment.succeeded`: it uses `outcome_source: "sandbox_simulated"` and
   `environment: "sandbox"`. It does not establish a merchant charge.
5. Match receiver events with delivery history using the event ID. Group payment
   attempts by `resource.id`, with `session_id`, `order_id` or `mandate_id` for correlation.

These are lifecycle events from the test flow, so they are not marked `test: true`.
The endpoint's **Send test** action creates synthetic catalog events instead; it
checks delivery without exercising checkout or simulation capture. Before testing,
refresh pinned event schemas or enum validators for `sandbox_simulated` under
schema version `2026-10-08`. Earlier missing events are not reconstructed; start
a fresh flow after the update is deployed.

## Test card lifecycle events

1. Explicitly subscribe your verified sandbox endpoint to `card.saved` and `card.deleted`, preserving its other selected events.
2. Save a new card during checkout, standalone enrollment or a supported API flow. Check that `card.saved` identifies the new card and your original `user_id`, with an owned session when one already exists. Also test a save before its session exists: `session_id` is null and `user_id` still identifies your user.
3. Reuse the card for another payment. This should not create another `card.saved` event.
4. Delete it using the [Delete Card API](https://docs.prava.space/api-reference/delete-card.md), supplying your original external user identifier and the Card ID. Check `card.deleted` for the same card with `resource.version: 2`.
5. Replay a retained event to verify event-ID deduplication. Your receiver must also ignore a late version `1` save after processing version `2` deletion.

These events describe stored-card state, independently of payment or full-enrollment results. Synthetic **Send test** events have `test: true` and do not save or delete a card. Historical card saves are not reconstructed.

## Test mandate charge card identity

1. Create a mandate using a known saved card, then issue a fresh regular or quote-backed charge.
2. Check that its payment events share the charge transaction ID and identify the authorized card in `data.card_id`.
3. Retry the same charge with the same idempotency anchor. It should retain the same transaction. Replaying a captured event preserves its original Card ID.

Missing or ambiguous legacy setup links can still produce `card_id: null`. This update does not rewrite charge transactions or backfill earlier retained events.

## Advanced: automated sandbox receiver

> [accordion] Optional test-runner controls
>
> Skip this section for a normal integration. The Node example includes an opt-in control endpoint for a dedicated sandbox receiver driven by an automated test runner.
>
> | Setting | Value |
> | - | - |
> | `WEBHOOK_E2E_CONTROL_KEY` | An independent secret of 32–128 base64url characters |
> | `WEBHOOK_E2E_ACCOUNT_ID` | The dedicated sandbox application's ID |
>
> Setting both enables authenticated `/e2e/config` configuration and restricts receipt to that application's synthetic events and signed verification challenges. In this mode the receiver can't validate actual lifecycle events.
>
> * Keep the control key separate from application API keys and webhook signing secrets.
> * Keep proxy request bodies and authorization headers out of logs, and use private durable storage.
> * The test runner can configure temporary signing secrets, exercise test events and retries, then delete its test endpoint and clear the receiver configuration.
> * Leave these options unset on ordinary customer receivers.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.