{"action":"created","issue":{"url":"https://api.github.com/repos/thephpleague/omnipay/issues/261","labels_url":"https://api.github.com/repos/thephpleague/omnipay/issues/261/labels{/name}","comments_url":"https://api.github.com/repos/thephpleague/omnipay/issues/261/comments","events_url":"https://api.github.com/repos/thephpleague/omnipay/issues/261/events","html_url":"https://github.com/thephpleague/omnipay/issues/261","id":75605078,"number":261,"title":"Standard for getMerchantReference","user":{"login":"eileenmcnaughton","id":336308,"avatar_url":"https://avatars.githubusercontent.com/u/336308?v=3","gravatar_id":"","url":"https://api.github.com/users/eileenmcnaughton","html_url":"https://github.com/eileenmcnaughton","followers_url":"https://api.github.com/users/eileenmcnaughton/followers","following_url":"https://api.github.com/users/eileenmcnaughton/following{/other_user}","gists_url":"https://api.github.com/users/eileenmcnaughton/gists{/gist_id}","starred_url":"https://api.github.com/users/eileenmcnaughton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eileenmcnaughton/subscriptions","organizations_url":"https://api.github.com/users/eileenmcnaughton/orgs","repos_url":"https://api.github.com/users/eileenmcnaughton/repos","events_url":"https://api.github.com/users/eileenmcnaughton/events{/privacy}","received_events_url":"https://api.github.com/users/eileenmcnaughton/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-12T13:36:30Z","updated_at":"2015-05-12T14:45:56Z","closed_at":null,"body":"I think we should have a recommended function to normalise getMerchantReference() on the CompletePurchase class.\r\n\r\nAs has been pointed out in other comments not all gateways return the original merchant reference. But, most do. Further it is more 'special' than other data fields in that it is the unique identifier of the transaction from the merchant's point of view.\r\n\r\nGenerally to match up an incoming payment we use either the transactionReference (provided by the gateway) or the merchantReference (provided by the website implementing Omnipay). \r\n\r\nI would suggest that while not all gateways provide it we should have a recommended function to return the merchant reference if it exists (the parent class would return empty if not overridden)\r\n\r\nAn example of where this would help is Mollie. Here we have a situation where the implementation could, but doesn't add the merchantReference to the data passed to the processor when it is set and hence could but doesn't extract the merchantReference at the other end. Without this reference we can't make sense of the return result. \r\n\r\nNow of course having spent some hours researching Mollie we can figure out that  establish that there is a specific way to call Mollie to make all of this work and turn our code into a switch-fest of special cases for each processor we have integrated.\r\n\r\nBut if there was a recommended way to do this then we could propose a patch to Mollie and the next person who came along wouldn't need to spend hours researching Mollie they could rely on \r\n\r\n$request->setMerchantReference()  & $response->getMerchantReference() passing their merchant reference through Mollie.\r\n\r\nThere are a bunch of others that implement various slightly different functions to get whatever that gateway calls the merchantReference - and adding a guideline wouldn't instantly change them - but at least they would hopefully be working towards a recommendation in here - and people would be patch-welcome if they wanted to add that method to retrieve the merchantReference\r\n\r\nhttps://github.com/thephpleague/omnipay#successful-response\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/thephpleague/omnipay/issues/comments/101305925","html_url":"https://github.com/thephpleague/omnipay/issues/261#issuecomment-101305925","issue_url":"https://api.github.com/repos/thephpleague/omnipay/issues/261","id":101305925,"user":{"login":"judgej","id":395934,"avatar_url":"https://avatars.githubusercontent.com/u/395934?v=3","gravatar_id":"","url":"https://api.github.com/users/judgej","html_url":"https://github.com/judgej","followers_url":"https://api.github.com/users/judgej/followers","following_url":"https://api.github.com/users/judgej/following{/other_user}","gists_url":"https://api.github.com/users/judgej/gists{/gist_id}","starred_url":"https://api.github.com/users/judgej/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/judgej/subscriptions","organizations_url":"https://api.github.com/users/judgej/orgs","repos_url":"https://api.github.com/users/judgej/repos","events_url":"https://api.github.com/users/judgej/events{/privacy}","received_events_url":"https://api.github.com/users/judgej/received_events","type":"User","site_admin":false},"created_at":"2015-05-12T14:45:56Z","updated_at":"2015-05-12T14:45:56Z","body":"Is this the key passed to the merchant site callback, used to look up the transaction in the local storage, i.e. in the database?"}}