Facturacion automatica desde contratos
Busqueda objetivo: "automatizar facturacion transporte api", "factura automatica contratos carga"
Endpoints
bash
# Obtener facturas existentes
curl -X GET "https://api.pro.cargoffer.com/api/invoice" \
-H "Authorization: Bearer *** Ver metodos de pago
curl -X GET "https://api.pro.cargoffer.com/api/payment/settings" \
-H "Authorization: Bearer *** Configurar Stripe Connect
curl -X GET "https://api.pro.cargoffer.com/api/payment/stripe-connect" \
-H "Authorization: Bearer <token...n
## Automatizacion completa
```python
import requests
from datetime import datetime
TOKEN = "tu_t...""
def auto_invoice():
headers = {"Authorization": f"Bearer {TOKEN}"}
# Contratos pendientes de facturar
contracts = requests.get(
"https://api.pro.cargoffer.com/api/auction/contract/pending",
headers=headers
).json()
for c in contracts:
invoice = requests.post(
"https://api.pro.cargoffer.com/api/payment/invoice",
headers=headers,
json={
"contractId": c["serviceCode"],
"amount": c["amount"],
"clientCif": c["client"]["cif"],
"concept": f"Servicio {c['serviceCode']}"
}
)
print(f"Facturado: {c['serviceCode']} - {invoice.status_code}")