Saf-t PT Suportado

InvoiceXpress API

debit_notes.change-state

Changes the state of an debit note.

Possible state transitions:

  • draft to final – finalized
  • draft to deleted – deleted
  • settled to final – unsettled
  • final to second copy – second_copy
  • final or second copy to canceled – canceled
  • final or second copy to settled – settled

Any other transitions will fail.

When canceling an invoice you must specify a reason.

You call this method by submitting a HTTP PUT request to the following URL :

https://:screen-name.invoicexpress.net/debit_notes/:debit-note-id/change-state.xml

Example xml to be submitted with the updated invoice data:

<?xml version="1.0" encoding="UTF-8"?>
<invoice>
 <state>canceled</state>
 <message>Canceled due to amount of money</message>
</invoice>

<invoice>
 <state>finalized</state>
</invoice>

Parameters

Parameters are the data you will pass with the call.

api_key

Your secret identifier. You find your API Key under Account Overview in the Account section.
Rules: Required

debit-note-id

Id of the invoice to change state.
Rules: Required

state

State which the invoice will be changed to. Options are:

  • finalized
  • second_copy
  • canceled
  • settled
  • unsettled

Rules: Required

message

Reason for cancelling the document.
Rules: Required when state is “canceled”, otherwise ignored.

Return Values

This is the result that will be passed back to you.

Success

HTTP: 200 OK

Error

HTTP: 401 Access denied
The API Key parameter is missing or is incorrectly entered.


HTTP: 404 Not Found
No debit note matches the :debit-note-id supplied.


HTTP: 422 Unprocessable Entity
Some of the parameters were incorrect.

Possible errors:

<?xml version="1.0" encoding="UTF-8"?>
<errors>
 <error>No content type or wrongly specified.</error>
</errors>
<?xml version="1.0" encoding="UTF-8"?>
<errors>
 <error>Invalid state</error>
</errors>
<?xml version="1.0" encoding="UTF-8"?>
<errors>
 <error>Cancel message can't be blank</error>
</errors>