destination_tag best practices when integrating Ripple I'm integrating Ripple with a commerce system, to accept payments to a Ripple wallet.

My understanding is that the destination_tag, an integer, is the only data I can use to track a transaction.  I can specify the destination_tag when I send the user to their wallet, and it will be tracked in the ledger.

If I'm correct this is the only parameter, I'm worried about conflicting destination tags.

Am I correct that if a wallet is being used with my system, it can't be used with any other, as they might use the same destination tag?

When a user of my system specifies their ripple account (wallet), am I expected to query the ledger for all past transactions to that wallet and, if any, throw an error that the same wallet can't be used with two payment systems?

Do I have to store not only the account id, but also the ledger sequence when my system learned the account id, so that I only search for transaction ids after that ledger sequence?
I will make my answer a little longer than necesary and mention some things you obviously already know in the hopes that the expanded answer will be useful to others as well:



The destination tag should be something that allows the receiving account to perform things like implement "for further credit to..." or to determine which invoice (or other event) a transaction corresponds to without knowing the payer's Ripple address before the payment is made.

As such, it's only meaningful for the receiving wallet. When someone wants to pay using Ripple, you would tell them something along the lines of:


  Send payment to
  rrrrrrrrrrrrrrrrrrrrBZbvji
  and use destination tag 1313426242


In other words, the destination tag is something that you must create and give to the user, who will then use it when making the payment.

So how to choose a destination tag? Well, there are many ways. Here are a few options:


Just give out an incrementing number, so the first transaction gets tag 1, the second tag 2, etc.
Use the invoice number generated by the commerce system you are integrating with. 


You can read more destination tags and requiring them at the Ripple Wiki.



Now, your question is what to do about conflicting destination tags. Obviously if you're the only one generating tags for a wallet, then you don't have to worry about that - simply don't generate conflicting tags.

My personal recommendation is to require/mandate that a vendor create a new  Ripple wallet, to be used exclusively by your system. This is certainly not unrealistic. In fact, it's a good idea™.