Intel Coffee Lake 8th-gen Core processors release date rumours
I'm building an e-commerce site which has to integrate with a payment provider not on the supported list of the scripts I am using. As such I must manually integrate rather than have the luck of using a Dreamweaver wizard.
So far I've build the cart and all is fine, and I know where I need to send the http post to so that the payment gateway can do its magic. However, on completion of the transaction the payment gateway sends my back a response which a script (that I have to write) will parse. The details in this response include all details from the payment, whether it has been successful etc. I combine this with session variables (which includes details of the purchase) and insert into a database and send a mail informing customers and merchants that a transaction has taken place.
Except - how do I parse this string that is sent back? Never done this before - don't know where to start! Am using Dreamweaver if that makes things any easier.
This is the example they provide in the documentation:
VPResponseCode=00&VPCrossReference=04100514165800502449&VPMessage=AUTHCODE:00502&VPTransactionUnique=VP ORDER-123456789&VPOrderDesc=VPORDER-123456789&VPBillingCountry=826&VPCardName=Test CardName&VPBillingPostCode=HA67HJ&VPBillingEmail=[email protected]&VPBillingPhoneNumber=0208 9770657&VPAmountReceived=1299&VPAVSCV2ResponseCode=222100&VPCV2ResultMessage=CV2 Matched&VPAVSResultMessage=PostcodeMatched&VPAVSAddressMessage=Address Numeric Matched&VPCardType=VD&VPBillingAddress=Unit 5 Pickwick Walk 120 Uxbridge Road Hatch End Middlesex
Thanks for your help
That looks like a normal 'name – value pair' string, that is sent via the get or post methods (I guess the finance house would use POST). So you could extract the data using:
However I’d use a function:
foreach($form_array as $name => $value)
$GLOBALS[$name] = $value;
//call the function with
This will result in the variables:
(in this case, having the values:
This is a very useful function, I use it for form handling all the time. It works just as well for GET.
Hope this helps....
Just picked up your response. Will have a look through it and try it over the weekend with a couple of beers (well, always works for me!).
I appreciate the time you've spend on this, so thanks a lot - I'll let you know how it goes.
This thread is now locked and can not be replied to.