cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Bad XML generation (from PHP array) in createCustomerPaymentProfile method call

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>
jima
Regular Contributor
6 REPLIES 6

Hello,

 

The question was asked and answered in another thread.  https://community.developer.authorize.net/t5/Integration-and-Testing/Unclear-basic-workflow-document...

 

Richard

RichardH
Administrator Administrator
Administrator

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.

jima
Regular Contributor

@jima

 

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.

 

Richard

Can you please provide an example of that? That would really be what would help here.

jima
Regular Contributor

Bump. Can you please provide examples?

jima
Regular Contributor

Is there any hope is some follow-up here? Examples of your suggested work-around would be very useful.

jima
Regular Contributor