Overview
App Settings allow merchants to customize:- Payment Failure Handling: Configure retry attempts and actions when payments fail
- Inventory Failure Handling: Set behavior for out-of-stock scenarios
- Notification Preferences: Control when and how staff are notified about subscription issues
Settings are stored using Shopify’s Metaobject API and are automatically created on first access.
Settings Configuration
Payment Failure Settings
Configure how the app handles failed payment attempts:Number of times to retry a failed payment (0-10)
Days to wait between retry attempts (1-14)
Action to take after all retries are exhaustedOptions:
skip- Skip the current billing cycle and try again next cyclepause- Pause the subscription until customer updates paymentcancel- Cancel the subscription automatically
Inventory Failure Settings
Configure behavior when products are out of stock during billing:Number of times to retry billing when inventory is unavailable (0-10)
Days to wait between inventory retry attempts (1-14)
Action to take when inventory is unavailable after all retriesOptions:
skip- Skip the current billing cyclepause- Pause the subscriptioncancel- Cancel the subscription
Frequency of staff notifications for inventory issuesOptions:
immediately- Send email immediately for each inventory failureweekly- Send weekly digest of inventory failuresmonthly- Send monthly digest of inventory failures
Implementation
Settings Model
The Settings model provides methods to load and update configuration:app/models/Settings/Settings.server.ts
Settings Route
The settings page is implemented as a Remix route with form handling:app/routes/app.settings._index/route.tsx
UI Components
The settings page uses theBillingFailureSettings component:
app/routes/app.settings._index/components/BillingFailureSettings.tsx
Settings Schema
Settings are defined using Shopify’s metaobject definition:app/models/Settings/SettingsDefinitions.ts
How Settings Affect Behavior
Dunning Management
Settings directly control the dunning process:- Retry Attempts: Determines how many times
DunningServicewill retry failed payments - Days Between Retries: Sets the interval for the dunning job scheduler
- On Failure Action: Determines the contract status after exhausting retries
app/services/DunningService.ts
Inventory Management
When products are out of stock during billing:- Check
inventoryRetryAttemptsto determine retry count - Use
inventoryDaysBetweenRetryAttemptsfor scheduling - Apply
inventoryOnFailureaction after retries exhausted - Send staff notifications based on
inventoryNotificationFrequency
app/jobs/email/EnqueueInventoryFailureEmailJob.ts
Best Practices
Conservative Retry Settings
Start with 3-5 retry attempts to avoid overwhelming customers with retry emails
Appropriate Intervals
Use 2-3 day intervals between retries to give customers time to update payment methods
Final Action Strategy
Consider using “pause” instead of “cancel” to preserve customer relationships
Inventory Notifications
Use weekly or monthly digests for inventory notifications to avoid email fatigue
Validation
Settings are validated using Zod schemas:app/routes/app.settings._index/validator.ts
Related Features
Payment Retries
Learn how dunning management uses these settings
Billing Schedules
Configure when subscriptions are billed
Dunning Management
Understand the retry process in detail
Email Jobs
See how notification settings affect email delivery
Testing
Test settings updates in your development environment:test
Troubleshooting
Settings not persisting
Settings not persisting
Ensure metaobject definition is created:
Validation errors
Validation errors
Check that values are within allowed ranges:
- Retry attempts: 0-10
- Days between retries: 1-14
Settings not taking effect
Settings not taking effect
Settings are loaded at job execution time. After updating settings, wait for the next billing cycle to see changes take effect.