# NVDA Protocol — agent quickstart

You are adding NVDA Protocol as an **optional USDC payout rail** for the providers on an existing platform. Nothing that already works may change: checkout stays as it is, every existing payout method stays selectable, and NVDA becomes one more option.

## Ground rules

1. Read the codebase before editing. Find where payouts are created and where providers choose a payout method.
2. Do not remove or rename any existing payout method, webhook handler or database column.
3. Keep secrets out of the repository. Read the NVDA key from the environment as `NVDA_SECRET_KEY`.
4. Make the change behind a feature flag (`NVDA_PAYOUTS_ENABLED`) that defaults to off.

## Steps

1. **Install the SDK.** Node: `npm i @nvda/node`. Python: `pip install nvda-protocol`. If the package is not published for your stack, call the REST API directly; it mirrors Stripe Connect (`/v1/accounts`, `/v1/account_links`, `/v1/transfers`, `/v1/payouts`).
2. **Create a client** with `new NVDA(process.env.NVDA_SECRET_KEY, process.env.NVDA_API_HOST)`.
3. **Add a payout method** named `nvda_usdc` wherever the platform lists payout methods. Store one field per provider: `nvda_account_id`.
4. **Onboarding.** When a provider picks `nvda_usdc`, create an account with `client.accounts.create({ type: 'express', country, email })`, then `client.accountLinks.create({ account: id, refresh_url, return_url, type: 'account_onboarding' })` and redirect them to `url`.
5. **Webhooks.** Handle `account.updated` to mark the provider as ready when `payouts_enabled` is true. Reuse the existing webhook route if there is one; add a second signature check for NVDA events.
6. **Payouts.** In the existing payout job, when the provider's method is `nvda_usdc`, call `client.transfers.create({ amount, currency: 'usdc', destination: nvda_account_id, description })`. Amounts are integer cents. Record the transfer id next to the existing payout record.
7. **Tests.** Add tests for: method listing includes `nvda_usdc` only when the flag is on; onboarding creates an account once; a payout with `nvda_usdc` calls transfers and stores the id; the other methods are untouched.
8. **Docs.** Add a short section to the platform's README describing the flag and the two environment variables.

## Done when

- The flag off: the platform behaves exactly as before.
- The flag on: a provider can choose NVDA, finish onboarding, and receive a test-mode payout.
- All existing tests pass.

Reference: https://nvda.pro/docs
