I want to integrate paypal in salesforce by using Rest API.

Can u guys give me any of sample code(sandbox) for DODirectPayment to do that.

4 Answers 4


this link will give you the basic idea of integration..but this was SOAP implementation. so you need to read the rest architecture first on force.com platform and then start analyse


1) Setup one sandbox account.

2) Test Merchant Account API Setup

3) Run and Test

I think this is the answer for ur question

  • I used same code which was provided by thus site....but i am getting bad request <H1>Invalid URL</H1> The requested URL "&#47;2&#46;0&#47;", is invalid.<p> Reference&#32;&#35;9&#46;1be0fc7d&#46;1387859543&#46;2ac5deb4
    – Sunny
    Commented Dec 24, 2013 at 6:39
  • System.XmlException: ParseError at [row,col]:[7,3] Message: The element type "p" must be terminated by the matching end-tag "</p>".
    – Sunny
    Commented Dec 24, 2013 at 6:39
  • I am getting same error as some one posted(second last) in the site.
    – Sunny
    Commented Dec 24, 2013 at 6:43

Do have a look at paypalX toolkit


  • Hi this link is for package, i need to do that by sending request from controller to paypal using REST with one controller
    – Sunny
    Commented Dec 24, 2013 at 6:37
  • 2
    Sravan maybe you can elaborate your answer a bit ? What is this toolkit, and what part of it may be relevant here ? (just so that some usefull information is present here) Commented Dec 24, 2013 at 6:52
  • Paypal toolkit helps to use paypal payment Apis,the link itself is from developer force and i think you can see a demo and a tutorial in the same page.Just see through it once,if that helps with your requirement then try to implement it...if you are struck up at any part you can post here for a help...
    – user4971
    Commented Dec 24, 2013 at 6:58

Please do the following step:

  1. Setup one sandbox account.
  2. Test Merchant Account API Setup
  3. Run and Test




I have written two blog posts on the process of intergrating Paypal with Salesforce, and presented this case at DF12.

You can find the integration and the code samples on a GIT repository for a SOAP integration of the Paypal MassPay API here:

Salesforce - Paypal Masspay Integration

and you can find a blog post on utilising the IPN confirmation messages (relevant to almost all Paypal payment processes) here:

Salesforce Paypal IPN integration

  • 1
    Simon, your articles are really helpful but I am wondering if you can point me in the right direction regarding how to send payment data from paypal to SalesForce, rather than the other way around? I am trying to have donations made in Paypal be recorded in SalesForce. Thank you!
    – TheLibzter
    Commented Dec 30, 2014 at 13:36
  • Hi @TheLibzter - I've received your query e-mail over at Desynit. thanks for getting in touch! I'm on a client site all day today, but will make sure I liaise with work tomorrow and get back to you! cheers. Commented Jan 6, 2015 at 13:07

Not the answer you're looking for? Browse other questions tagged .