I want to paid invoice with api
I have a validated invoice (invoice id = 29)
How pay with a api ?
This exemple doesn’t work :
http://myurl_dolibar_api/invoices/29/pay
payload :
Mode de règlement : Chèque
Numéro : numéro du chèque
Emetteur : Olivier Brochard
Banque : LCL
Montant : 468 €
Note :
related topic :
www.dolibarr.org/t/validate-an-invoice-with-api/15865/1
Hi.
I suggest you look a the api explorer first. It will allow you to perform api calls and shows you the correct urls. _https://your_dolibarr/api/index.php/explorer
Basically, there are two ways for submitting a payment.
1. Add payment line to a specific invoice with the remain to pay as amount.
The following is a linux command line example. (don’t if it will work on windows)
curl -X POST --header ‘Content-Type: application/json’ --header ‘Accept: application/json’ --header 'DOLAPIKEY: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -d ‘{
“datepaye”: “string”,
“paiementid”: 0,
“closepaidinvoices”: “yes”,
“accountid”: 0,
“num_paiement”: “string”,
“comment”: “string”,
“chqemetteur”: “string”,
“chqbank”: “string”
}’ ‘https://your_dolibarr/api/index.php/invoices/31/payments’
2. Add a payment to pay partially or completely one or several invoices
curl -X POST --header ‘Content-Type: application/json’ --header ‘Accept: application/json’ --header ‘DOLAPIKEY: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx’ -d ‘{
“arrayofamounts”: {
“invoiceid”:“amount”},
“datepaye”: “string”,
“paiementid”: 0,
“closepaidinvoices”: “yes”,
“accountid”: 0,
“num_paiement”: “string”,
“comment”: “string”,
“chqemetteur”: “string”,
“chqbank”: “string”
}’ ‘https://your_dolibarr/api/index.php/invoices/paymentsdistributed’
NOTE in both methods “accountid” = id of the bank account, and “paiementid” = id of the payment type (Mode de règlement)
Hope that helps
1 Like