Donations
Initiate Donation (x402)
GET /api/donate/{slug}?amount={amount}
Returns HTTP 402 with x402 payment instructions. This is the standard HTTP payment flow — the agent receives payment details and must sign a USDC transaction on Solana.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
slug | string | The nonprofit’s URL slug |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
amount | number | Yes | Donation amount in USDC |
Example
Response (HTTP 402)
Submit Donation
POST /api/donate/{slug}
Submit a signed USDC transaction to complete the donation. The transaction must be a valid Solana transaction sending the specified USDC amount to the nonprofit’s wallet.
Request Body
Response (HTTP 200)
Donation History
GET /api/donations/{slug}
Returns the donation history for a nonprofit.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
slug | string | The nonprofit’s URL slug |
Example
How x402 Works
The x402 protocol uses standard HTTP status codes for payments:- Agent requests donation →
GET /api/donate/{slug}?amount=50 - Server returns 402 → payment instructions with wallet address, amount, network
- Agent signs transaction → creates a Solana USDC transfer to the wallet
- Agent submits proof →
POST /api/donate/{slug}with the transaction signature - Server verifies and records → confirms the transaction on-chain and logs the donation