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>
No, it wasn't "answered" in the other thread, The question was re-asked, by me, because no one was responding to this one. But it wasn't answered in the other thread either, so ANY help would be wildly appreciated.
Aaron mentioned that what you are attempting to do with our SDK isn't possible unless you can install composer and it's dependencies. Since that is not possible in your scenario, your other option is to write directly to the API using XML or JSON.