Reply
Highlighted
Member
Posts: 4
Registered: ‎07-27-2011
Accepted Solution

inegration of authorize.net with salesforce

Hi,

       i write a following class in salesforce for integration of salesforce with authorize.net.

 

 

 

Public class callExternalWS

 {

     public void invokeExternalWs()  

    {

         HttpRequest req = new HttpRequest();

   req.setMethod('POST');

   req.setEndpoint('https://api.authorize.net/soap/v1/Service.asmx');

 req.setHeader('Content-Type', 'text/xml; charset=utf-8');

 req.setHeader('SOAPAction', 'https://api.authorize.net/soap/v1/CreateCustomerProfile');

 string b ='<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><CreateCustomerProfile xmlns="https://api.authorize.net/soap/v1/"><merchantAuthentication><name>4eU6Z2uy</name><transactionKey>74kZnM38y6PCz2x7</transactionKey></merchantAuthentication><profile><merchantCustomerId>98765421</merchantCustomerId><description>sample merchant</description><email>sravni_g@dskvap.com</email><paymentProfiles><CustomerPaymentProfileType><customerType>individual</customerType><payment><creditCard><cardNumber>6011000000000012</cardNumber><expirationDate>2012-12</expirationDate></creditCard></payment></CustomerPaymentProfileType></paymentProfiles></profile></CreateCustomerProfile></soap:Body></soap:Envelope>';   

       req.setBody(b);

         Http http = new Http();   

      try {   

                   HTTPResponse res = http.send(req);            

           System.debug(res.toString());

           System.debug('STATUS:'+res.getStatus());  

          System.debug('STATUS_CODE:'+res.getStatusCode()); 

        System.debug('response:'+res.getBody());    

        }

catch(System.CalloutException e)

{    

  }      

  }  }

 

 

 

 

i got a response message like this

 

 

 

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><CreateCustomerProfileResponse xmlns="https://api.authorize.net/soap/v1/"><CreateCustomerProfileResult><resultCode>Error</resultCode><messages><MessagesTypeMessage><code>E00007</code><text>User authentication failed due to invalid authentication values.</text></MessagesTypeMessage></messages><customerProfileId>0</customerProfileId></CreateCustomerProfileResult></CreateCustomerProfileResponse></soap:Body></soap:Envelope>

 

 

how to fix this one.

 can any one help me.

 

thanks in advance


Accepted Solutions
Highlighted
Solution
Accepted by topic author sravani
‎08-21-2015 01:58 AM
Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: inegration of authorize.net with salesforce

Sound like your are trying to use test account loginID and TransactionKey to the production server.

Change your post location to the test server https://apitest.authorize.net/soap/v1/Service.asmx

View solution in original post

Highlighted
Solution
Accepted by topic author sravani
‎08-21-2015 01:58 AM
Member
Posts: 4
Registered: ‎07-27-2011

Re: inegration of authorize.net with salesforce

thank u for ur reply

View solution in original post


All Replies
Highlighted
Solution
Accepted by topic author sravani
‎08-21-2015 01:58 AM
Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: inegration of authorize.net with salesforce

Sound like your are trying to use test account loginID and TransactionKey to the production server.

Change your post location to the test server https://apitest.authorize.net/soap/v1/Service.asmx

Highlighted
Solution
Accepted by topic author sravani
‎08-21-2015 01:58 AM
Member
Posts: 4
Registered: ‎07-27-2011

Re: inegration of authorize.net with salesforce

thank u for ur reply

Highlighted
Contributor
Posts: 35
Registered: ‎01-15-2013

Re: inegration of authorize.net with salesforce

Can anyone guide me up in integration of authroize.net with salesforce.I have created an Merchant account in authorize.net.Need Guidance in integration with salesforce

 

 

 

Thanks,

Atif.

Highlighted
Member
Posts: 2
Registered: ‎06-06-2013

Re: inegration of authorize.net with salesforce

Hi Sravani,

 

 from where you are providing amount and user information in this implement. Can you provide the code to implement?

 

Highlighted
Member
Posts: 1
Registered: ‎05-08-2020

Re: inegration of authorize.net with salesforce

Hi I did integration with authorize.net but using XML not soap if you want help on XML way than I can. And what error you getting.

And I saw in your code you have setheader 

req.setHeader('Content-Type', 'text/xml; charset=utf-8');

instead of 

req.setHeader('Content-Type', 'application/soap+xml charset=utf-8');

Below is the link which help you.

api.authorize.net/soap/vi/Service.asmx?op=ARBUpdateSubscription

Please mark as solution if it helps you.