How can I extract the invoice payment url using the API?
I tried looking in the json I got from getting the invoice ID and the invoice reference - neither seemed to contain the online url which the order json does contain.
However one you made the invoice the order payment url will not work - even if the invoice is unpaid
found this issue for orders which I copied to invoices
opened 07:40AM - 29 Mar 22 UTC
closed 12:47PM - 01 Apr 22 UTC
Feature request
### Feature Request
I can't find any API entry to get online_payment_url for an… order or invoice ?
### Use case
Get details of an order via API and make a link to online payment
### Suggested implementation
Here is a "solution" for orders, if it's a good idea i could send a patch / MR, let me know.
htdocs/commande/class/api_orders.class.php near line 234
```PHP
while ($i < $min) {
$obj = $this->db->fetch_object($result);
$commande_static = new Commande($this->db);
if ($commande_static->fetch($obj->rowid)) {
// Add external contacts ids
$commande_static->contacts_ids = $commande_static->liste_contact(-1, 'external', 1);
//erics : add payment link
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
$commande_static->online_payment_url = getOnlinePaymentUrl(0, 'order', $commande_static->ref);
$obj_ret[] = $this->_cleanObjectDatas($commande_static);
}
$i++;
}
```
### Suggested steps
_No response_
1 Like