cancel
Showing results for 
Search instead for 
Did you mean: 

Error E00003 while testing json post

I'm testing using the same data in the docs, but was trying to figure out the minimum data needed. But I'm not getting that far.

 

If I post 

{
  "createTransactionRequest": {
    "merchantAuthentication": {
      "name": "7YJ9A2pkC98", 
      "transactionKey": "28S7jjRAvAYa953d"
    }, 
    "refId": "123456", 
    "transactionRequest": {
      "amount": 5, 
      "billTo": {
        "address": "15 Main Street", 
        "city": "Pecan Springs", 
        "company": "none", 
        "firstName": "Ellen", 
        "lastName": "Johnson", 
        "state": "TX", 
        "zip": "44628"
      }, 
      "payment": {
        "cardCode": "999", 
        "cardNumber": "5424000000000015", 
        "expirationDate": "1220"
      }, 
      "transactionSettings": {
        "setting": {
          "settingName": "testRequest", 
          "settingValue": "false"
        }
      }, 
      "transactionType": "authCaptureTransaction"
    }
  }
}

 

I get back:

{
  "messages": {
    "message": [
      {
        "code": "E00003", 
        "text": "The element 'createTransactionRequest' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has invalid child element 'refId' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'. List of possible elements expected: 'merchantAuthentication' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'."
      }
    ], 
    "resultCode": "Error"
  }
}

It looks to me that refId is supposed to be an element in createTransactionRequest - it is in the sample and it is in my test.. 

 

I'm hoping there's a typo you might see that I didn't.

 

Thanks.

 

leehinde
Contributor
Contributor
3 REPLIES 3

This is weird. I got past the above error by rearrainging how I built the json in the tool I'm using.

{
  "createTransactionRequest": {
    "merchantAuthentication": {
      "name": "7YJ9A2pkC98", 
      "transactionKey": "28S7jjRAvAYa953d"
    }, 
    "refId": "123456", 
    "transactionRequest": {
      "amount": 5, 
      "billTo": {
        "address": "15 Main Street", 
        "city": "Pecan Springs", 
        "company": "none", 
        "firstName": "Ellen", 
        "lastName": "Johnson", 
        "state": "TX", 
        "zip": "44628"
      }, 
      "payment": {
        "creditCard": {
          "cardCode": "999", 
          "cardNumber": "5424000000000015", 
          "expirationDate": "1220"
        }
      }, 
      "transactionSettings": {
        "setting": {
          "settingName": "testRequest", 
          "settingValue": "false"
        }
      }, 
      "transactionType": "authCaptureTransaction"
    }
  }
}

Same resulting json, but now it got past that error and then found a real error (I hadn't built the payment object correctly).

 

The documentation implies (with a dot) that refID should be an element of the merchantAuthentication object, but the sample code, which works, doesn't build it that way.

 

Now it's complaining that the billTo isn't expected as part of the transactionRequest. It want's userFields.

 

{
	"messages": {
		"resultCode": "Error",
		"message": [
			{
				"code": "E00003",
				"text": "The element 'transactionRequest' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has invalid child element 'billTo' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'. List of possible elements expected: 'userFields' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'."
			}
		]
	}
}

What I'm learning is that (like a lot of code) what the error says may not be what the error means.

 

I get a successful transaction if I take out the billTo.

 

 

leehinde
Contributor
Contributor

That look more like the xml error. On the xml, the node sequence have to be exact.

Yes, it looks like XML based errors. I'm guessing there's some sort of translation going on. With JSON the order isn't supposed to be significant.

 

It's returning Content-Type: application/json; charset=utf-8 in the response and that's what I'm sending.