I am using API of the payment gateway which is used by our ASP.NET Core app to retrieve the history of customer's payments when they open the "Payments" page.
The question is this a good practice to always retrieve this info from the payment service's API or is it better to store a local copy of these objects, since this will be faster?
things to consider:
- payment objects are not modified in the API once they are completed
- retrieving directly from API affects the allowed request limit for that API
- to store these objects locally I think I need to sync my DB table with API's data regularly
P.S.: The stack I am using:
- backend: ASP.NET Core
- database: PostgreSQL
- payment gateway: Stripe
CodePudding user response:
Of course, it completely depends on your scenario If you use the api. The only problem is that your server uses a lot of bandwidth in high number of requests, and things like latency may not be pleasant for your users. In general, it is better to have a copy in your database, even if that API server is out of reach Your application will not have any problems and will work properly