1
votes

I am trying to integrate my application with Sagepay, using the Server Integration Protocol. I have written my code in JAVA and currently I am at the point where I'm sending a POST to Sagepay to be redirected to their payment page. However, I get a blank screen which is a result of an Error 400 (Bad Request).

In their documentation, they specifically state that:

The data should be sent as URL Encoded Name=Value pairs separated with & characters and sent to the Sage Pay Server URL with a Service name set to the message type in question.

The URL that I have constructed is this: https://test.sagepay.com/gateway/service/vspserver-register.vsp&VPSProtocol=3.00&TxType=PAYMENT&Vendor=foovendor&VendorTxCode=foovendor-1459865650735-78597&Amount=10&Currency=GBP&Description=This+is+the+description&NotificationURL=http%3A%2F%2Fwww.google.com&BillingSurname=foosurname&BillingFirstnames=fooname&BillingAddress1=fooaddress&BillingCity=foocity&BillingPostCode=foopc&BillingCountry=UK&DeliverySurname=fooname&DeliveryFirstnames=foosurname&DeliveryAddress1=fooaddr&DeliveryCity=foocity&DeliveryPostCode=foopc&DeliveryCountry=UK&CustomerEMail=foo%40foo.com

What am I missing?

Thanks for your help!

1
echoing @jr593 . URL params imply a GET rather then a POST.Uri Mikhli

1 Answers

1
votes

Your url doesn't setup the query string properly. Ithink that

register.vsp&VPSProtocol

should be

register.vsp?VPSProtocol

I.E. Question mark instead of ampersand.

Also, you said a post was required, but pasting that url in a browser will send a GET request, won't it ?