# Register a Dry-Run Provider Event

Dry-run is a pre-production validation surface. It receives the API calls your integration sends to a payment provider (request, response, and webhook payloads). It correlates them with the equivalent WHITELABEL public-API call you make **in parallel** with the `X-Dry-Run: true` header set.

WHITELABEL then executes an automated validation pipeline that grades the quality of the public-API request against the provider payload: missing fields, shape mismatches, wrong enum values, unmapped metadata, and any other inconsistency that would cause the real payment to fail or behave differently once you go live.

### How the pair works

1. Your integration makes its normal call to the provider (for example Stripe, Adyen, dlocal).
2. Your integration also calls the relevant WHITELABEL public-API endpoint (for example `POST /v1/payments`) with the header **`X-Dry-Run: true`**. WHITELABEL accepts the request, does not route it to any provider, and stores it for comparison.
3. Your integration calls `POST /v1/dry-run/provider-events` with the raw provider exchange (request, response, webhook) it just performed, correlated to the same `merchant_reference`.
4. WHITELABEL pairs the two records by `merchant_reference` + `account_id` and runs the validation pipeline. Results are available through the dashboard and via `GET /v1/dry-run/provider-events/{id}` (read API, separate reference).

The outcome tells you whether the public-API request you are building today would produce the same provider behavior once WHITELABEL starts routing it, without touching production money or sending a live transaction to the provider through WHITELABEL.

### When to use it

- **Pre-launch**: certify your public-API integration against the provider behavior you already have working.
- **Provider migrations**: verify a new provider accepts the fields WHITELABEL forwards before switching traffic.
- **Regression checks**: re-run dry-runs in CI to catch drift when your integration or the provider's contract changes.

<Note>
One call can carry up to **10** event entries (REQUEST, RESPONSE, and/or WEBHOOK), all tied to the same payment via `merchant_reference`. See the [correlation rules](#correlation).
</Note>

<Note>
This endpoint has a companion: `POST /v1/payments` accepts an `X-Dry-Run: true` request header that tells WHITELABEL to validate instead of routing. Both legs must share the same `merchant_reference` so validation can pair them.
</Note>

<Note>
Use `X-Idempotency-Key` for safe retries. Same key + same payload returns the original response; same key + different payload returns `409`.
</Note>

<Warning>
**PCI boundary**

`headers` and `body` are sent **base64-encoded**. WHITELABEL base64-decodes on ingestion, applies deterministic PAN/CVV/auth-token redaction, and persists only the redacted form. See [PCI Compliance](/docs/security-and-compliance/pci-compliance).
</Warning>

---

## Correlation

- `merchant_reference` is always required and uniquely identifies the order on your side. WHITELABEL uses it to resolve the event to a payment asynchronously when `payment_id` is not supplied.
- `payment_id`, if supplied, is resolved immediately. If the id is unknown for your account the request returns `404 PAYMENT_NOT_FOUND`.
- `provider_id` + `payment_method_type` optionally identify which integration surface the dry-run exercises (for example `stripe` + `CREDIT_CARD`). If omitted, WHITELABEL uses the information from the associated payment.

**POST** `/dry-run/provider-events`

Base URL: `https://api-sandbox.whitelabel.com/v1`

Stores the HTTP traffic that the merchant exchanged directly with a payment
provider (request, response, and webhook) for correlation to a WHITELABEL payment.

## Header parameters

- `PUBLIC-API-KEY` (string)
  Public API key. One of PUBLIC-API-KEY / PRIVATE-SECRET-KEY required.
- `PRIVATE-SECRET-KEY` (string)
  Private secret key for server-to-server calls. One of PUBLIC-API-KEY / PRIVATE-SECRET-KEY required.
- `X-Idempotency-Key` (string)
  Free-form string (MAX 64). 24-hour replay window.

## Body

Content type: `application/json`

- `merchant_reference` (string, required)
  Merchant-assigned identifier (MAX 255; MIN 3). Unique per account.
- `payment_id` (string<uuid>)
  WHITELABEL payment UUID. If supplied, resolved immediately.
- `account_id` (string<uuid>)
  WHITELABEL account UUID — same shape as account_id in POST /v1/payments.
- `provider_id` ("STRIPE" | "ADYEN" | "CYBERSOURCE" | "BRAINTREE" | "NMI" | "CHECKOUT" | "WORLDPAY" | "PAYPAL" | "EBANX" | "GLOBALPAYMENTS" | "NUVEI" | "CIELO" | "MPGS" | "PRISMA" | "FISERV" | "WORLDLINE" | "ANTOM" | "ORBITAL" | "GOCARDLESS" | "AUTHORIZE_NET" | "SONY" | "CITI" | "EPX" | "HPAY" | "PAYSTACK" | "PLAID" | "SAFERPAY" | "SIKA_HEALTH" | "VALIDIFI" | "WEPAY" | "CARD_CONNECT" | "GMO_PG" | "MONERIS" | "BLUESNAP" | "QUICK_GATEWAY" | "TWENTYFOUR_HOUR_FITNESS" | "MERCHANT_ESOLUTIONS" | "NETS" | "FAT_ZEBRA" | "WINDCAVE" | "CHASE_MOBILITY" | "HELIX" | "ANB" | "AMAZON_PAY" | "OPAYO" | "IP_PAYMENTS" | "KLARNA" | "BILLDESK" | "WELLS_FARGO" | "SAGEPAY" | "PLANET")
  Provider identifier. Allowed values aligned to the WHITELABEL catalog.
- `payment_method_type` ("" | "CARD" | "CREDIT_CARD" | "CREDIT_CARD_REFERENCE_TRANSACTION" | "DEBIT_CARD" | "EPX_TOKEN" | "TEST_CREDIT_CARD" | "UPC_TOKEN_TRANSACTION" | "APPLE_PAY" | "GOOGLE_PAY" | "PIX" | "PSE" | "OXXO" | "BOLETO" | "ALI_PAY" | "AMAZON_PAY" | "GCASH" | "IDEAL" | "KAKAO_PAY" | "KLARNA" | "MOMO_PAY" | "NAVER_PAY" | "OVO" | "PAYPAL" | "PAYPAL_CREDIT" | "PAYPAY" | "PAZE" | "TOSS_PAY" | "UPI" | "VENMO" | "ACH" | "BANK_TRANSFER" | "CRYPTO" | "CASH")
  Payment method exercised by this dry-run. Same vocabulary as payment_method.type in POST /v1/payments.
- `events` (object[], required)
  1–10 HTTP exchange entries for this dry-run (MAX 10; MIN 1).
  - `type` ("REQUEST" | "RESPONSE" | "WEBHOOK", required)
    Which leg of the exchange this entry captures.
  - `http_method` ("GET" | "POST" | "PUT" | "PATCH" | "DELETE", required)
  - `operation_type` ("PURCHASE" | "AUTHORIZE" | "CAPTURE" | "CANCEL" | "REFUND" | "CHARGEBACK" | "THREE_D_SECURE", required)
    Identifies the payment operation type being simulated.
  - `base_url` (string<uri>)
    Required for REQUEST and WEBHOOK. Origin of the provider endpoint — scheme + host + port (e.g. https://api.stripe.com).
  - `endpoint` (string)
    Required for REQUEST and WEBHOOK. Path and query portion (e.g. /v1/charges?expand=customer).
  - `http_status_code` (integer<int32>)
    Required for RESPONSE and WEBHOOK. Omit for REQUEST.
  - `headers` (string<byte>, required)
    Base64-encoded header payload. Decoded content may be a JSON-serialized
    `{header-name: header-value}` map or the raw HTTP header block. Hard
    cap: 64 KB of decoded bytes per event.
  - `body` (string<byte>)
    Base64-encoded body payload. Omit for empty bodies. Hard cap: 1 MB of
    decoded bytes per event. For non-UTF-8 bodies (protobuf, gzip),
    base64-encode the raw bytes directly.

Example:

```json
{
  "merchant_reference": "ORD-12345",
  "payment_id": "fb9e5fa4-684c-4747-9755-9d332617f16f",
  "account_id": "a389f417-ecd1-4355-89f5-7489564f264d",
  "provider_id": "STRIPE",
  "payment_method_type": "CREDIT_CARD",
  "events": [
    {
      "type": "REQUEST",
      "http_method": "POST",
      "operation_type": "PURCHASE",
      "base_url": "https://api.stripe.com",
      "endpoint": "/v1/charges",
      "headers": "eyBDb250ZW50LVR5cGU6IGFwcGxpY2F0aW9uL2pzb24gfQ==",
      "body": "eyBhbW91bnQ6IDIwMDAsIGN1cnJlbmN5OiAidXNkIiB9"
    }
  ]
}
```

## Responses

### 201

Dry-run registered

- `id` (string, required)
  Public identifier of the dry-run registration (nano_id, 21 chars).
- `status` ("REGISTERED", required)
  Lifecycle state.
- `merchant_reference` (string, required)
- `payment_id` (string<uuid>)
- `account_id` (string<uuid>)
- `provider_id` (string)
- `payment_method_type` ("" | "CARD" | "CREDIT_CARD" | "CREDIT_CARD_REFERENCE_TRANSACTION" | "DEBIT_CARD" | "EPX_TOKEN" | "TEST_CREDIT_CARD" | "UPC_TOKEN_TRANSACTION" | "APPLE_PAY" | "GOOGLE_PAY" | "PIX" | "PSE" | "OXXO" | "BOLETO" | "ALI_PAY" | "AMAZON_PAY" | "GCASH" | "IDEAL" | "KAKAO_PAY" | "KLARNA" | "MOMO_PAY" | "NAVER_PAY" | "OVO" | "PAYPAL" | "PAYPAL_CREDIT" | "PAYPAY" | "PAZE" | "TOSS_PAY" | "UPI" | "VENMO" | "ACH" | "BANK_TRANSFER" | "CRYPTO" | "CASH")
- `operation_type` (string)

Example:

```json
{
  "id": "drun_1209fnkw428ufwd",
  "status": "REGISTERED",
  "merchant_reference": "ORD-12345",
  "payment_id": "fb9e5fa4-684c-4747-9755-9d332617f16f",
  "account_id": "a389f417-ecd1-4355-89f5-7489564f264d",
  "provider_id": "STRIPE",
  "payment_method_type": "CARD",
  "operation_type": "PURCHASE"
}
```

### 400

Validation failure

- `code` ("NOT_AUTHENTICATED" | "AuthenticationFail" | "INVALID_PARAMETERS" | "TRAFFIC_LOG_VALIDATION_FAILED" | "TRAFFIC_LOG_MERCHANT_REFERENCE_REQUIRED" | "TRAFFIC_LOG_BODY_ENCODING_MISMATCH" | "TRAFFIC_LOG_IDEMPOTENCY_REPLAY" | "TRAFFIC_LOG_PAYLOAD_TOO_LARGE" | "TRAFFIC_LOG_UNSUPPORTED_CONTENT_TYPE" | "TRAFFIC_LOG_SEMANTIC_INVALID" | "PAYMENT_NOT_FOUND" | "RATE_LIMITED", required)
  Stable error code.
- `messages` (string[], required)
  Human-readable error details.
- `httpCode` (integer<int32>, required)

Example:

```json
{
  "code": "NOT_AUTHENTICATED",
  "messages": [
    "string"
  ],
  "httpCode": 0
}
```

### 401

Missing or invalid credentials

- `code` ("NOT_AUTHENTICATED" | "AuthenticationFail" | "INVALID_PARAMETERS" | "TRAFFIC_LOG_VALIDATION_FAILED" | "TRAFFIC_LOG_MERCHANT_REFERENCE_REQUIRED" | "TRAFFIC_LOG_BODY_ENCODING_MISMATCH" | "TRAFFIC_LOG_IDEMPOTENCY_REPLAY" | "TRAFFIC_LOG_PAYLOAD_TOO_LARGE" | "TRAFFIC_LOG_UNSUPPORTED_CONTENT_TYPE" | "TRAFFIC_LOG_SEMANTIC_INVALID" | "PAYMENT_NOT_FOUND" | "RATE_LIMITED", required)
  Stable error code.
- `messages` (string[], required)
  Human-readable error details.
- `httpCode` (integer<int32>, required)

Example:

```json
{
  "code": "NOT_AUTHENTICATED",
  "messages": [
    "string"
  ],
  "httpCode": 0
}
```

### 404

Payment not found

- `code` ("NOT_AUTHENTICATED" | "AuthenticationFail" | "INVALID_PARAMETERS" | "TRAFFIC_LOG_VALIDATION_FAILED" | "TRAFFIC_LOG_MERCHANT_REFERENCE_REQUIRED" | "TRAFFIC_LOG_BODY_ENCODING_MISMATCH" | "TRAFFIC_LOG_IDEMPOTENCY_REPLAY" | "TRAFFIC_LOG_PAYLOAD_TOO_LARGE" | "TRAFFIC_LOG_UNSUPPORTED_CONTENT_TYPE" | "TRAFFIC_LOG_SEMANTIC_INVALID" | "PAYMENT_NOT_FOUND" | "RATE_LIMITED", required)
  Stable error code.
- `messages` (string[], required)
  Human-readable error details.
- `httpCode` (integer<int32>, required)

Example:

```json
{
  "code": "NOT_AUTHENTICATED",
  "messages": [
    "string"
  ],
  "httpCode": 0
}
```

### 409

Idempotency replay with a different payload

### 413

Payload or batch exceeds size limits

### 415

Unsupported Content-Type (must be application/json)

### 429

Rate limit exceeded