Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions docs/api-refs/cost-ingestion-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,36 @@ Returns `204 No Content`. Deleting a source that isn't configured also returns s
Once credentials are registered, point the connector's settlement-report notification at:

```
POST /webhooks/settlement/:connector
POST /webhooks/settlement/:merchant_id/:connector
```

This route is **public** (no `AUTH_HEADER`) — the connector authenticates itself via its own signature, which Decision Engine verifies against the `webhook_secret` stored for that `(connector, account)` pair. Adyen is the first supported connector (`:connector = adyen`).
This route is **public** (no `AUTH_HEADER`) — the connector authenticates itself via its own signature, which Decision Engine verifies against the `webhook_secret` stored for that `(merchant_id, connector, account)` triple. Adyen is the first supported connector (`:connector = adyen`).

```bash
curl --location "$BASE_URL/webhooks/settlement/adyen" \
curl --location "$BASE_URL/webhooks/settlement/merchant_demo/adyen" \
--header "Content-Type: application/json" \
--data @adyen-settlement-notification.json
```

The handler ACKs immediately and enqueues the report for background processing — download, parse, and re-fit all happen asynchronously in the ingest worker, so the connector always gets a fast response. A bad signature returns `401`; an unrecognized connector or malformed payload returns `400`.

<Note>
The URL carries your `merchant_id` because a connector's notification names only its own account (for Adyen, the `merchantAccountCode`) — never your Decision Engine merchant. Registering another merchant's id gets a caller nowhere without that merchant's signing secret, since the path only selects which stored `webhook_secret` the signature is checked against.
</Note>

### Sharing one connector account between two merchants

Two Decision Engine merchants can ingest from the **same** connector account — a shared platform account, for example. Register a separate webhook endpoint at the connector for each merchant, pointing at that merchant's own URL:

```
POST /webhooks/settlement/merchant_a/adyen
POST /webhooks/settlement/merchant_b/adyen
```

Each merchant stores their own credentials for the shared account, so the endpoints may use different HMAC keys and different report-download users (the same key on both also works). The connector delivers its report-ready event to both endpoints and each merchant gets their own ingestion job.

One endpoint cannot serve two merchants: it points at a single URL naming a single merchant, so only that merchant receives deliveries. The other will show its source as configured with no ingested data.

## Notes

- Manual and webhook/poll-based ingestions share the same pipeline and history — see [Uploads](https://github.com/juspay/decision-engine/blob/main/docs/api-refs/cost-ingestion-uploads.mdx) for the manual path and ingestion history.
Expand Down
39 changes: 36 additions & 3 deletions migrations/00000000000000_diesel_initial_setup/down.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,39 @@
-- This file was automatically created by Diesel to setup helper functions
-- and other internal bookkeeping. This file is safe to edit, any future
-- changes will be added to existing projects as new migrations.
USE jdb;

DROP TABLE IF EXISTS co_badged_cards_info_test;
DROP TABLE IF EXISTS routing_algorithm;
DROP TABLE IF EXISTS tenant_config_filter;
DROP TABLE IF EXISTS merchant_gateway_account;
DROP TABLE IF EXISTS user_eligibility_info;
DROP TABLE IF EXISTS gateway_bank_emi_support;
DROP TABLE IF EXISTS emi_bank_code;
DROP TABLE IF EXISTS juspay_bank_code;
DROP TABLE IF EXISTS gateway_card_info;
DROP TABLE IF EXISTS card_info;
DROP TABLE IF EXISTS txn_detail;
DROP TABLE IF EXISTS txn_card_info;
DROP TABLE IF EXISTS payment_method;
DROP TABLE IF EXISTS service_configuration;
DROP TABLE IF EXISTS merchant_config;
DROP TABLE IF EXISTS feature;
DROP TABLE IF EXISTS isin_routes;
DROP TABLE IF EXISTS txn_offer;
DROP TABLE IF EXISTS merchant_gateway_payment_method_flow;
DROP TABLE IF EXISTS merchant_account;
DROP TABLE IF EXISTS merchant_gateway_card_info;
DROP TABLE IF EXISTS txn_offer_detail;
DROP TABLE IF EXISTS token_bin_info;
DROP TABLE IF EXISTS merchant_iframe_preferences;
DROP TABLE IF EXISTS gateway_payment_method_flow;
DROP TABLE IF EXISTS merchant_gateway_account_sub_info;
DROP TABLE IF EXISTS issuer_routes;
DROP TABLE IF EXISTS card_brand_routes;
DROP TABLE IF EXISTS tenant_config;
DROP TABLE IF EXISTS merchant_priority_logic;
DROP TABLE IF EXISTS gateway_outage;
DROP TABLE IF EXISTS gateway_bank_emi_support_v2;

DROP DATABASE IF EXISTS jdb;

DROP FUNCTION IF EXISTS diesel_manage_updated_at(_tbl regclass);
DROP FUNCTION IF EXISTS diesel_set_updated_at();
Loading
Loading