I am working with REST API and have the following scenario for processing request to make a payment:
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?
@Gusman talks about how to allow step 2 if step 3 cannot be completed.
TransactionScope allows you to do steps 2 and 3 in the same transaction, ie step 2 is cancelled if step 3 cannot be completed.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.