# Agency alert services

> An integration guide for agencies using Ethoca and RDR. Enroll merchants, query alerts, and submit Ethoca outcomes.

This guide is for developers at agencies. It explains how to integrate Ethoca and RDR alert services for third-party merchants, including merchant enrollment, receiving and querying alerts, and submitting Ethoca outcomes.

These merchants use other payment providers to process their transactions. Onerway does not process their transactions or issue refunds through this service.

Use the `merchantNo` assigned to your agency by Onerway when calling the APIs. Use `resellerSubMerchantId` to identify each merchant you serve. The APIs refer to these merchants as **sub-merchants**.

If you accept payments through Onerway, see [Chargebacks and alerts](/payments/online-payments/scenarios/disputes-and-alerts).

## Prepare your integration

Confirm that alert services are enabled for your agency account, and assign a unique `resellerSubMerchantId` to each merchant you serve. Generate request signatures as described in [Request signing](/payments/get-started/request-signing), and configure the IP allowlist required by the API.

Configure notification URLs under **Developers → Webhooks** in the merchant portal. Select events according to the notification type:

- Ethoca alerts: select **Ethoca** under **Pre-disputes (for resellers)**.
- Ethoca and RDR enrollment status changes: select **Pre-disputes Enrollment (for resellers)**.

See each webhook reference for verification, acknowledgement, and retry rules.

## Enroll merchants and confirm activation

1. Submit an [Ethoca enrollment application](/payments/api-reference/endpoints/submit-ethoca-enrollment) or [RDR enrollment application](/payments/api-reference/endpoints/submit-rdr-enrollment). Store the application ID returned in `data.id` together with the merchant’s `resellerSubMerchantId`. Use the actual billing descriptor for Ethoca enrollment. For RDR enrollment, `bin` identifies the acquiring institution and differs from the transaction card’s `cardBin`.
2. After submission, `respCode=20000` only means the application was accepted for processing. The application status becomes `ENROLLED` when the service is active. Check the current status using [Ethoca enrollment queries](/payments/api-reference/endpoints/query-ethoca-enrollments) or [RDR enrollment queries](/payments/api-reference/endpoints/query-rdr-enrollments). You can also receive status changes through the [Ethoca enrollment webhook](/payments/api-reference/webhooks/ethoca-enrollment-changed) or [RDR enrollment webhook](/payments/api-reference/webhooks/rdr-enrollment-changed).
3. To resubmit, withdraw an application, or request disenrollment, query the current status first. Select `enrollmentEvent` from the allowed operations listed in [Update Ethoca enrollment status](/payments/api-reference/endpoints/update-ethoca-enrollment-status) or [Update RDR enrollment status](/payments/api-reference/endpoints/update-rdr-enrollment-status). If you include `enrollmentStatus`, set it to the current status you expect, not the status you want to change to. After a successful operation, query the application to confirm whether the merchant has been enrolled or disenrolled.

Status notifications for the same application share the same `id` (application ID). Continue to process status changes even if the application ID is already in your records. Query the application when you need to confirm its current status.

Numeric `id` values in notifications may exceed JavaScript’s safe integer range. Preserve the full value when parsing JSON so that signature verification and stored records remain accurate.

## Handle Ethoca alerts

1. Receive an [Ethoca alert webhook](/payments/api-reference/webhooks/ethoca-alert-created) or [query Ethoca alerts](/payments/api-reference/endpoints/query-ethoca-alerts). Store `ethocaId` and identify the merchant using `merchantNo` and `resellerSubMerchantId`. The notification’s `id` identifies the notification record; use `ethocaId` when submitting an outcome.
2. Match the alert to the merchant’s transaction records using the acquirer reference number (`arn`), transaction time, amount, currency, and billing descriptor.
3. [Submit the Ethoca alert outcome](/payments/api-reference/endpoints/submit-ethoca-alert-outcome) to report the current progress or result to Onerway. Identify the alert with `ethocaId` and set `outcome` and `refundStatus` to reflect the actual situation. This API does not initiate a refund.
4. `data.success=true` means Onerway accepted your submission. Query the latest `outcome` and `refundStatus` as needed. Contact the payment provider that processed the transaction if you need to verify the actual refund result.

## Query RDR cases

RDR (Rapid Dispute Resolution) cases are not delivered through webhooks. Onerway sends your agency CSV files containing case details through SFTP. Your agency then notifies the merchants so they can handle the cases. The RDR enrollment status webhook reports progress on service enrollment or disenrollment.

Use `caseId` in [Query RDR alerts](/payments/api-reference/endpoints/query-rdr-alerts) to retrieve a case. Identify the merchant using `merchantNo` and `resellerSubMerchantId`, and match the case to the merchant’s transaction records using `merchantOrderId` and `arn`.

Read `status` in the response to check the case status; `Accepted` means the transaction has been refunded. To confirm that the funds have arrived, contact the payment provider that processed the transaction. See [Query RDR alerts](/payments/api-reference/endpoints/query-rdr-alerts) for query filters and status values.
