function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sravanisravani 

integration of salesforce with authorize.net

Hi,

    i will try to run this class, i got an error like   <?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>

 

Public class callExternalWS 
    { 
        public void invokeExternalWs() 
        { 
            HttpRequest req = new HttpRequest(); 
            //Set HTTPRequest Method 
            req.setMethod('POST'); 
            req.setEndpoint('https://api.authorize.net/soap/v1/Service.asmx'); 
            req.setMethod('POST'); 
            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>8j4W5UyB</name>'+ 
                          '<transactionKey>7mR2ah8655gLSR8q</transactionKey></merchantAuthentication>'+ 
    '<profile><description>description</description>'+ 
                          '<email>sforce2009@gmail.com</email>'+ 
                          '<paymentProfiles>'+ 
                          '<CustomerPaymentProfileType><customerType>individual</customerType>'+ 
    '<payment><creditCard><cardNumber>6011000000000012</cardNumber>'+ 
                          '<expirationDate>2009-12</expirationDate></creditCard>'+ 
                          '</payment></CustomerPaymentProfileType></paymentProfiles></profile>'+ 
                          '</CreateCustomerProfile></soap:Body></soap:Envelope>'; 
            req.setBody(b); 
            Http http = new Http(); 
            try { 
              //Execute web service call here        
              HTTPResponse res = http.send(req);    
              //Helpful debug messages 
              System.debug(res.toString()); 
              System.debug('STATUS:'+res.getStatus()); 
              System.debug('STATUS_CODE:'+res.getStatusCode()); 
              System.debug('STATUS_CODE:'+res.getBody()); 
            //YOU CAN ALWAYS PARSE THE RESPONSE XML USING XmlStreamReader  CLASS 
           } catch(System.CalloutException e) { 
                //Exception handling goes here.... 
         }        
    } 
    }

 

 

 thanks

sravani

RishavRishav
Hi sravani,
                    I also have the same need like you to integrate my salesforce app with Authorize.net.  If you have any doc related with this then please mail me
                  dearrishav1@yahoo.com

Thanks
Rishav
Force TechieForce Techie
Hi Sravani,

Please refer the below link for use integration of SF to Authorize.net.
http://techsahre.blogspot.in/2011/05/authorizenet-apex-library-salesforce.html (http://techsahre.blogspot.in/2011/05/authorizenet-apex-library-salesforce.html" target="_blank)

surendra kumar 7surendra kumar 7
trigger duplicatename on student__c(before insert,before update)
{
list<student__c> stlist=trigger.new;
list<student__c> stnewlist=new list<student__c>();
for(student__c st=stlist)
{
stnewlist=[select id,name from student__C where name=st.name];
if(stnewlist.size()>0)
{
st.adderror('you can't insert/update duplicate records');
}
}
}

Error Error: Compile Error: line breaks not allowed in string literals at line 10 column -1 plzz give me reply
Force TechieForce Techie
Please correct your statement of adding error as per below:
st.adderror('you can\'t insert/update duplicate records');

AshlekhAshlekh
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.

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

Please mark as solution if it helps you.