Efficient API usage is essential when integrating with Recurly’s API. While real-time requests ensure the most accurate billing and subscription information, there are many cases where relying on cached data provides better performance, lower latency, and healthy rate-limit usage.
This article explains when cached responses are appropriate and when you should always use fresh, real-time API calls.
When Cached Responses Are Preferable
Caching is ideal for data that does not change frequently or for UI elements prone to high traffic.
| Recommended for Caching | Reason |
|---|---|
| Plans | Rarely updated once configured. |
| Add-ons | Stable pricing/structure; low update frequency. |
| Coupons | Usually pre-configured and static. |
| Site settings / configuration | Ideal for front-end rendering without repeated API calls. |
| High-traffic UI components | Prevents accidental rate-limit exhaustion. |
Tip: If your integration consumes webhooks or external systems like Braze or QuickBooks Online, you often receive real-time updates automatically — eliminating the need to poll the API.
When You Should Avoid Caching
Cached data should never be used where financial accuracy or real-time billing state matters. In these situations, always use live API calls.
| Avoid Caching | Reason |
|---|---|
| Subscription state | Status may change due to billing events, pauses, or renewal timing. |
| Delinquency / dunning status | Time-sensitive for revenue recovery flows. |
| Invoice or transaction status | Financially critical — must be accurate. |
| Payment method validity | Bank or network responses can update at any time. |
| Refund or adjustment state | Impacts customer balances and reporting. |
Important: Never rely on cached data for anything that influences billing logic, tax calculation, financial reconciliation, or compliance workflows.
Practical Examples
Good Uses of Caching
- Rendering a product catalog (plans/add-ons/coupons) on your website.
- Reducing extraneous API calls from client-side UIs.
- Storing static site settings retrieved at application startup.
- Improving load times for checkout flows by minimizing repeated reads.
Bad Uses of Caching
- Checking whether a subscription is active or past due.
- Deciding whether to attempt billing or renewal operations.
- Displaying an invoice balance or transaction state.
- Confirming whether payment information is still valid.
Best Practices
- Cache static or slow-changing objects only.
- Leverage webhooks to invalidate or update cached objects proactively.
- Adopt a “live-first” approach for anything in the billing or payments lifecycle.
- Monitor API usage dashboards to ensure your application isn’t approaching rate limits.
Summary: Cache static data. Use fresh API calls for billing-critical or time-sensitive operations.
Comments
0 comments
Please sign in to leave a comment.