Credit Memo Api Post method issue

We are trying to create a Credit Memo but keeps getting a below error.

Status Code: 400.

You cannot apply 0 or a negative amount to an invoice balance.invoice_id: 0; amount_to_apply: 0. invoice_id: 0; amount_to_apply: 0.


I am able to create a credit memo but then it does not get applied to invoices.


Can you please help us in this issue.

Comments

  • Hi Nitin,

    From this little bit of information, it looks like you're trying to provide id 0 and amount 0 when creating the credit memo.

    Are you supplying the full credit memo contract and expecting an invoice_id of 0 to just inherently not try to apply to anything? We explicitly throw that error if any application info is sent with a zero amount or less. If you want to achieve quick success here, what happens when you set the application data to null?


    Thanks!
  • I am getting above error when sending below request


    {

    "credit_memo_id":0,

    "vendor_id":75,

    "vendor_name":"",

    "date":"5/8/2020 12:00:00 AM",

    "amount":2000.0,

    "credit_applied":0.0,

    "credit_remaining":0.0,

    "credit_memo_number":"90001",

    "description":"Supplies",

    "status":"",

    "post_status":"DoNotPost",

    "post_date":"5/8/2020 12:00:00 AM",

    "distributions":[

    {

    "distribution_id":0,

    "distribution_splits":[

    {

    "distribution_split_id":0,

    "ui_project_id":"9999",

    "transaction_code_values":[

    {

    "name":"MV/CV",

    "value":"Carrying Value",

    "id":1

    }

    ],

    "amount":2000.0,

    "percent":100.0,

    "account_class":"Unrestricted Net Assets"

    }

    ],

    "amount":2000.0,

    "description":"",

    "account_number":"01-2010-00",

    "type_code":"Debit"

    },

    {

    "distribution_id":0,

    "distribution_splits":[

    {

    "distribution_split_id":0,

    "ui_project_id":"9999",

    "transaction_code_values":[

    {

    "name":"MV/CV",

    "value":"Carrying Value",

    "id":1

    }

    ],

    "amount":2000.0,

    "percent":100.0,

    "account_class":"Unrestricted Net Assets"

    }

    ],

    "amount":2000.0,

    "description":"",

    "account_number":"01-2010-00",

    "type_code":"Credit"

    }

    ],

    "custom_fields":[


    ],

    "applied_invoice":[


    ],

    "invoices":[

    {

    "AmountToApply":1200.0,

    "InvoiceId":2598,

    "PostDate":"5/8/2020 12:00:00 AM"

    },

    {

    "AmountToApply":800.0,

    "InvoiceId":2599,

    "PostDate":"5/8/2020 12:00:00 AM"

    }

    ],

    "invoice_applications":[

    {

    "invoice_id":2598,

    "invoice_number":"",

    "invoice_amount":1200.0,

    "invoice_balance":1200.0,

    "credit_memo_amount_applied":1200.0,

    "post_status":"",

    "post_date":"5/8/2020 12:00:00 AM"

    },

    {

    "invoice_id":2599,

    "invoice_number":"",

    "invoice_amount":800.0,

    "invoice_balance":800.0,

    "credit_memo_amount_applied":800.0,

    "post_status":"",

    "post_date":"5/8/2020 12:00:00 AM"

    }

    ],

    "form_1099_box_numbers":[


    ],

    "date_added":"",

    "date_modified":"",

    "added_by":"",

    "modified_by":""

    }




    And I can create a Credit memo but Invoices do not get applied when sending below request.


    {

    "credit_memo_id":0,

    "vendor_id":75,

    "vendor_name":"",

    "date":"5/8/2020 12:00:00 AM",

    "amount":2000.0,

    "credit_applied":0.0,

    "credit_remaining":0.0,

    "credit_memo_number":"90001",

    "description":"Supplies",

    "status":"",

    "post_status":"DoNotPost",

    "post_date":"5/8/2020 12:00:00 AM",

    "distributions":[

    {

    "distribution_id":0,

    "distribution_splits":[

    {

    "distribution_split_id":0,

    "ui_project_id":"9999",

    "transaction_code_values":[

    {

    "name":"MV/CV",

    "value":"Carrying Value",

    "id":1

    }

    ],

    "amount":2000.0,

    "percent":100.0,

    "account_class":"Unrestricted Net Assets"

    }

    ],

    "amount":2000.0,

    "description":"",

    "account_number":"01-2010-00",

    "type_code":"Debit"

    },

    {

    "distribution_id":0,

    "distribution_splits":[

    {

    "distribution_split_id":0,

    "ui_project_id":"9999",

    "transaction_code_values":[

    {

    "name":"MV/CV",

    "value":"Carrying Value",

    "id":1

    }

    ],

    "amount":2000.0,

    "percent":100.0,

    "account_class":"Unrestricted Net Assets"

    }

    ],

    "amount":2000.0,

    "description":"",

    "account_number":"01-2010-00",

    "type_code":"Credit"

    }

    ],

    "custom_fields":[


    ],

    "applied_invoice":[


    ],

    "invoices":[

    {

    "AmountToApply":1200.0,

    "InvoiceId":2598,

    "PostDate":"5/8/2020 12:00:00 AM"

    },

    {

    "AmountToApply":800.0,

    "InvoiceId":2599,

    "PostDate":"5/8/2020 12:00:00 AM"

    }

    ],

    "invoice_applications":[


    ],

    "form_1099_box_numbers":[


    ],

    "date_added":"",

    "date_modified":"",

    "added_by":"",

    "modified_by":""

    }



    I hope this helps. Let me know if you need more details.
  • Hi Nitin,

    We have identified an issue in the CreateCreditMemo request example object where invoice_applications was erroneously labeled invoices . The documentation has been updated with an accurate invoice_applications example. Also looking at the request payloads you sent, you're sending credit_memo_amount_applied rather than credit_memo_amount_to_apply. That request should be updated. Hope this helps!

Categories