The Real Problem
Serverless developers and background job workers want to charge third parties per incoming webhook event (e.g. per notification, data transformation, or alert), but lack a zero-overhead payment verification mechanism.
Real-World Example: For example, a microservice could process incoming video transcodes or image optimizations for $0.05 per webhook event.
How aipp Solves It
Before executing heavy background jobs, the webhook receiver verifies payment status against aipp. Unpaid requests are rejected with HTTP 402; paid events trigger background execution.
Step-by-Step Payment Flow
STEP 01
Webhook Post
Sender posts event payload with payment receipt.
STEP 02
Status Query
Receiver checks aipp GET /invoice/status/:hash.
STEP 03
Verification
aipp confirms invoice status = settled.
STEP 04
Job Dispatched
Serverless worker executes background event.
Scope & Boundaries
What aipp Does
- ✓ Provides REST invoice status verification for event handlers
- ✓ Supports automated payout forwarding
- ✓ Maintains audit trail of payment hashes
What aipp Does Not Do
- ✗ Does not queue or retry third-party business webhook jobs
- ✗ Does not store private application payloads
Implementation Pattern
Below is the minimal implementation pattern using standard aipp endpoints / SDK:
export async function handleWebhook(req, res) {
const verify = await fetch('https://aipp.dev/t/<TAG_ID>/content', {
headers: { Authorization: req.headers.authorization }
});
if (!verify.ok) {
return res.status(402).json({ error: 'Payment required for webhook event' });
}
// Dispatch background job...
return res.json({ status: 'success' });
}
Settlement Architecture Note:
• Lightning Rail: In hosted Lightning flows, payments route through aipp's Lightning gateway before net proceeds are automatically forwarded to your configured wallet address.
• Base USDC Rail: USDC transfers settle directly on-chain to your designated EVM wallet address.
• No Merchant Spending Balance: aipp does not maintain a spendable merchant balance or require manual withdrawal steps.
Requirements & Limitations
- Webhook sender must first obtain a resource-scoped aipp access token
- Funds auto-forward to merchant wallet according to threshold settings
Frequently Asked Questions
What happens if a webhook event fails?
aipp verifies payment settlement independently of your internal job status.
Related Use Cases
Implement Webhook-Triggered Service with aipp
Read the developer documentation or generate your API key to gate requests behind Lightning and Base USDC payments.