私はこのようなものを見てきました。あなたがやろうとしていることを多かれ少なかれ実行し、問題が発生しなかった例を作成したので、コードと比較するためにここに投稿しました. うまくいけば、それはあなたにとって役に立ちます:
<?php
require('../../config.inc.php');
require('../../AuthnetXML.class.php');
$xml = new AuthnetXML(AUTHNET_LOGIN, AUTHNET_TRANSKEY, AuthnetXML::USE_DEVELOPMENT_SERVER);
$xml->createCustomerProfileRequest(array(
'profile' => array(
'merchantCustomerId' => '87658',
'email' => 'user@example.com',
'paymentProfiles' => array(
'billTo' => array(
'firstName' => 'John',
'lastName' => 'Smith',
'address' => '123 Main Street',
'city' => 'Townsville',
'state' => 'NJ',
'zip' => '12345',
'phoneNumber' => '800-555-1234'
),
'payment' => array(
'creditCard' => array(
'cardNumber' => '4111111111111111',
'expirationDate' => '2016-08',
),
),
),
'shipToList' => array(
'firstName' => 'John',
'lastName' => 'Smith',
'address' => '123 Main Street',
'city' => 'Townsville',
'state' => 'NJ',
'zip' => '12345',
'phoneNumber' => '800-555-1234'
),
),
'validationMode' => 'liveMode'
));
$profile_id = $xml->customerProfileId;
$payment_profile_id = $xml->customerPaymentProfileIdList->numericString;
$shipping_profile_id = $xml->customerShippingAddressIdList->numericString;
$xml = new AuthnetXML(AUTHNET_LOGIN, AUTHNET_TRANSKEY, AuthnetXML::USE_DEVELOPMENT_SERVER);
$xml->createCustomerProfileTransactionRequest(array(
'transaction' => array(
'profileTransAuthCapture' => array(
'amount' => '10.95',
'customerProfileId' => $profile_id,
'customerPaymentProfileId' => $payment_profile_id,
'customerShippingAddressId' => $shipping_profile_id,
'order' => array(
'invoiceNumber' => 'INV000001',
'description' => 'description of transaction',
'purchaseOrderNumber' => 'PONUM000001'
),
'taxExempt' => 'false',
'recurringBilling' => 'false',
'cardCode' => '000'
)
),
'extraOptions' => '<![CDATA[x_customer_ip=100.0.0.1]]>'
));
echo $xml;
?>
送受信された XML は次のとおりです。
createCustomerProfileRequest
<?xml version="1.0"?>
<createCustomerProfileRequest>
<merchantAuthentication>
<name>cnpdev4289</name>
<transactionKey>SR2P8g4jdEn7vFLQ</transactionKey>
</merchantAuthentication>
<profile>
<merchantCustomerId>87658</merchantCustomerId>
<email>user@example.com</email>
<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>
<payment>
<creditCard>
<cardNumber>4111111111111111</cardNumber>
<expirationDate>2016-08</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>
</shipToList>
</profile>
<validationMode>liveMode</validationMode>
</createCustomerProfileRequest>
<?xml version="1.0" encoding="utf-8"?>
<createCustomerProfileResponse>
<messages>
<resultCode>Ok</resultCode>
<message>
<code>I00001</code>
<text>Successful.</text>
</message>
</messages>
<customerProfileId>11234435</customerProfileId>
<customerPaymentProfileIdList>
<numericString>10232106</numericString>
</customerPaymentProfileIdList>
<customerShippingAddressIdList>
<numericString>10454653</numericString>
</customerShippingAddressIdList>
<validationDirectResponseList>
<string>1,1,1,This transaction has been approved.,0ZSYP6,Y,2180917446,none,Test transaction for ValidateCustomerPaymentProfile.,0.00,CC,auth_only,87658,John,Smith,,123 Main Street,Townsville,NJ,12345,,800-555-1234,,user@example.com,,,,,,,,,0.00,0.00,0.00,FALSE,none,CE4F0E75B0703C40FE109A7B0B2E0575,,2,,,,,,,,,,,XXXX1111,Visa,,,,,,,,,,,,,,,,</string>
</validationDirectResponseList>
</createCustomerProfileResponse>
createCustomerProfileTransactionRequest
<?xml version="1.0"?>
<createCustomerProfileTransactionRequest>
<merchantAuthentication>
<name>cnpdev4289</name>
<transactionKey>SR2P8g4jdEn7vFLQ</transactionKey>
</merchantAuthentication>
<transaction>
<profileTransAuthCapture>
<amount>10.95</amount>
<customerProfileId>11234435</customerProfileId>
<customerPaymentProfileId>10232106</customerPaymentProfileId>
<customerShippingAddressId>10454653</customerShippingAddressId>
<order>
<invoiceNumber>INV000001</invoiceNumber>
<description>description of transaction</description>
<purchaseOrderNumber>PONUM000001</purchaseOrderNumber>
</order>
<taxExempt>false</taxExempt>
<recurringBilling>false</recurringBilling>
<cardCode>000</cardCode>
</profileTransAuthCapture>
</transaction>
<extraOptions><![CDATA[x_customer_ip=100.0.0.1]]></extraOptions>
</createCustomerProfileTransactionRequest>
<?xml version="1.0" encoding="utf-8"?>
<createCustomerProfileTransactionResponse>
<messages>
<resultCode>Ok</resultCode>
<message>
<code>I00001</code>
<text>Successful.</text>
</message>
</messages>
<directResponse>1,1,1,This transaction has been approved.,S6HDI6,Y,2180917449,INV000001,description of transaction,10.95,CC,auth_capture,87658,John,Smith,,123 Main Street,Townsville,NJ,12345,,800-555-1234,,user@example.com,John,Smith,,123 Main Street,Townsville,NJ,12345,,,,,FALSE,PONUM000001,F0FA82F73AA206A4D7D956E98AF97725,P,2,,,,,,,,,,,XXXX1111,Visa,,,,,,,,,,,,,,,,,10454653,100.0.0.1]]></directResponse>
</createCustomerProfileTransactionResponse>