My web-application suffers from duplicate transactions. It uses Payflow Pro JAVA SDK to make a call to PayPal Gateway.
The following article suggests to add an invoice ID for a transaction, so in case two transactions will have the same INV ID, the second one will be declined and corresponding error code will be returned.
The invoice object is created like this:
Invoice inv = new Invoice(); /* Set Amount. */ Currency amt = new Currency(pip.getFeeAmount(), "USD"); inv.setAmt(amt); inv.setPoNum(poNum); // INV NUM e.g.: 988755aa8aeb262a506ec01[Removed. Phone #s not permitted]pan> BrowserInfo bi = new BrowserInfo(); bi.setButtonSource(buttonSource); inv.setBrowserInfo(bi); return inv;
For two transactions with the same INV NUM I am getting 0 status code and message: Approved. However, for the later transaction, the DUPLICATE flag is set true which I believe identifies it as duplicate one, but I don't understand if it means that second time transaction was not processed, meaning user was not charged second time.
Please, let me know what is the right way to block duplicate transactions.