Tips for Building Resilient Payment Systems (2022)
shopify.engineering
shopify.engineering
> Regrettably we cannot share the specific reason or share further details about the rejection.
Like what? We applied, you approved, a lot of legitimate transactions happened and now you cut me off but can’t explain why? You really can’t trust them.
Also I’m sure they have dual-write consistency problems, how exactly do they solve that? 2PC? Event sourcing? Outbox?
I understand it gets... interesting.
Also regarding dual write consistency problems: they mention Google cloud. If they're using NoSQL such as Data store/firestore, they have distributed transactions. Another possibility is they must trust their payment clients to use idempotency keys correctly. If you get two requests with the same idempotency keys, then the requests are considered to be the same and therefore it wouldn't matter which one is processed first. If they're different requests with the same idempotency keys, they may have some validations.
I believe DynamoDB also has conditional writes that can essentially be "if entity X does not exist: write entity X". Then there is a race condition for different requests with identical idempotency keys, but if that does happen, it'd result in an error and someone would need to look into it and figure out why that was allowed to happen.