Stripe Integration Guide
Stripe + BillDog
BillDog integrates with Stripe to power web checkout, subscription management, and payment processing. This guide walks you through connecting your Stripe account and configuring webhooks.
Prerequisites
- A Stripe account (test or live mode)
- Access to your Stripe Dashboard API keys
- Your products set up in BillDog (Stripe prices can be created from them, or imported from Stripe)
Step 1: Get Stripe API Keys
Navigate to your Stripe Dashboard to find your API keys:
- Go to Stripe Dashboard → Developers → API keys
- Copy your Secret key (starts with
sk_test_orsk_live_) - For test mode, use keys starting with
sk_test_ - In BillDog, open Settings → Web Checkout. In the Stripe Integration card, choose the Direct API Keys tab and paste the key into Stripe Secret Key. You'll paste the webhook signing secret into the field below it in Step 2.
Security Note
Never expose your secret key in client-side code. BillDog stores your key securely and only uses it server-side.
Step 2: Configure Webhook
Webhooks allow BillDog to receive real-time payment events from Stripe:
Webhook Configuration
Webhook URL:
https://api.billdog.io/v1/webhook-stripe?project_id=<PROJECT_ID>
The ?project_id= part is required: it tells BillDog to check the event's signature against your signing secret. Without it, every event from your Stripe account is rejected with 401 Invalid signature. Copy the exact URL, with your project ID already filled in, from Settings → Web Checkout → Direct API Keys → Manual Webhook Configuration.
Events to subscribe (all 17):
Don't skip charge.refunded and the charge.dispute.* events: they are how BillDog revokes access after a refund or a lost dispute. The same list is shown in Settings → Web Checkout for copying.
Created your endpoint before? Add checkout.session.async_payment_succeeded and checkout.session.async_payment_failed to it. A purchase paid by a delayed method (SEPA, ACH, Boleto, OXXO) completes only when its payment settles, and these are the events that say so.
- Go to Stripe Dashboard → Developers → Webhooks
- Click "Add endpoint"
- Paste the webhook URL from Settings → Web Checkout (including
?project_id=) - Select the 17 events listed above
- Click "Add endpoint"
- Copy the endpoint's Signing secret (starts with
whsec_) - Back in BillDog, paste it into Stripe Webhook Secret (Settings → Web Checkout → Direct API Keys) and click Save Web Checkout Settings
Step 3: Give each web product a Stripe price
A BillDog product's Stripe Price ID is read-only on the product page. It is filled in one of two ways, both from Products:
- BillDog creates the Stripe price. In the product form, set Price (USD) and turn on Enable Web Checkout. Then click Sync All at the top of the list, or the sync icon in the product's Stripe column. BillDog creates the Stripe product and price (recurring for subscription products, at the product's duration; one-time otherwise) and stores their IDs.
- The products already exist in Stripe. Click Import from Stripe, pick the products, and click Import. BillDog creates or updates the matching products and stores each one's Stripe price ID.
Step 4: Check the link
Open the product. Its Store Configuration card shows the Stripe Price ID next to the App Store and Play Store IDs, so one BillDog product covers native in-app purchase and web checkout:
Product: Premium Monthly
├── App Store Product ID: com.app.premium.monthly
├── Stripe Price ID: price_1ABC123xyz... (set by Sync or Import)
└── Product Type: subscriptionTest Mode vs Live Mode
Test Mode
- API keys start with
sk_test_ - Use test card numbers
- No real charges processed
- Separate from live data
Live Mode
- API keys start with
sk_live_ - Real payment processing
- Actual customer charges
- Production environment
With Direct API Keys, the mode is decided by the key you paste: an sk_test_ key creates test checkouts and an sk_live_ key creates real charges. The Enable Test Mode switch in Settings → Web Checkout does not change which Stripe key is used; it controls whether BillDog treats checkouts as sandbox (and accepts only sandbox credentials for them). Keep it matched to your key: turn it on with an sk_test_ key while testing, and turn it off when you paste your sk_live_ key and live signing secret.
Test Cards
Use these test card numbers when in test mode:
| Card Number | Brand | Result |
|---|---|---|
| 4242 4242 4242 4242 | Visa | Success |
| 4000 0025 0000 3155 | Visa | Requires 3DS |
| 4000 0000 0000 9995 | Visa | Declined |
| 5555 5555 5555 4444 | Mastercard | Success |
Webhook Security
Signature Verification
BillDog automatically verifies webhook signatures using your signing secret. This ensures that webhook events are genuinely from Stripe and haven't been tampered with.
Troubleshooting
Checkout session not created
- • Verify your Stripe secret key is correct
- • Check that the product has a Stripe Price ID, and that the price exists and is active in Stripe
Webhook events not received
- • Verify the webhook URL is exactly the one shown in Settings → Web Checkout, including
?project_id= - • Check that you've subscribed to the required events
- • Test the webhook using Stripe's "Send test webhook" feature
Signature verification failed
- • Ensure webhook signing secret starts with
whsec_ - • Verify the secret matches your webhook endpoint
- • Make sure the endpoint URL ends in
?project_id=<your project ID>; without it, BillDog can't find your secret and every event fails with 401 - • Don't mix test and live mode secrets
Next Steps
Was this page helpful?
Or rate this page: