# Events and status

> Every final state comes from an event. A 20000 response only means the request was accepted; whether a business step succeeded is decided by events, not by responses.

*Scenarios · This page defines the shared semantics used by every scenario page. Scenario pages reference it instead of repeating it.*

## Three rules

### Remember these three

- **Final state comes from events.** Success is S, failure is F; both are final. Everything else is in progress.
- **20000 ≠ final state.** `respCode=20000` means the request was processed successfully (accepted), not that the business step finished.
- **One event, one business fact.** An inbound notice is not a credit, and a credit is not a settlement.

## Event catalogue

| event_type | Business fact | Key fields | Final? |
| --- | --- | --- | --- |
| `EMFIN.KYC_STATUS` | A KYC review step: materials requested, a decision given, or the request revoked | `data.action`, `data.userId`, `data.kycStatus`, `data.requestedInfomation` | Requests and revocations are interim; a decision is final |
| `EMFIN.VA_RESULT` | Virtual account opening finished | `data.vaApplicationId`, `data.userId`, `data.status` (S/F) | Yes |
| `EMFIN.CLOSE_VA_RESULT` | Virtual account closure finished | `data.vaApplicationId`, `data.status` (S/F) | Yes |
| `EMFIN.RECHARGE` | The bank payment is booked but not credited yet | `data.rechargeId`, `data.currencyCode`, `data.transAmount`, `data.remitterName`, `data.bankTransferReference` | No |
| `EMFIN.RECHARGE_RESULT` | Matching finished; the credit succeeded or failed | `data.rechargeId`, `data.status` (S/F), `data.failReason` | Yes |
| `EMFIN.TRANS_RFI` | This transaction needs more documents | `data.rechargeId`, `data.requestedInfomation` | No |
| `EMFIN.REVOKE_TRANS_RFI` | The material request was revoked | `data.rechargeId` | No |
| `EMFIN.BACK` | Refund or return finished | `data.rechargeId`, `data.status` (S/F), `data.bankRefundSerialNo` | Yes |
| `EMFIN.SETTLE_RESULT` | A settlement batch result, with the settlement date and the transactions in the batch | `data.batchId`, `data.settleDate`, `data.currencyCode`, `data.amount`, `data.settleDetails` | Notified per batch |

> Nine events in total. Field lists here are the minimum needed to decide state; each event page holds the full set.

## Status semantics

**Result events carry only two values.** Progress is never pushed; if a synchronous response uses other values, the endpoint page is authoritative.

| Value | Meaning | Final? |
| --- | --- | --- |
| `S` | Success | Yes |
| `F` | Failure | Yes |

**Virtual accounts use a separate availability status.** The query endpoint returns `status`, and the only value documented for collection is `ACTIVE`. Other values are not a public contract; integrators only need to test for `ACTIVE`.

> This page only documents values that appear in the public documentation. Internal ledger states are not part of the text and must not be used as an integration signal.

## Receiving events

- **Verify.** Build HMAC-SHA256 from `webhook_secret` over `x-timestamp + "." + raw_body` and compare it with `x-signature`. Do not recompute from a parsed object.
- **Deduplicate.** Use `request_id`. The same notification may arrive more than once.
- **Acknowledge.** Return HTTP 200 with `respCode=20000`. Any other response is retried.
- **Ordering.** Do not infer business order from delivery order; decide state from the last final event.
- **Idempotency.** Handle the same event twice safely: record it first, then apply side effects.

## Which action produces which event

| Your action | Event that follows |
| --- | --- |
| Submit KYC or additional materials | `EMFIN.KYC_STATUS` |
| Apply for or close a virtual account | `EMFIN.VA_RESULT` / `EMFIN.CLOSE_VA_RESULT` |
| (no action — a bank payment arrives) | `EMFIN.RECHARGE` |
| Submit the match | `EMFIN.RECHARGE_RESULT`, or `EMFIN.TRANS_RFI` first |
| Submit additional materials | `EMFIN.TRANS_RFI` may arrive again, or `EMFIN.REVOKE_TRANS_RFI` |
| Apply for a refund | `EMFIN.BACK` |
| (no action — scheduled settlement) | `EMFIN.SETTLE_RESULT` |

## Common mistakes

| Pattern | Consequence |
| --- | --- |
| Treating a synchronous response as a credit | Goods shipped or balance added too early; reconciliation is off by one |
| Inferring state from notification order | State moves backwards under concurrency or retries |
| Not deduplicating by `request_id` | Double credit, double fulfilment |
| Treating `EMFIN.RECHARGE` as a credit | User balance disagrees with the ledger |
| Using `status` to decide whether a virtual account can collect | Collecting on an account that is not active; the money is returned |
| Treating a settlement result as a credit result | Two days of funds counted as one; the settlement amount does not reconcile |

## Related

- [Scenario overview](/embedded-finance/get-started/scenarios)
- [Accounts and account opening](/embedded-finance/get-started/scenarios/accounts)
- [Inbound and crediting](/embedded-finance/get-started/scenarios/inbound)
- [Refunds and returns](/embedded-finance/get-started/scenarios/refunds)
