Webhooks
Shopify webhooks handled by RewardsPro
RewardsPro uses Shopify webhooks to process events in real-time. All webhooks are automatically registered when you install the app.
Order Webhooks
orders/paid
Trigger: Order payment is confirmed
Actions:
Identify customer from order email
Calculate eligible amount (subtotal - discounts)
Apply customer's tier cashback rate
Create ledger entry (CASHBACK_EARNED)
Update customer balance
Update customer spending totals
Check for tier upgrade milestone
Data Stored:
Order details (ID, amounts, dates)
Cashback calculation data
Tier at time of order
Processing timestamp
orders/create
Trigger: New order created in Shopify
Actions:
Track order for analytics
Associate with customer
Prepare for payment confirmation
Note: Cashback is NOT issued on create - only on paid status.
orders/refunded
Trigger: Refund is processed
Actions:
Find original order
Calculate proportional clawback:
Full refund: 100% of original cashback reversed
Partial refund: (refund amount / order total) × original cashback
Create ledger entry (REFUND_CLAWBACK)
Update customer balance
Update customer netSpent
Example:
Customer Webhooks
customers/create
Trigger: New customer account created in Shopify
Actions:
Create customer record in RewardsPro
Assign default (base) tier
Initialize store credit at $0
Create tier change log (INITIAL_ASSIGNMENT)
customers/update
Trigger: Customer details changed in Shopify
Actions:
Update email, name, tags
Sync other metadata
Maintain existing tier and balance
Subscription Webhooks
subscription_contracts/create
Trigger: New tier subscription created
Actions:
Create TierSubscription record
Link to customer
Set initial status (PENDING or ACTIVE)
tier-subscription/billing
Trigger: Subscription billing attempt completed
Actions:
Update billing status
On success: Renew tier access
On failure: Track failed attempt count
Update nextBillingDate
tier-subscription/cancelled
Trigger: Subscription cancelled
Actions:
Update subscription status to CANCELLED
Create tier change log (SUBSCRIPTION_CANCELLED)
Evaluate tier based on spending (may downgrade)
App Webhooks
app/uninstalled
Trigger: Store uninstalls RewardsPro
Actions:
Clean up webhook registrations
Mark shop as inactive
Preserve data per retention policy
app/scopes_update
Trigger: App permissions changed
Actions:
Update stored scopes
Re-register webhooks if needed
app_subscriptions/update
Trigger: RewardsPro plan subscription changes
Actions:
Update billing status
Enable/disable features based on plan
Update usage quotas
subscriptions/approaching-cap
Trigger: Usage approaching plan limit
Actions:
Log warning
Notify merchant
Track for analytics
Shop Webhooks
shop/update
Trigger: Store settings changed in Shopify
Actions:
Sync store name, URL
Update currency if changed
Sync timezone
Compliance Webhooks (GDPR)
customers/data_request
Trigger: Customer requests their data (GDPR)
Actions:
Compile all customer data
Include orders, ledger entries, tier history
Prepare export file
customers/redact
Trigger: Customer requests data deletion (GDPR)
Actions:
Anonymize personal information
Remove email, name
Preserve anonymized transaction history
shop/redact
Trigger: 48 hours after app uninstall
Actions:
Delete all shop data
Remove customer records
Clear settings and configuration
Webhook Security
HMAC Verification
All webhooks are verified using HMAC-SHA256:
Headers Validated
X-Shopify-Hmac-SHA256
Signature verification
X-Shopify-Shop-Domain
Identify source shop
X-Shopify-Topic
Webhook event type
X-Shopify-Webhook-Id
Unique webhook ID
X-Shopify-API-Version
API version used
Idempotency
Each webhook is tracked to prevent duplicate processing:
Webhook ID stored on first processing
Duplicate webhooks skipped
Prevents double-crediting cashback
Webhook Endpoints
/webhooks/orders.paid
orders/paid
/webhooks/orders.create
orders/create
/webhooks/orders.refunded
refunds/create
/webhooks/customers.create
customers/create
/webhooks/customers.update
customers/update
/webhooks/tier-subscription.created
subscription_contracts/create
/webhooks/tier-subscription.billing
subscription_billing_attempts/*
/webhooks/tier-subscription.cancelled
subscription_contracts/update
/webhooks/app.uninstalled
app/uninstalled
/webhooks/app.scopes_update
app/scopes_update
/webhooks/app-subscriptions-update
app_subscriptions/update
/webhooks/shop.update
shop/update
/webhooks/compliance
customers/data_request, customers/redact, shop/redact
Retry Behavior
Shopify retries failed webhooks:
1st retry
5 minutes
2nd retry
30 minutes
3rd retry
2 hours
4th retry
24 hours
After all retries fail, webhook is dropped.
Response Requirements
2xx
Success, processed
4xx
Rejected, no retry
5xx
Error, will retry
Troubleshooting
Webhooks Not Received
Check app installation - Ensure app is properly installed
Verify webhook registration - View in Shopify Admin > Settings > Notifications
Check endpoint accessibility - Ensure your app URL is reachable
Review Shopify status - Check for platform outages
Cashback Not Issued
Order status - Must be "paid" not just "created"
Customer exists - Customer account required
Tier assigned - Customer must have a tier
Processing errors - Check app logs
Duplicate Processing
Idempotency check - Should prevent duplicates
Network timeouts - Can cause retries
Manual reconciliation - May be needed in edge cases
Related Guides
Cashback Logic - How cashback is calculated
Evaluation Periods - Tier calculation timing
Data Models - Data structure reference
Last updated