2

When using the Omnipay PHP library (or any other payment processing framework/library), is there a convention that covers when to use transactionId instead of transactionReference?

A couple of possibilities that I've considered:

  1. "Id" is reserved for numeric references, and "Reference" for alpha-numeric references.
  2. "Id" is our own reference to the transaction, sent in the initial request to the gateway, while "Reference" is the gateway's own reference returned in the callback/response.
coatesap
  • 10,707
  • 5
  • 25
  • 33

1 Answers1

4

For the most part, they are just words which don't have any inherent meaning. Different payment gateways use different terminology, which adds to the confusion.

That said, Omnipay has standardized on your convention (2):

  • Id always refers to an identifier generated by your own application (e.g. transactionId sent when initiating a new payment)
  • Reference always refers to an identifier generated by the payment gateway (e.g. transactionReference or cardReference returned in the response, or transactionReference sent when requesting a refund at later date)
Adrian Macneil
  • 13,017
  • 5
  • 57
  • 70
  • Is it assumed that the ID is unique across separate payments? Or could it be the same? I'm thinking of a scenario where you might send some payment model id, or send an order reference. To me it makes sense to send the order id/reference, especially if this shows up on statements etc. I know some gateways require unique transaction ids, but this can be generated in the omnipay class I assume. – Jedateach Aug 24 '14 at 23:56
  • I think normally the TransactionId is used for reference purpose only (usually used in the return data so you know which data it is for). – mr1031011 Oct 26 '14 at 15:07
  • The transactionId does need to be unique. Some gateways (e.g. SagePay) will accept a merchant-supplied ID for reference, but they raise an exception if the transactionId has been used before. The names are confusing; Helcim uses the same two terms, but for the opposite purposes - transactionReference is what the merchant supplies and transactionId is what the Helcim gateway generates. Luckily OmniPay helps to normalise all this, just stick to the rule in the above answer. – Jason Feb 04 '15 at 20:22