Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 4469

How do I maintain consistency between third-party API and my own database?

$
0
0

I am working with REST API and have the following scenario for processing request to make a payment:

  1. A client sends the request (payment information) to my own API.
  2. My API calls third-party REST API, passes it payment information, and receives a payment ID from it. If third-party API call fails for any reason, the error is returned to the client immediately.
  3. My API stores the resulting payment ID from step 2 and some extra info to its own database.

I want the data to be consistent between third-party API and my own database. However, if for some reason the database is not accessible on step 3, I will end up with inconsistent data — the payment will exist in third-party API, but not in my own API's database.

What's the best way of handling this consistency issue?


Viewing all articles
Browse latest Browse all 4469

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>