I'm trying to create a subscription, but my Customer ID is apparently too long. I'm using a Base64 encoded string of the user's account GUID, which is 24 chars long. I've read that the max length is 50, so IDK why I would be getting this error.
E00003:The 'AnetApi/xml/v1/schema/AnetApiSchema.xsd:id' element is invalid - The value 'XkqdN7wJ5kyo7nq/ygDQ7A==' is invalid according to its datatype 'String' - The actual length is greater than the MaxLength value.
The code I'm using is as follows:
var bytes = Guid.Parse(user.Id).ToByteArray(); var encoded = Convert.ToBase64String(bytes); _customer = new customerType() { type = customerTypeEnum.individual, id = encoded, email = user.Email }; ... ARBSubscriptionType subscriptionType = new ARBSubscriptionType() { name = "Test Base", amount = amount, trialAmount = 0.00m, paymentSchedule = schedule, billTo = _addressInfo, customer = _customer, payment = cc }; var request = new ARBCreateSubscriptionRequest { subscription = subscriptionType }; var controller = new ARBCreateSubscriptionController(request); controller.Execute(); // This has the error
What is the max length for an ID, and is there any way to stuff a GUID in there?
Solved! Go to Solution.
08-02-2016 08:19 PM
Hello @joe_coolish
Checkin the API Reference, the maximum length for merchantCustomerId is 20 characters:
merchantCustomerId | Merchant assigned ID for the customer. Required only when no values for description and email are submitted. |
Up to 20 characters.
|
Richard
08-02-2016 09:28 PM
Hello @joe_coolish
Checkin the API Reference, the maximum length for merchantCustomerId is 20 characters:
merchantCustomerId | Merchant assigned ID for the customer. Required only when no values for description and email are submitted. |
Up to 20 characters.
|
Richard
08-02-2016 09:28 PM
I have been reading through all of the stuff on GitHub, I guess I should be looking through that sub as well!
Thanks for the heads up!
08-03-2016 06:27 AM