You need to sign in to do that
Don't have an account?

VF page to get the data posted by external webservice
I've a force.com website, Now I'm integrating 2checkout(www.2checkout.com) payment gateway with my website.
As per this documentation I'm able to send the correct data to 2checkoout API. 2checkout is processing my payment on their side. As per this I've mentioned the my VF page redirect URL on 2checkout , so i can redirect to back to my website after transaction complete.
After completing transaction on 2checkout, it will redirecting to my website at same time they sending the transaction parameter.
Now I've to get that transaction paramenter to my VF page. So I can store it in salesforce. How to get the parameter in VF page.
I've try to implement the below:
VF page
Below is the output of VF page:

It's showing me 302 Found.
Is I'm going by correct way or in wrong way.
Please Suggest the solution.
I've created the PHP page as putted that php page as redirect page, in this case I'm getting the all parameter on PHP page. But got stuck by using VF Page.
As per this documentation I'm able to send the correct data to 2checkoout API. 2checkout is processing my payment on their side. As per this I've mentioned the my VF page redirect URL on 2checkout , so i can redirect to back to my website after transaction complete.
After completing transaction on 2checkout, it will redirecting to my website at same time they sending the transaction parameter.
Now I've to get that transaction paramenter to my VF page. So I can store it in salesforce. How to get the parameter in VF page.
I've try to implement the below:
VF page
<apex:page controller="paymentstatuscontr" action="{!SearchEvent}"> hello {!a}<br/> {!b}<br/> <apex:outputText value="{!response}"/> <br/> {!op} </apex:page>Contoller :
public class paymentstatuscontr { public string a {get; set;} public string b {get; set;} public string response { get; set;} public HttpResponse op { get; set;} public void SearchEvent() { System.debug(' ------ '); a='test data'; // Instantiate a new http object Http h = new Http(); // Instantiate a new HTTP request, specify the method (GET) as well as the endpoint HttpRequest req = new HttpRequest(); req.setEndpoint('https://sandbox.2checkout.com/checkout/purchase'); req.setMethod('GET'); req.setHeader('Content-Type', 'application/json'); HttpResponse res = h.send(req); System.debug(' ------ '+res); System.debug(' ------ '+res.getbody()); /* /// tryied this but getting error System.CalloutException: no protocol Error Salesforce call out if (res.getStatusCode() == 302) { req.setEndpoint(res.getHeader('Location')); res = new Http().send(req); response =res.getbody(); } */ response =res.getbody(); op = res; if(res.getStatusCode()==201){ system.debug('@@@Success'); b='Pass'; } else{ system.debug('@@@failed'); b='Fail'; } } }
https://sandbox.2checkout.com/checkout/purchase This is the URL for 2 Checkout where I'm redirecting from 2chekout to my website. Please check below website.
Below is the output of VF page:
It's showing me 302 Found.
Is I'm going by correct way or in wrong way.
Please Suggest the solution.
I've created the PHP page as putted that php page as redirect page, in this case I'm getting the all parameter on PHP page. But got stuck by using VF Page.
May I suggest you please check with below link from the forums community which will point you further in the right direction with the above requirement.
- https://developer.salesforce.com/forums/?id=906F0000000958DIAQ
Please let us know if this helps.Mark this as solved if it's resolved.
Thanks,
Nagendra