500 response "General error" when adding credit card

Getting a “General error” and status code 500 when trying to add a credit card via the REST api.

Reading through other 500 errors experienced by users trying to call different endpoints, I’m guessing this has to do something with a parameter that is missing or isn’t formatted correctly. However, your API docs for this make it appear as though each param is optional and should be passed as a string. There are no formatting examples (like should year be “yy” or “yyyy”). Not helpful.

Also, a response of “General error” is completely useless. :frowning: Please please please use better error messages.

Here is an example of my request:
POST https://api.infusionsoft.com/crm/rest/v1/contacts/{contact_id}/creditCards
Content-Type: application/json
"
{
“card_number”:“1234432112344321”,
“expiration_month”:“08”,
“expiration_year”:“2021”,
“name_on_card”:“John Doe”,
“verification_code”:“123”
}

Can you see what is causing this error?
Thanks

the [contact_id] part of your url has to be a valid contact id…not “[contact_id]”

I’m not very familiar with that particular module, but from a cursory look at the logs it appears that you don’t have a valid address on the credit card data. I would suggest submitting a ticket via https://developer.infusionsoft.com/support/tickets/create/ if this is an unexpected change in behavior, and we’ll prioritize it for work.

Thanks. Appears that adding the address object does work, even though documentation says it’s optional.

For future users looking for an answer, this is the JSON body that worked for me:
{
“address”: {
“zip_code”: “90001”
},
“name_on_card”: “John Doe”,
“email_address”: "john@example.com",
“card_number”: “1234432112344321”,
“expiration_month”: “01”,
“expiration_year”: “2022”,
“verification_code”: “111”
}