What is it?
As a POS developer, you want to ensure that your software never double charges a customer. In a perfect world we wouldn't need to worry about this, but the Internet happens and at times you may wonder if the payment request that was sent just before a crash or disconnect actually went through. Maybe you have no way of knowing the payment id so you have to send a 2nd request. Duplicate protection allows you to send that 2nd request and avoid charging the customer twice.
How do I enable it?
If you want to prevent charging the same card the same amount for a window of time (up to 5 minutes), you can pass the dupe_protection_in_seconds
parameter during a call to auth or capture. This will ensure that this unique combination of card (brand, expiration and last 4 are considered), external_account_id, and amount can't be captured twice during this time period.
What will be different when it is triggered?
We don't have the card details available until after an auth, so if a duplicate is detected a few things will happen:
- The auth of the duplicate will be cancelled.
- The payment status and last_error will be updated
- Any GET requests on this payment will return the last error and an additional field called duplicate_of, that contains the payment id of the original payment so your POS can GET it and handle it as needed.
Synchronous Adyen Hardware
If you are making a synchronous call to auth with Adyen hardware, you'll get back an error when there is a duplicate. The error contains the payment_id of the original payment. If you don't want to parse the payment id out of the message, you can do a GET on this payment and the duplicate_of
field will contain the id of the original payment.
Asynchronous Quilt Hardware
If you are making asynchronous calls for Quilt hardware, you are already polling on the payment id. You'll get back a payment with a last_error
and a field called duplicate_of
contains the id of the original payment.