AuthorizeNet / sample-code-php

This repository contains working code samples which demonstrate php integration with the Authorize.Net API
MIT License
175 stars 197 forks source link

profileTransAuthCapture invalid child element 'customerProfileId' in namespace #157

Open TerrePorter opened 4 years ago

TerrePorter commented 4 years ago

So I have this random error showing up that I can't seem to figure out, since the profileTransAuthCapture request does have a customerProfileId in the examples I find.

The error:

The element 'profileTransAuthCapture' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has invalid child element 'customerProfileId' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'. List of possible elements expected: 'amount' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.

The code is basically from https://github.com/AuthorizeNet/sdk-php/blob/9ebe3336e470a0510f942f344e9d3277b3e73549/doc/CIM.markdown#creating-transactions

// Create Auth & Capture Transaction
$transaction = new AuthorizeNetTransaction;
$transaction->amount = "9.79";
$transaction->customerProfileId = $customerProfileId;
$transaction->customerPaymentProfileId = $paymentProfileId;
$transaction->customerShippingAddressId = $customerAddressId;
     (it doesn't have the line items)
$response = $request->createCustomerProfileTransaction("AuthCapture", $transaction);
$transactionResponse = $response->getTransactionResponse();

This only seems to happen sometimes. Any suggestions, other than upgrade the code lol that is in the works.