Previously, we would generate a new idempotency key for each payment. This is bad practice, since the reason we use idempotency key in the first place is to prevent issues like multiple clicks or accidentally submitting multiple payment requests. I fixed the sample apps so that we generate the idempotency key on page load.
Previous behaviour: loading the app and paying multiple times would "charge" the user multiple times since different idempotency keys are used for every request.
New behaviour: loading the app and paying multiple times would still generate multiple requests, but with the same idempotency key. Only the first payment will be successful.
Additionally, I fixed an issue with the Java payment app which wasn't working properly, and added some additional error handling to the rails payment sample.
Previously, we would generate a new idempotency key for each payment. This is bad practice, since the reason we use idempotency key in the first place is to prevent issues like multiple clicks or accidentally submitting multiple payment requests. I fixed the sample apps so that we generate the idempotency key on page load.
Previous behaviour: loading the app and paying multiple times would "charge" the user multiple times since different idempotency keys are used for every request.
New behaviour: loading the app and paying multiple times would still generate multiple requests, but with the same idempotency key. Only the first payment will be successful.
Additionally, I fixed an issue with the Java payment app which wasn't working properly, and added some additional error handling to the rails payment sample.