Authorize.net Update recurrent billing using ARB - php

Does Authorize.net ARP API accept XML data if the data field is empty ? Do we need to have the data on all the XML elements ?
I used the following XML for updating the subscription.
<?xml version="1.0" encoding="utf-8"?>
<ARBUpdateSubscriptionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
<merchantAuthentication>
<name>435345345345</name>
<transactionKey>sdfsdfsdfsdf</transactionKey>
</merchantAuthentication>
<refId>155969e50PGj</refId>
<subscriptionId>234324</subscriptionId>
<subscription>
<amount>75</amount>
<customer>
<id>155969</id>
<email></email>
<phoneNumber></phoneNumber>
</customer>
<billTo>
<firstName></firstName>
<lastName></lastName>
<company></company>
<address></address>
<city></city>
<state></state>
<zip></zip>
<country></country>
</billTo>
<shipTo>
<firstName></firstName>
<lastName></lastName>
<company></company>
<address></address>
<city></city>
<state></state>
<zip></zip>
<country></country>
</shipTo>
</subscription>
</ARBUpdateSubscriptionRequest>
I got the following error :
<?xml version="1.0" encoding="utf-8"?>
<ARBUpdateSubscriptionResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
<refId>155969e50PGj</refId>
<messages>
<resultCode>Error</resultCode>
<message>
<code>E00014</code>
<text>Bill-To First Name is required.</text>
</message>
<message>
<code>E00014</code>
<text>Bill-To Last Name is required.</text>
</message>
</messages>
</ARBUpdateSubscriptionResponse>

ARBUpdateSubscriptionRequest is required other XML in request
<?xml version="1.0" encoding="utf-8"?>
<ARBUpdateSubscriptionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
<merchantAuthentication>
<name>mytestacct</name>
<transactionKey>112223344</transactionKey>
</merchantAuthentication>
<refId>Sample</refId>
<subscriptionId>100748</subscriptionId>
<subscription>
<payment>
<creditCard>
<cardNumber>4111111111111111</cardNumber>
<expirationDate>2010-08</expirationDate>
</creditCard>
</payment>
</subscription>
</ARBUpdateSubscriptionRequest>

Related

How can I get a Payment Token when using Cybersource SOAP API

So I have a test payment with the Cybersource SOAP API like below but I'm not able to get it to return a payment token that I can use for payments in future without using the credit card details each times:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken>
<wsse:Username>{{merchant_id}}</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">{{SOAP KEY}}</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<requestMessage xmlns="urn:schemas-cybersource-com:transaction-data-1.150">
<merchantID>{{merchant_id}}</merchantID>
<merchantReferenceCode>kjdhflasjfhlasdjfasdf</merchantReferenceCode>
<billTo>
<firstName>John</firstName>
<lastName>Doe</lastName>
<street1>1295 Charleston Road</street1>
<city>Mountain View</city>
<state>CA</state>
<postalCode>94043</postalCode>
<country>US</country>
<email>null#cybersource.com</email>
</billTo>
<item id="0">
<unitPrice>5.00</unitPrice>
<quantity>1</quantity>
</item>
<item id="1">
<unitPrice>10.00</unitPrice>
<quantity>2</quantity>
</item>
<purchaseTotals>
<currency>ZMW</currency>
</purchaseTotals>
<card>
<accountNumber>4111111111111111</accountNumber>
<expirationMonth>11</expirationMonth>
<expirationYear>2020</expirationYear>
<cvNumber>123</cvNumber>
</card>
<ccAuthService run="true"/>
</requestMessage>
</soapenv:Body>
</soapenv:Envelope>
Add the following to your request:
<recurringSubscriptionInfo>
<frequency>on-demand</frequency>
</recurringSubscriptionInfo>
<paySubscriptionCreateService run="true"/>
Your new request will look like this:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken>
<wsse:Username>{{merchantID}}</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">{{SOAPKey}}</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<requestMessage xmlns="urn:schemas-cybersource-com:transaction-data-1.150">
<merchantID>{{merchantID}}</merchantID>
<merchantReferenceCode>kjdhflasjfhlasdjfasdf</merchantReferenceCode>
<billTo>
<firstName>John</firstName>
<lastName>Doe</lastName>
<street1>1295 Charleston Road</street1>
<city>Mountain View</city>
<state>CA</state>
<postalCode>94043</postalCode>
<country>US</country>
<email>null#cybersource.com</email>
</billTo>
<item id="0">
<unitPrice>5.00</unitPrice>
<quantity>1</quantity>
</item>
<item id="1">
<unitPrice>10.00</unitPrice>
<quantity>2</quantity>
</item>
<purchaseTotals>
<currency>ZMW</currency>
</purchaseTotals>
<card>
<accountNumber>4111111111111111</accountNumber>
<expirationMonth>11</expirationMonth>
<expirationYear>2020</expirationYear>
<cvNumber>123</cvNumber>
</card>
<recurringSubscriptionInfo>
<frequency>on-demand</frequency>
</recurringSubscriptionInfo>
<ccAuthService run="true"/>
<paySubscriptionCreateService run="true"/>
</requestMessage>
</soapenv:Body>
</soapenv:Envelope>
The response will now have a subscriptionID in it, that is your token to use in place of the card account number. You might find the tokenization guide useful.
You should not expose your merchantID and SOAP Key here. Please edit your question to remove them.

Creating paypal invoice with agelleye: error 520002

i get an error, 520002 - Internal Error from PayPal, when I try to create and send an invoice.
I can do it with ci-merchant but no with angelleye (for codeigniter). When I try to create it I get this errors:
<?xml version="1.0" encoding="utf-8"?>
<CreateAndSendInvoiceRequest xmlns="http://svcs.paypal.com/types/ap">
<requestEnvelope xmlns="">
<detailLevel>ReturnAll</detailLevel>
<errorLanguage>en_US</errorLanguage>
</requestEnvelope>
<invoice xmlns="">
<merchantEmail xmlns="">lalanzaos#gmail.com</merchantEmail>
<payerEmail xmlns="">oscar73#gmail.com</payerEmail>
<itemList xmlns="">
<item xmlns="">
<name xmlns="">Clases de idiomas (Español)</name>
<description xmlns="">Dia/s: 2014-08-08</description>
<date xmlns="">2014-08-22</date>
<quantity xmlns="">1</quantity><unitPrice xmlns="">11.00</unitPrice>
</item>
</itemList>
<currencyCode xmlns="">USD</currencyCode>
<invoiceDate xmlns="">2014-08-22</invoiceDate>
<dueDate xmlns="">2014-08-22</dueDate>
<referrerCode xmlns="">AngellEYE_PHPClass</referrerCode>
</invoice>
</CreateAndSendInvoiceRequest>
<?xml version='1.0' encoding='UTF-8'?>
<ns3:FaultMessage xmlns:ns3="http://svcs.paypal.com/types/common" xmlns:ns2="http://svcs.paypal.com/types/pt">
<responseEnvelope>
<timestamp>2014-08-22T04:12:25.170-07:00</timestamp>
<ack>Failure</ack>
<correlationId>87f10d36a1e29</correlationId>
<build>11737381</build>
</responseEnvelope>
<error>
<errorId>520002</errorId>
<domain>PLATFORM</domain>
<subdomain>Application</subdomain>
<severity>Error</severity>
<category>Application</category>
<message>Internal Error</message>
</error>
</ns3:FaultMessage>
It seems that the date format is not being correctly passed . It should be like below :
<invoiceDate xmlns="">2014-08-23T22:33:35</invoiceDate>
<dueDate xmlns="">2014-08-24T22:33:35</dueDate>
It should be working fine with this formatting .

UPS Shipping API - ShipmentConfirmRequest Error

Hello I am creating a wordpress website for a client using WooCommerce. The site is complete but the client wants the ability to create shipments from the shop_order page. I have most of this figured out, the problem is my XML request to the UPS API. I have checked and recheck, and I cant seem to find the error:
<ShipmentConfirmResponse><Response><ResponseStatusCode>0</ResponseStatusCode><ResponseStatusDescription>Failure</ResponseStatusDescription><Error><ErrorSeverity>Hard</ErrorSeverity><ErrorCode>10002</ErrorCode><ErrorDescription>The XML document is well formed but the document is not valid</ErrorDescription></Error></Response></ShipmentConfirmResponse>
Below is my xml mark up with sensitive info hidden.
<?xml version="1.0" ?>
<AccessRequest xml:lang='en-US'>
<AccessLicenseNumber>******</AccessLicenseNumber>
<UserId>********</UserId>
<Password>********</Password>
</AccessRequest>
<?xml version="1.0" ?>
<ShipConfirmRequest xml:lang='en-US'>
<Request>
<TransactionReference>
<CustomerContext>Customer Context</CustomerContext>
<XpciVersion>1.0</XpciVersion>
</TransactionReference>
<RequestAction>ShipConfirm</RequestAction>
<RequestOption>validate</RequestOption>
</Request>
<Shipment>
<Shipper>
<ShipperNumber>*******</ShipperNumber>
<Name>Canyon Werks, LLC</Name>
<Address>
<AddressLine>2941 Brookspark Drive</AddressLine>
<AddressLine></AddressLine>
<City>North Las Vegas</City>
<StateProvinceCode>NV</StateProvinceCode>
<PostalCode>89030</PostalCode>
<CountryCode>US</CountryCode>
</Address>
<Phone>
<Number>7022552222</Number>
</Phone>
</Shipper>
<ShipTo>
<Name>Justin Walker</Name>
<Address>
<AddressLine>2675 Windmill Pkwy</AddressLine>
<AddressLine>3024</AddressLine>
<City>Henderson</City>
<StateProvinceCode>NV</StateProvinceCode>
<PostalCode>89074</PostalCode>
<CountryCode>US</CountryCode>
</Address>
<Phone>
<Number>7024609485</Number>
</Phone>
</ShipTo>
<ShipFrom>
<Name>Canyon Werks, LLC</Name>
<Address>
<AddressLine>2941 Brookspark Drive</AddressLine>
<AddressLine></AddressLine>
<City>North Las Vegas</City>
<StateProvinceCode>NV</StateProvinceCode>
<PostalCode>89030</PostalCode>
<CountryCode>US</CountryCode>
</Address>
<Phone>
<Number>7022552222</Number>
</Phone>
</ShipFrom>
<PaymentInformation>
<ShipmentCharge>
<Type>01</Type>
<BillShipper>
<AccountNumber>*******</AccountNumber>
</BillShipper>
</ShipmentCharge>
</PaymentInformation>
<Service>
<Code>03</Code>
</Service>
<Package>
<Packaging>
<Code>02</Code>
<Description>Customer Supplied</Description>
</Packaging>
<Dimensions>
<UnitOfMeasurement>
<Code>IN</Code>
</UnitOfMeasurement>
<Length>16</Length>
<Width>12</Width>
<Height>6</Height>
</Dimensions>
<PackageWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>6.07</Weight>
</PackageWeight>
</Package>
</Shipment>
<LabelSpecification>
<LabelImageFormat>
<Code>GIF</Code>
</LabelImageFormat>
</LabelSpecification>
</ShipConfirmRequest>
I am almost there on this, but I am stuck at this road block. If anyone can shed some light into this it would be much appreciated.
It was the service code container it must be included in the package container. I had it before it. Took me quite a while to figure out this dumb mistake on my part.
Before:
...
<Service>
<Code>03</Code>
</Service>
<Package>
...
After:
...
<Package>
<Service>
<Code>03</Code>
</Service>
...
Thanks for the help, and yes UPS requires a strange XML format.
The XML processing instruction appears twice:
<?xml version="1.0" ?>
This indicates the presence of two distinct XML documnents:
<?xml version="1.0" ?>
<AccessRequest xml:lang='en-US'>
<AccessLicenseNumber>******</AccessLicenseNumber>
<UserId>********</UserId>
<Password>********</Password>
</AccessRequest>
and
<?xml version="1.0" ?>
<ShipConfirmRequest xml:lang='en-US'>
<Request>
<TransactionReference>
<CustomerContext>Customer Context</CustomerContext>
<XpciVersion>1.0</XpciVersion>
</TransactionReference>
<RequestAction>ShipConfirm</RequestAction>
<RequestOption>validate</RequestOption>
</Request>
<!-- ... -->
</ShipConfirmRequest>

Pass data from array into variable PHP

I'm getting an array as parameter for example
$data = array ( 'name' => 'makis', 'pw' => 'sovara');
And i want to complete the below variable $nxml with the data from the array i got. 'name' and 'pw'.
$nxml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0
epp-1.0.xsd">
<command>
<login>
<clID>$data['name']</clID>
<pw>$data['pw']</pw>
<options>
<version>1.0</version>
<lang>en</lang>
</options>
<svcs>
<objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
<objURI>urn:ietf:params:xml:ns:contact-1.0</objURI>
<objURI>urn:ietf:params:xml:ns:domain-1.0</objURI>
</svcs>
</login>
<clTRID>nick-12345</clTRID>
</command>
</epp>';
What is the correct way for this cause i keep getting erros
You can try this:
$nxml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0
epp-1.0.xsd">
<command>
<login>
<clID>'.$data['name'].'</clID> //your original code <clID>$data['name']</clID> see the difference?
<pw>'.$data['pw'].'</pw> //same thing here
<options>
<version>1.0</version>
<lang>en</lang>
</options>
<svcs>
<objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
<objURI>urn:ietf:params:xml:ns:contact-1.0</objURI>
<objURI>urn:ietf:params:xml:ns:domain-1.0</objURI>
</svcs>
</login>
<clTRID>nick-12345</clTRID>
</command>
</epp>';
You need to escape ' properly to make it work.
Make it like this:
$nxml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0
epp-1.0.xsd">
<command>
<login>
<clID>'.$data['name'].'</clID>
<pw>'.$data['pw'].'</pw>
<options>
<version>1.0</version>
<lang>en</lang>
</options>
<svcs>
<objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
<objURI>urn:ietf:params:xml:ns:contact-1.0</objURI>
<objURI>urn:ietf:params:xml:ns:domain-1.0</objURI>
</svcs>
</login>
<clTRID>nick-12345</clTRID>
</command>
</epp>';
Single quotes don't work in this case. if you want to display value of the variable use double quotes but that leads you to use escaping for symbols so I recommend you to use concatenation with single quotes to avoid complexity.
$nxml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0
epp-1.0.xsd">
<command>
<login>
<clID>'.$data['name'].'</clID>
<pw>'.$data['pw'].'</pw>
<options>
<version>1.0</version>
<lang>en</lang>
</options>
<svcs>
<objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
<objURI>urn:ietf:params:xml:ns:contact-1.0</objURI>
<objURI>urn:ietf:params:xml:ns:domain-1.0</objURI>
</svcs>
</login>
<clTRID>nick-12345</clTRID>
</command>
</epp>';
Try like
$nxml = '....<clID>'.$data['name'].'</clID>
<pw>'.$data['pw'].'</pw>....';
Then your entire code will be
$nxml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0
epp-1.0.xsd">
<command>
<login>
<clID>'.$data['name'].'</clID>
<pw>'.$data['pw'].'</pw>
<options>
<version>1.0</version>
<lang>en</lang>
</options>
<svcs>
<objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
<objURI>urn:ietf:params:xml:ns:contact-1.0</objURI>
<objURI>urn:ietf:params:xml:ns:domain-1.0</objURI>
</svcs>
</login>
<clTRID>nick-12345</clTRID>
</command>
</epp>';
Try like this.Because your esacping is not correct
$data = array ( 'name' => 'makis', 'pw' => 'sovara');
$nxml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0
epp-1.0.xsd">
<command>
<login>
<clID>$data["name"]</clID>
<pw>$data["pw"]</pw>
<options>
<version>1.0</version>
<lang>en</lang>
</options>
<svcs>
<objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
<objURI>urn:ietf:params:xml:ns:contact-1.0</objURI>
<objURI>urn:ietf:params:xml:ns:domain-1.0</objURI>
</svcs>
</login>
<clTRID>nick-12345</clTRID>
</command>
</epp>';
try this :
<clID>"'.$data['name'].'"</clID>
<pw>"'.$data['pw'].'"</pw>
try this
<clID>"'.$data['name'].'"</clID>
<pw>"'.$data['pw'].'"</pw>

Pulling values from CIM - authorize.net

I've got my script worked out to grab information from the CIM:
$content =
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" .
"<getCustomerProfileRequest xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\">" .
merchantAuthenticationBlock().
"<customerProfileId>$cid</customerProfileId>" .
"</getCustomerProfileRequest>";
$response = send_xml_request($content);
$parsedresponse = parse_api_response($response);
So how, now, do I write the returned value to a variable?
I've tried:
$customerPaymentProfileId = $parsedresponse->customerPaymentProfileId;
$customerShippingAddressId = $parsedresponse->customerShippingAddressId;
But this returns the variables empty. I feel like I'm missing something simple.
To see the structure of $parsedresponse do either print_r($parsedresponse) or var_dump($parsedresponse). From there you can see how the array is structured and get your values from there.
FYI, the payment profiles are in an array so you will need to loop through them to get their values. Assuming parsedresponse is the root XML node you can get them like this:
foreach ($parsedresponse->profile->paymentProfiles as $profile)
{
echo $profile->customerPaymentProfileId;
}
FYI, this is a sample array structure for this response (From the AuthnetXML Sample Code. I am the author of this library):
<?xml version="1.0" encoding="utf-8"?>
<getCustomerProfileResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
<messages>
<resultCode>Ok</resultCode>
<message>
<code>I00001</code>
<text>Successful.</text>
</message>
</messages>
<profile>
<merchantCustomerId>12345</merchantCustomerId>
<email>user#example.com</email>
<customerProfileId>5427896</customerProfileId>
<paymentProfiles>
<billTo>
<firstName>John</firstName>
<lastName>Smith</lastName>
<address>123 Main Street</address>
<city>Townsville</city>
<state>NJ</state>
<zip>12345</zip>
<phoneNumber>800-555-1234</phoneNumber>
</billTo>
<customerPaymentProfileId>4796541</customerPaymentProfileId>
<payment>
<creditCard>
<cardNumber>XXXX1111</cardNumber>
<expirationDate>XXXX</expirationDate>
</creditCard>
</payment>
</paymentProfiles>
<paymentProfiles>
<billTo>
<firstName>John</firstName>
<lastName>Doe</lastName>
<company/>
<address>123 Main St.</address>
<city>Bellevue</city>
<state>WA</state>
<zip>98004</zip>
<country>USA</country>
<phoneNumber>800-555-1234</phoneNumber>
<faxNumber>800-555-1234</faxNumber>
</billTo>
<customerPaymentProfileId>4796585</customerPaymentProfileId>
<payment>
<creditCard>
<cardNumber>XXXX1111</cardNumber>
<expirationDate>XXXX</expirationDate>
</creditCard>
</payment>
</paymentProfiles>
<shipToList>
<firstName>John</firstName>
<lastName>Smith</lastName>
<address>123 Main Street</address>
<city>Townsville</city>
<state>NJ</state>
<zip>12345</zip>
<phoneNumber>800-555-1234</phoneNumber>
<customerAddressId>4907537</customerAddressId>
</shipToList>
<shipToList>
<firstName>John</firstName>
<lastName>Doe</lastName>
<company/>
<address>123 Main St.</address>
<city>Bellevue</city>
<state>WA</state>
<zip>98004</zip>
<country>USA</country>
<phoneNumber>800-555-1234</phoneNumber>
<faxNumber>800-555-1234</faxNumber>
<customerAddressId>4907591</customerAddressId>
</shipToList>
</profile>
</getCustomerProfileResponse>

Categories