---
tags: [vompay, model]
module: VomPay
---

# [Model]Models

## Connections
[[_VomPay]] · [[[Repo]Repositories]] · [[[Service]InvoiceServices]] · [[[Service]DashboardSettingsServices]] · [[[DB]DatabaseTables]]

## Source
`Modules/VomPay/Models/`

---

## VomPayInvoice

**Table:** `vom_pay_invoices`  
**Traits:** `FilterTrait` · `PaginateTrait` · `UsesTenantConnection`

Tracks every payment link generated via MyFatoorah. Polymorphic — one row per Invoice / ProformaInvoice / DebitNote payment attempt.

### Fillable
`my_fatoorah_invoice_id` · `payment_url` · `paiable_type` · `paiable_id` · `status` · `amount` · `payment_date` · `payment_id` · `customer_id` · `notes`

### Relationships
| Relation | Type | Target |
|---|---|---|
| paiable | morphTo | Invoice / ProformaInvoice / SalesEstimate (Sales module) |
| customer | belongsTo | Customer (Sales, withTrashed) |

### Scopes (via FilterTrait)
`scopeFilterByCustomerName($name)` · `scopeFilterByDateFrom($date)` · `scopeFilterByDateTo($date)` · `scopeFilterByPaymentStatus($status)`

### Accessors / Mutators
`amount` — trimNumber on get and set

---

## VomPaySetting

**Table:** `vom_pay_settings`  
**Traits:** `UsesTenantConnection`

Stores per-tenant configuration for the VomPay integration.

### Fillable
| Field | Purpose |
|---|---|
| expense_account_id | Account for recording gateway fees |
| payment_account_id | Account to credit on payment receipt |
| cost_center_id | Default cost center for VomPay transactions |
| apply_on_invoice | Auto-create payment link when invoice is saved |
| apply_on_proforma | Auto-create payment link on proforma save |
| apply_on_debit_note | Auto-create payment link on debit note save |
| apply_on_customer_receipt | Auto-create customer receipt when payment confirmed |
| auto_convert_proforma | Auto-convert proforma to invoice on payment (TODO) |
| notes | Free-text config notes |

`getLatest()` via `VomPaySettingRepository` — only the most recent row is used.
