Stripe Webhook Setup
Project Alpha uses Stripe webhooks to record online payments and reconcile invoice status.
Endpoint
https://YOUR_PROJECT_ALPHA_HOST/stripe-webhook
The endpoint must be reachable over HTTPS from Stripe. Do not use the legacy endpoint for new installations.
For older deployments that do not yet include the clean-path rewrite, use this equivalent fallback endpoint:
https://YOUR_PROJECT_ALPHA_HOST/?page=stripe-webhook
Events
Configure at least:
checkout.session.completedpayment_intent.succeeded
Useful additional events:
payment_intent.payment_failedrefund.createdrefund.updatedrefund.failedcharge.refundedcharge.dispute.createdcharge.dispute.updatedcharge.dispute.closedcharge.dispute.funds_withdrawncharge.dispute.funds_reinstated
Only behavior implemented by the deployed version will be applied; unhandled events are logged or ignored.
Configuration
- In Stripe, create an endpoint with the production or test URL.
- Select the required events.
- Copy the endpoint signing secret.
- In Project Alpha, open Settings > Billing.
- Enter the matching publishable key, secret key, and webhook secret.
- Save and send a test event.
Use test keys and a test-mode endpoint while validating the installation.
Reconciliation Metadata
Project Alpha includes invoice identifiers in Stripe metadata. Preserve these fields when changing payment creation:
{
"pa_invoice_id": "123",
"invoice_id": "123",
"doc_number": "1001"
}
pa_invoice_id is the primary reconciliation identifier.
Project statement payments use pa_project_invoice_id and project_invoice_id. The aggregate payment is allocated to its child invoices; the project statement itself is never counted as additional revenue.
Successful Payment Behavior
The handler:
- Verifies the Stripe signature when a webhook secret is configured.
- Records or reconciles the payment idempotently.
- Recalculates the successful amount paid, net of recorded refunds.
- Marks the invoice
partialorpaid. - Revokes invoice links after full payment.
- May complete the linked contract.
- Records refunds and disputes and updates cash-basis reporting.
- Issues a branded Project Alpha receipt for ordinary invoice payments.
Testing
Verify both supported paths:
- Public invoice payment through Stripe Checkout
- Public project-statement payment and child-invoice allocation
- Duplicate delivery and reconciliation of the same one-time Payment Intent
Send duplicate test events and confirm they do not create duplicate payment records.
Troubleshooting
- Confirm the endpoint URL and HTTPS certificate.
- If
/stripe-webhookreturns404, either deploy an image with the clean-path rewrite or temporarily configure Stripe to use/?page=stripe-webhook. - Confirm test/live mode matches the configured keys.
- Confirm the webhook signing secret belongs to this exact endpoint.
- Review Stripe delivery attempts and response codes.
- Review Project Alpha webhook and system logs.
-
Run reconciliation manually if a successful payment was missed:
docker compose exec cron php /var/www/src/cron/stripe_reconciliation.php
The cron service also runs stripe_reconciliation.php every 6 hours, which is intentionally more frequent than a daily safety net.
Never include Stripe secrets or full event payloads containing customer data in a public issue.