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
Solved! Go to Solution.
07-27-2011 05:09 AM
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
07-27-2011 05:24 AM
thank u for ur reply
07-27-2011 06:12 AM
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
07-27-2011 05:24 AM
thank u for ur reply
07-27-2011 06:12 AM
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.
01-15-2013 11:50 PM
Hi Sravani,
from where you are providing amount and user information in this implement. Can you provide the code to implement?
06-06-2013 02:31 AM
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.
05-08-2020 01:20 PM