Can someone explain why the XML generation in the PHP SDK is messing up?
Here's the SDK method call to createCustomerPaymentProfile():
$authNetCusObj = new AuthorizeNetCIM(); $authorizeDotNetResponse = $authNetCusObj->createCustomerPaymentProfile($custProfId, $formattedRequestData);
Here's the PHP array that's being passed into (which the XML is supposed to get generated from):
$formattedRequestData = array( 'billTo' => array( 'firstName' => 'TestKen', 'lastName' => 'TestBraz', 'address' => '123 Testa Trove', 'city' => 'Hahahah', 'state' => 'Utah', 'zip' => '84440' ), 'payment' => array( 'opaqueData' => array( 'dataDescription' => 'COMMON.ACCEPT.INAPP.PAYMENT', 'dataValue' => trim($data['dataNonce']) ) ) );
Here's the (bad) XML that gets generated in the call:
<?xml version="1.0" encoding="utf-8"?> <createCustomerPaymentProfileRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"> <merchantAuthentication> <name>Protected</name> <transactionKey>Protected</transactionKey> </merchantAuthentication> <customerProfileId>181</customerProfileId> <paymentProfile> <billTo> <0>TestKen</0> </billTo> <billTo> <0>TestBraz</0> </billTo> <billTo> <0>123 Testa Trove</0> </billTo> <billTo> <0>Test City</0> </billTo> <billTo> <0>Test State</0> </billTo> <billTo> <0>84440</0> </billTo> <payment> <dataDescription>COMMON.ACCEPT.INAPP.PAYMENT</dataDescription> <dataValue>eyJjfMl</dataValue> </payment> </paymentProfile> </createCustomerPaymentProfileRequest>
05-12-2017 02:52 PM