- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Error E00003 The element 'subscription' in namespace 'AnetApi/sml/v1/schema/AnetApiSchema.xsd' has invalid child element 'cusotmer' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'. List of possible elements expected: 'shipTo', profile' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.
Getting this error when trying to add an ARB subscription. We're not using profiles, but according to the API docs, "customer" should be a valid sub element of "subscription".
https://developer.authorize.net/api/reference/#recurring-billing-create-a-subscription
Full code:
<?php ... public function create_subscription($transaction) { global $custom_options; if(isset($transaction) and $transaction instanceof Transaction) { $usr = $transaction->user(); $prd = $transaction->product(); $sub = $transaction->subscription(); } else { throw new CustomGatewayException( 'Payment was unsuccessful, please check your payment details and try again.' ); } $invoice = $this->create_new_order_invoice($sub); // Default to 9999 for infinite occurrences $total_occurrences = $sub->limit_cycles ? $sub->limit_cycles_num : 9999; $args = array( "refId" => $invoice, "subscription" => array( "name" => $prd->post_title, "paymentSchedule" => array( "interval" => $this->arb_subscription_interval($sub), "startDate" => Utils::get_date_from_ts((time() + (($sub->trial)?Utils::days($sub->trial_days):0)), 'Y-m-d'), "totalOccurrences" => $total_occurrences, ), "amount" => Utils::format_float($sub->total), "payment" => array( "creditCard" => array( "cardNumber" => sanitize_text_field($_POST['custom_cc_num']), "expirationDate" => sanitize_text_field($_POST['custom_cc_exp_month']) . '-' . sanitize_text_field($_POST['custom_cc_exp_year']), "cardCode" => sanitize_text_field($_POST['custom_cvv_code']) ) ), "order" => array( "invoiceNumber" => $invoice, "description" => $prd->post_title ), "billTo" => array( "firstName" => $usr->first_name, "lastName" => $usr->last_name ), "customer" => array( "email" => $usr->user_email ) ) ); if($custom_options->show_address_fields && $custom_options->require_address_fields) { $args['subscription']['billTo'] = array_merge($args['subscription']['billTo'], array("address" => str_replace('&', '&', get_user_meta($usr->ID, 'custom-address-one', true)), "city" => get_user_meta($usr->ID, 'custom-address-city', true), "state" => get_user_meta($usr->ID, 'custom-address-state', true), "zip" => get_user_meta($usr->ID, 'custom-address-zip', true), "country" => get_user_meta($usr->ID, 'custom-address-country', true))); } $res = $this->send_arb_request('ARBCreateSubscriptionRequest', $args); ... protected function send_arb_request($method, $args, $http_method = 'post') { $args = array_merge( array( "merchantAuthentication" => array( "name" => $this->settings->login_name, "transactionKey" => $this->settings->transaction_key ) ), $args ); $content = $this->arb_array_to_xml($method, $args); $remote_array = array('method' => strtoupper($http_method), 'timeout' => 30, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => true, 'headers' => array('content-type' => 'application/xml'), 'body' => $content, 'cookies' => array()); $response = wp_remote_post('https://api2.authorize.net/xml/v1/request.api', $remote_array); ...
Is the (https://api2.authorize.net/xml/v1/request.api) endpoint the problem?
Thanks for any help!
Solved! Go to Solution.
08-14-2019 01:03 PM
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So you are creating XML with that. In your code below, I think it is the customer and billTo properties being out of order.
$args = array( "refId" => $invoice, "subscription" => array( "name" => $prd->post_title, "paymentSchedule" => array( "interval" => $this->arb_subscription_interval($sub), "startDate" => Utils::get_date_from_ts((time() + (($sub->trial)?Utils::days($sub->trial_days):0)), 'Y-m-d'), "totalOccurrences" => $total_occurrences, ), "amount" => Utils::format_float($sub->total), "payment" => array( "creditCard" => array( "cardNumber" => sanitize_text_field($_POST['custom_cc_num']), "expirationDate" => sanitize_text_field($_POST['custom_cc_exp_month']) . '-' . sanitize_text_field($_POST['custom_cc_exp_year']), "cardCode" => sanitize_text_field($_POST['custom_cvv_code']) ) ), "order" => array( "invoiceNumber" => $invoice, "description" => $prd->post_title ), "billTo" => array( "firstName" => $usr->first_name, "lastName" => $usr->last_name ), "customer" => array( "email" => $usr->user_email ) ) );
you are getting this error:
error E00003 The element 'subscription' in namespace 'AnetApi/sml/v1/schema/AnetApiSchema.xsd' has invalid child element 'customer' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'. List of possible elements expected: 'shipTo', profile' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.
Because the next child element following billTo is shipTo, but your request gives customer. Put customer after order and billTo after customer and it should work.
09-03-2019 03:56 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Renaissance any ideas? I've tried different endpoints, but I can't seem to get around the Email required error. I disabled email as required in the Form Fields, but the processor must be requiring the email. So we have to provide the email.
08-27-2019 10:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The customer object is a direct property of the TransactionRequestType. Try that and it should work.
08-29-2019 03:44 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2019 04:13 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I do not use ARB and was thinking that subscription was under a transaction request. I am not sure about your endpoint. I would have to look it up. I would say if you’re getting a response you are fine. I’m leaving breakfast now and will be busy all day, but I’ll look at your code again tomorrow morning or maybe later tonight. You should be able to pass the customer.
08-30-2019 04:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The error message has "cusotmer" where your code says "customer"?
customer is a child of subscription.
08-30-2019 06:01 PM - edited 08-30-2019 06:02 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2019 04:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sometimes simple spelling mistakes can generate this kind of errors. Recently this literally happened with me and It took more than 2 hours to solve that problem.
09-01-2019 03:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I had to type the error manually as it was given to me in a screenshot. I made a typo there. The code is correctly using "customer" and the error message is correctly reflecting "customer" as well. Just a typo in the OP is all. Screenshot: http://cspf.co/fb4c81da8add
09-03-2019 08:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2019 02:04 PM

