Creating paypal invoice with agelleye: error 520002 - php

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 .

Related

Prestashop webservice API creating cart rules

Have been trying to create a cart rule using Prestashop web-service with no luck.
Tried this https://github.com/PrestaShop/PrestaShop-webservice-lib/blob/master/examples/Create.php (with cart_rules value replaced away from customers).
But I always get the same error: Property CartRule->name is empty.
Request:
<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<cart_rule>
<id></id>
<id_customer>1</id_customer>
<date_from>2017-09-05 13:00:00</date_from>
<date_to>2020-06-30 13:00:00</date_to>
<description>1</description>
<quantity>1</quantity>
<quantity_per_user>1</quantity_per_user>
<priority>1</priority>
<partial_use>1</partial_use>
<code>11111111111111111111111111111111111111111111111111</code>
<minimum_amount>1</minimum_amount>
<minimum_amount_tax>1</minimum_amount_tax>
<minimum_amount_currency>1</minimum_amount_currency>
<minimum_amount_shipping>1</minimum_amount_shipping>
<country_restriction>1</country_restriction>
<carrier_restriction>1</carrier_restriction>
<group_restriction>1</group_restriction>
<cart_rule_restriction>1</cart_rule_restriction>
<product_restriction>1</product_restriction>
<shop_restriction>1</shop_restriction>
<free_shipping>1</free_shipping>
<reduction_percent>151</reduction_percent>
<reduction_amount>1</reduction_amount>
<reduction_tax>1</reduction_tax>
<reduction_currency>1</reduction_currency>
<reduction_product>1</reduction_product>
<reduction_exclude_special>1</reduction_exclude_special>
<gift_product>1</gift_product>
<gift_product_attribute>1</gift_product_attribute>
<highlight>1</highlight>
<active>1</active>
<date_add>1</date_add>
<date_upd>1</date_upd>
<name>TEST NAME</name>
</cart_rule>
</prestashop>
Response:
<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<errors>
<error>
<code><![CDATA[84]]></code>
<message><![CDATA[Validation error: "Property CartRule->name is empty."]]></message>
</error>
</errors>
</prestashop>
The cart rule name is a multi-language field, so you have to specify the language id.
Try this:
<cart_rule>
...
<name>
<language id="1">TEST NAME</language>
</name>
...
</cart_rule>
Obviously you have to use the right ID language

eBay Trading API AddFixedPriceItem returns 'Input data is invalid. Input data for tag <Item.ShippingDetails> is invalid' error

How to list shipping details in UK or France using eBay AddFixedPriceItem API call? Here is my current code, that returns error:
<?xml version="1.0" encoding="utf-8"?>
<AddFixedPriceItemRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<RequesterCredentials>
<eBayAuthToken>***</eBayAuthToken>
</RequesterCredentials>
<ErrorLanguage>en_US</ErrorLanguage>
<WarningLevel>High</WarningLevel>
<Item>
<Country>UK</Country>
<Currency>GBP</Currency>
<ShippingDetails>
<ShippingType>Flat</ShippingType>
<ShippingServiceOptions>
<ShippingServicePriority>1</ShippingServicePriority>
<ShippingService>DHLExpressWorldwide</ShippingService>
<FreeShipping>true</FreeShipping>
<ShippingServiceAdditionalCost currencyID="EUR">0.00</ShippingServiceAdditionalCost>
</ShippingServiceOptions>
</ShippingDetails>
<Site>UK</Site>
</Item>
</AddFixedPriceItemRequest>
The correct value to use in the ShippingService field is UK_DHLExpressWorldwide

Authorize.net Update recurrent billing using ARB

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>

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>

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