CR
Docs

Best Practices

Tips for building reliable and efficient integrations.

1Optimize Polling

Do not poll continuously in a tight loop without a delay. We recommend a 2000ms (2s) interval between checks.

  • Use a linear backoff if the job is still processing after 10s.
  • Stop polling if you receive a completed or failed status.

2Cache Results

Receipt PDFs are immutable for a given transaction. Once you have the `pdfUrl`, store it in your database. Do not regenerate receipts for every user view.

Receipt generation costs compute resources. Redundant requests may eat into your rate limits.

3Handle Async Flows UI

Since generation is not instant, provide feedback to your users.

  • Show a "Generating Receipt..." spinner.
  • Use optimistic UI updates if possible (though difficult for receipts).
  • Implement a webhook listener (if available) for large batch processing instead of polling.