I have a custom payment provider set up and everything works fantastically. Orders are processed and sent to the payment gateway and come back on the ProcessCallback() and are finalized. All is great.
Except for one thing that I can't figure out.
This payment gateway I'm using needs a confirmation sent back to say I have received the callback ok (yes, really).
So essentially, I need to see what they post in the callback and send it back again.
All the info that I have is
"The gateway will post to the specified call-back URL over HTTP(s). The
call-back data will be sent in the HTTP request body as XML. As this
is being sent as XML the HTTP header will also be set to XML : -
Content Type “text/xml”
The ProcessCallback() has a HttpRequestBase parameter that I'm currently trying to use to read the data. I've tried a lot of things and currently am exploring the InputStream but it's empty. ContentLength is 0 too.
Is it possible that it's been read before it gets to this ProcessCallback() function? Can I "intercept" it before it reaches that function?
I'd be very thankful for any ideas on how to get this done.
The HttpRequestBase that is given to ProcessCallback should be the exact current request from HttpContex.Current and shouldn't be processed by us in any way prior to sending it to the payment provider as the whole purpose of the ProcessCallback is to essentially say "here, you handle it".
If the content length is 0, then really it means no content is present. Even if the stream had already been read, it would still have a length and generally you could reset the stream reader to read it again, so it sounds more like the body isn't there.
Are you sure you've got them notifying the callback URL? and not one of the other URLs we pass you, such as the continue URL? Those do perform a redirect so those could loose the data if that's the case.
thanks for the quick reply.
According to their docs they're using the thing I give them in the callbackUrl and I've double and triple checked it, that's the correct Url.
I've already had a suspicion that it might be them not sending the actual content but I didn't want to "accuse" them of anything if I just needed to process it a bit differently.
It's good to have confirmation that the incoming request is unprocessed.
Only other possible thing I could think is happening is if there are any redirects at play. If they post to a URL that then causes a redirect, the post body may not come along for the ride.
Maybe check to see if it looks like this could be the case. Also double checking the URLs given by Vendr are https prefixed (could be a http redirect)
Reading request body on ProcessCallback()
Hi there,
I have a custom payment provider set up and everything works fantastically. Orders are processed and sent to the payment gateway and come back on the ProcessCallback() and are finalized. All is great.
Except for one thing that I can't figure out. This payment gateway I'm using needs a confirmation sent back to say I have received the callback ok (yes, really).
So essentially, I need to see what they post in the callback and send it back again. All the info that I have is
The ProcessCallback() has a HttpRequestBase parameter that I'm currently trying to use to read the data. I've tried a lot of things and currently am exploring the InputStream but it's empty. ContentLength is 0 too.
Is it possible that it's been read before it gets to this ProcessCallback() function? Can I "intercept" it before it reaches that function?
I'd be very thankful for any ideas on how to get this done.
Hi Finn
The
HttpRequestBase
that is given toProcessCallback
should be the exact current request fromHttpContex.Current
and shouldn't be processed by us in any way prior to sending it to the payment provider as the whole purpose of theProcessCallback
is to essentially say "here, you handle it".If the content length is 0, then really it means no content is present. Even if the stream had already been read, it would still have a length and generally you could reset the stream reader to read it again, so it sounds more like the body isn't there.
Are you sure you've got them notifying the callback URL? and not one of the other URLs we pass you, such as the continue URL? Those do perform a redirect so those could loose the data if that's the case.
Matt
Hi Matt,
thanks for the quick reply. According to their docs they're using the thing I give them in the callbackUrl and I've double and triple checked it, that's the correct Url.
I've already had a suspicion that it might be them not sending the actual content but I didn't want to "accuse" them of anything if I just needed to process it a bit differently.
It's good to have confirmation that the incoming request is unprocessed.
Thanks for that!
Only other possible thing I could think is happening is if there are any redirects at play. If they post to a URL that then causes a redirect, the post body may not come along for the ride.
Maybe check to see if it looks like this could be the case. Also double checking the URLs given by Vendr are https prefixed (could be a http redirect)
Matt
Hi Matt, thanks for that. the https/http redirect is something I hadn't considered yet!
thanks!
is working on a reply...