Reply
Contributor
Posts: 24
Registered: ‎02-24-2017

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>
Posts: 2,251
Topics: 51
Kudos: 151
Blog Posts: 64
Registered: ‎12-05-2011

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

Hello,

 

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

 

Richard

--------

Webhooks are now available for Authorize.Net

Using SOAP, see our deprecation notice.
Check out Accept.js, our Javascript replacement for DPM.
Pro Tip: Never use test mode in the sandbox, instead use the Testing Guide.
Contributor
Posts: 24
Registered: ‎02-24-2017

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

[ Edited ]

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.

Posts: 2,251
Topics: 51
Kudos: 151
Blog Posts: 64
Registered: ‎12-05-2011

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

@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

--------

Webhooks are now available for Authorize.Net

Using SOAP, see our deprecation notice.
Check out Accept.js, our Javascript replacement for DPM.
Pro Tip: Never use test mode in the sandbox, instead use the Testing Guide.
Contributor
Posts: 24
Registered: ‎02-24-2017

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

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

Contributor
Posts: 24
Registered: ‎02-24-2017

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

Bump. Can you please provide examples?

Contributor
Posts: 24
Registered: ‎02-24-2017

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

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