This guide covers everything you need to know to integrate Stripe with BricksMembers, from initial setup to handling subscriptions, one-time purchases, and refunds.
Why Stripe Integration is Special
BricksMembers provides dedicated Stripe support that goes beyond standard webhook handling:
- Automatic signature verification — Uses Stripe’s official
Stripe-Signatureheader for secure webhook authentication - Customer ID tracking — Stores Stripe customer IDs to reliably identify users across all webhooks
- Easy Mode UI — Simplified webhook mapping interface designed specifically for Stripe
- Automatic refund handling — Correctly removes levels when one-time purchases are refunded
- Webhook queuing — Handles race conditions when webhooks arrive before user creation completes
Prerequisites
- A Stripe account (Sign up here)
- At least one product with a price created in Stripe
- At least one membership level created in BricksMembers
- SSL certificate (HTTPS) for your WordPress site
Step 1: Enable Stripe Authentication
First, configure BricksMembers to use Stripe’s native authentication:
- Go to BricksMembers → Webhooks
- In the provider dropdown, select Stripe
- Click Apply Provider Settings
- The Authentication Method will be set to Stripe
- Copy the Webhook URL — you’ll need this for Stripe
- Click Save Settings (but don’t close the page yet)
Note: When Stripe authentication is selected, BricksMembers automatically creates the database table needed to track Stripe customer IDs. This happens behind the scenes when you save settings.
Step 2: Create a Webhook Endpoint in Stripe
Now configure Stripe to send webhooks to your site:
- Log in to your Stripe Dashboard
- Go to Developers → Webhooks (or Webhooks in the Stripe Dashboard sidebar)
- Click Add endpoint or Create an event destination (label varies by Stripe account; newer accounts may show “Create an event destination”)
- Paste the Webhook URL you copied from BricksMembers
- Under Select events to listen to, click Select events
- Add these events:
checkout.session.completed— Links customer ID to userinvoice.payment_succeeded— Grants levels for subscriptions and one-time invoicescustomer.subscription.created— Grants levels for new subscriptionscustomer.subscription.updated— Handles plan upgrades/downgradescustomer.subscription.deleted— Removes levels on cancellationinvoice.payment_failed— Handles failed paymentscharge.refunded— Removes levels when refunded
- Click Add endpoint
Step 3: Copy the Webhook Signing Secret
After creating the endpoint, you need to copy Stripe’s signing secret:
- Click on the newly created webhook endpoint in Stripe
- Under Signing secret, click Reveal
- Copy the secret (starts with
whsec_) - Go back to BricksMembers → Webhooks
- Paste the secret into the Webhook Secret field
- Click Save Settings
Important: The signing secret is used to verify that webhooks genuinely come from Stripe. Keep it private and never share it.
Step 4: Configure Webhook Field Mapping
BricksMembers provides an “Easy Mode” interface specifically for Stripe that simplifies configuration:
- Go to BricksMembers → Webhook Mapping
- You’ll see a simplified interface because Stripe authentication is enabled
- The blue notice explains: “Stripe mode auto-configures: email extraction, event detection (invoice.payment_succeeded, subscription changes), customer ID storage, and refund handling. Just map your Price IDs below. Switch to Advanced Mode above for custom configurations.”
What’s automatically configured in Easy Mode:
- Email extraction — Looks in
customer_details.email,customer_email, andreceipt_email - Customer name — Extracted and split from
customer_details.name - Event detection — Uses the
typefield to determine add/remove/change actions - Price ID extraction — Looks in
lines.data[*].pricing.price_details.priceand similar paths - Customer ID storage — Automatically stores and uses Stripe customer IDs
Switching to Advanced Mode
If you need to customize the default field mappings:
- Click Switch to Advanced Mode in the page header
- All standard webhook mapping fields will be visible
- Make your customizations
- Click Save Settings
Your customizations will be preserved even when switching back to Easy Mode.
Step 5: Map Price IDs to Membership Levels
This is the most important step — connecting Stripe products to BricksMembers levels:
Finding Your Stripe Price IDs
- Go to your Stripe Products
- Click on a product
- Under Pricing, find the price you want to map
- Click on the price to view details
- Copy the Price ID (starts with
price_)
Mapping Prices to Levels
- In BricksMembers → Webhook Mapping, scroll to User Level Mapping
- For each membership level, enter the Stripe Price ID
- Example:
- Basic Member:
price_1ABC123def456 - Pro Member:
price_1XYZ789ghi012
- Basic Member:
- Click Save Settings
Tip: Price IDs are more reliable than product names because they never change. Even if you rename a product in Stripe, the Price ID remains the same.
Step 6: Configure Subscription Changes (Optional)
If you offer subscription plans that customers can upgrade or downgrade:
- Scroll to the Subscription Level Changes card
- Check the levels that should be replaced when a subscription changes
- Example: If you have Basic, Pro, and Premium subscription levels, check all three
- This ensures that upgrading from Basic to Pro removes Basic and adds Pro
Step 7: Test Your Integration
Option A: Use Stripe Test Mode
- Toggle Test Mode on in your Stripe Dashboard (top-right corner)
- Create a test webhook endpoint using the same steps above (Test mode has separate webhooks)
- Make a test purchase using Stripe’s test card number:
4242 4242 4242 4242 - Use any future expiration date and any CVC
Option B: Send Test Webhooks from Stripe
- Go to Developers → Webhooks in Stripe
- Click on your webhook endpoint
- Click Send test webhook
- Select an event type (e.g.,
invoice.payment_succeeded) - Click Send test webhook
Verify the Test Worked
- Go to BricksMembers → Webhook Mapping
- Check the Last Received Webhook Data sidebar
- You should see the webhook data with highlighted important fields
- Check Users in WordPress to verify the test user was created with the correct level
How Stripe Webhooks Work in BricksMembers
Customer ID Tracking
One challenge with Stripe webhooks is that not all events include the customer’s email address. BricksMembers solves this by:
- When
checkout.session.completedarrives (which includes email), BricksMembers creates/finds the user and stores their Stripe customer ID (cus_xxx) - Future webhooks that lack email (like
invoice.payment_succeeded) use the stored customer ID to find the user - This ensures reliable user identification across all webhook types
Webhook Queuing
Sometimes Stripe sends webhooks faster than expected. If a webhook arrives before the user is fully linked:
- BricksMembers queues the webhook temporarily
- When the user is linked (via
checkout.session.completed), queued webhooks are processed - Queued webhooks expire after 7 days if the user is never linked
- A daily cleanup removes expired queued webhooks
Refund Handling
When a charge.refunded webhook arrives:
- For subscriptions: The refund doesn’t remove the level (subscription deletion handles this)
- For one-time purchases: BricksMembers looks up which level was granted for that charge and removes it
This is possible because BricksMembers stores a mapping of charge IDs to levels when levels are granted.
Event Reference
Here’s what each Stripe event does in BricksMembers:
| Event | Action | Notes |
|---|---|---|
checkout.session.completed | Links customer ID | Stores customer ID for future webhooks |
invoice.payment_succeeded | Adds level | Primary event for granting access |
customer.subscription.created | Adds level | Also grants access (redundant with invoice.payment_succeeded) |
customer.subscription.updated | Changes level | Handles upgrades/downgrades |
customer.subscription.deleted | Removes level | Handles cancellations |
invoice.payment_failed | Removes level | Revokes access on payment failure |
charge.refunded | Removes level | Only for one-time purchases |
Troubleshooting
Webhook Authentication Failed (403 Error)
Symptoms: Stripe shows webhook delivery failed with 403 error.
Solutions:
- Verify the Webhook Secret in BricksMembers matches Stripe’s signing secret
- Ensure you copied the secret exactly (starts with
whsec_) - Check that Authentication Method is set to Stripe
- If using test mode, make sure you’re using the test mode signing secret
User Not Created or Level Not Assigned
Solutions:
- Enable User Creation/Updating in Webhook Mapping
- Verify the Price ID in your mapping matches the Stripe Price ID exactly
- Check the Last Received Webhook Data sidebar to see what data was received
- Look for the highlighted fields like “Price ID → Product Name”
Webhooks Blocked by Firewall
Some hosting providers or security plugins block external webhook requests.
Solutions:
- Whitelist Stripe’s IP addresses in your firewall
- Disable security plugins temporarily to test
- Contact your hosting provider to allow the BricksMembers webhook endpoint
Viewing Stripe’s Webhook Logs
Stripe provides detailed webhook delivery logs:
- Go to Developers → Webhooks in Stripe
- Click on your webhook endpoint
- Click View recent deliveries
- Click on any delivery to see:
- Request body (the webhook payload)
- Response status code
- Response body
- Use the Resend button to retry a failed webhook
Best Practices
- Use Price IDs, not product names — Price IDs are unique and immutable
- Test in Stripe test mode first — Before going live, verify everything works with test data
- Keep the signing secret private — Never share it or commit it to version control
- Monitor webhook deliveries — Check Stripe’s webhook logs regularly for failures
- Use Easy Mode — Unless you need custom field mappings, Easy Mode handles everything automatically
Frequently Asked Questions
Do I need to use Stripe Checkout?
No. BricksMembers works with any Stripe integration method — Checkout, Payment Links, Payment Elements, or even API-based integrations. As long as the webhooks are sent, BricksMembers will process them.
Can I use the same webhook endpoint for test and live mode?
No. Stripe requires separate webhook endpoints for test and live mode. Create two endpoints in Stripe, each with their own signing secret.
What if I change my Stripe product prices?
When you create a new price in Stripe, it gets a new Price ID. You’ll need to add the new Price ID to your BricksMembers mappings. Old Price IDs continue to work for existing subscriptions.
Can one Stripe price grant multiple membership levels?
Currently, each Price ID maps to one membership level. If you need to grant multiple levels for one purchase, you can create a single “bundle” level that provides access to all content, or use Stripe metadata combined with Advanced Mode.
How do I test subscription upgrades/downgrades?
- Create a test subscription in Stripe test mode
- Go to the subscription in Stripe Dashboard
- Click Update subscription
- Change the price
- This triggers a
customer.subscription.updatedwebhook - Verify the user’s level changed in BricksMembers
With this guide, you should have Stripe fully integrated with BricksMembers. If you encounter issues not covered here, enable webhook logging and check both Stripe’s webhook logs and the “Last Received Webhook Data” sidebar for debugging information.