This guide applies to Default mode (you control payments). In Shared mode,
users fund a hosted, cross‑app wallet and you don’t deposit credits directly.
See Shared Mode.
1
Prerequisites
- Default mode enabled and your Paywalls API key configured.
- A stable, pseudonymous user id selected. See User Identity.
2
Call the Deposit API
Use POST
/v1/user/balance/deposit/post
. Amount is a string in your configured currency (e.g., “10”).3
Verify and display balances
- The deposit appears in the Ledger immediately.
- Optionally fetch the updated balance for display using GET /user/balance.
Include Idempotency-Key so repeated webhooks or retries do not create
duplicate credits.
Common scenarios
1. Signup bonus on registration
Grant a one‑time credit when a new account is created.- Amount: small trial amount (e.g., “1.00”)
- Metadata:
{"reason":"signup_bonus","signup_event":"evt_signup_123"}
2. Subscription renewal credits
Credit users monthly after your PSP confirms payment (e.g., Stripe invoice.payment_succeeded).- Amount: your plan’s included usage value (e.g., “10.00”)
- Metadata: include invoice id, plan, period_start/end for reconciliation
See Connect Stripe for Default mode setup.
No‑code (Zapier, n8n)
You can call the Deposit API from no‑code tools to credit balances without custom code.- Method: POST https://api.paywalls.ai/v1/user/balance/deposit
- Headers:
- Authorization:
Bearer PAYWALLS_API_KEY
- Content-Type:
application/json
- Authorization:
- Body:
{ "user": "...", "amount": "2.00", "metadata": { ... } }
Prefer injecting a stable
user
from your CRM/DB. For no‑code patterns, see
No-code: Zapier, n8n, and other
flows.Best practices
- Idempotency first: reuse the same Idempotency-Key on retries/webhook replays.
- Pseudonymous identity: avoid PII in user ids. See User Identity.
- Don’t expose keys: keep
PAYWALLS_API_KEY
server/edge only. - Reconciliation: store invoice/payment ids in metadata. Use the Ledger and Analytics & Reporting.
- Testing: use Stripe test mode in Default mode staging. See Test keys & Environments.