Endeve - Developers Area

Payments

If you want to register a payment on an sale, you have to do it through payments’ interface.

All attributes are mandatory. Payment methods accepted in endeve are Transfer, Font, Cash, Check, Credit card, Bank receipt, Promissory notes or Other.

The payment date cannot be later than the current date.

Payments are a nested resource on sales, so request URLs will always start with /sales/#{sale-id}.

CREATE

POST /sales/#{sale-id}/payments

Creates a new payment.

REQUEST

<payment>
<amount type=“decimal”>977.5</amount>
<date type=“datetime”>2010-03-27</date>
<id type=“integer”>33573</id>
<payment-method>Transfer</payment-method>
</payment>

RESPONSE

Status: 201 Location: /sales/#{sale-id}

The XML of the sale is returned on a successful request.

The creation of a payment can change the status of an sale. If after recording the payment, the outstanding amount is equal or inferior to 0, the state of the sale is set to paid. If the amount is superior to 0, the sale status is set to outstanding.

DESTROY

DELETE /sales/#{sale-id}/payments/#{id-payment}

Deletes the payment at the referenced URL.

RESPONSE

Status: 200

The deletion of a payment can change the status of an sale. If after recording the payment, the outstanding amount is equal or inferior to 0, the state of the sale is set to paid. If the amount is superior to 0, the sale status is set to outstanding.