---
updatedAt: 2026-08-28T22:30:16.000Z
agentTools:
  projectIndex: https://developer.wafeq.com/llms.txt
---

# Quote to cash

Create a customer quote, convert it to an invoice, and record the payment without losing the accounting trail.

# Quote to cash

A quote-to-cash integration carries the same customer and commercial context from the first quote through the paid invoice.

## Workflow

| Step                    | Endpoint                                                                                  | Result                        |
| ----------------------- | ----------------------------------------------------------------------------------------- | ----------------------------- |
| 1. Resolve the customer | [List contacts](/reference/contacts_list) or [Create contact](/reference/contacts_create) | Customer contact ID           |
| 2. Create the quote     | [Create quote](/reference/quotes_create)                                                  | Quote ID                      |
| 3. Convert it           | [Convert quote to invoice](/reference/quotes_invoice_create)                              | Invoice ID                    |
| 4. Record receipt       | [Create payment](/reference/payments_create)                                              | Payment linked to the invoice |
| 5. Confirm balances     | [Retrieve invoice](/reference/invoices_retrieve)                                          | Updated balance and status    |

## Create the quote

A quote can include its line items in the initial request:

```bash
curl --request POST "https://api.wafeq.com/v1/quotes/" \
  --header "Authorization: Api-Key <API_KEY>" \
  --header "Content-Type: application/json" \
  --header "X-Wafeq-Idempotency-Key: quote-<ORDER_ID>" \
  --data '{
    "contact": "<CUSTOMER_CONTACT_ID>",
    "currency": "AED",
    "quote_date": "2026-08-29",
    "quote_number": "Q-1042",
    "reference": "ORDER-1042",
    "external_id": "order_1042",
    "tax_amount_type": "TAX_EXCLUSIVE",
    "line_items": [
      {
        "description": "Annual subscription",
        "quantity": 1,
        "unit_amount": 1200,
        "tax_rate": "<TAX_RATE_ID>"
      }
    ]
  }'
```

Use **external\_id** for your stable source identifier. Use the idempotency header for retry protection; they solve different problems.

You can also add or update lines through the [Quote line items](/reference/quote-line-items) endpoints.

## Convert the accepted quote

After the customer accepts the quote:

```bash
curl --request POST "https://api.wafeq.com/v1/quotes/<QUOTE_ID>/invoice/" \
  --header "Authorization: Api-Key <API_KEY>" \
  --header "Content-Type: application/json"
```

The response is the new invoice. Store both the quote ID and invoice ID so users can move between the source order and its accounting document.

## Record the customer payment

Resolve a payment-enabled account first, then create the payment:

```bash
curl --request POST "https://api.wafeq.com/v1/payments/" \
  --header "Authorization: Api-Key <API_KEY>" \
  --header "Content-Type: application/json" \
  --header "X-Wafeq-Idempotency-Key: payment-<PAYMENT_ID>" \
  --data '{
    "amount": 1260,
    "currency": "AED",
    "date": "2026-09-02",
    "paid_through_account": "<BANK_OR_GATEWAY_ACCOUNT_ID>",
    "contact": "<CUSTOMER_CONTACT_ID>",
    "external_id": "pay_1042",
    "invoice_payments": [
      {
        "invoice": "<INVOICE_ID>",
        "amount": 1260,
        "amount_to_pcy": 1260
      }
    ]
  }'
```

For cross-currency payments, follow the payment schema for **amount**, **amount\_to\_pcy**, and **exchange\_rate** rather than assuming a one-to-one conversion.

## Production checks

* Re-read the invoice after payment and store its latest balance.
* Never create a second invoice when a conversion request times out; look up the existing result and retry safely.
* Keep customer, currency, project, branch, and custom-field mappings consistent across every document.
* Create a credit note rather than editing financial history after an invoice has been issued.

For invoices created without a quote, see [Manage the invoice lifecycle](/docs/manage-the-invoice-lifecycle).