<!-- ZenPays documentation · https://docs.zenpayz.com/docs/reference/objects/transaction -->

# The Transaction object

Represents a completed or in-progress transaction. Transactions are created when a payment intent is confirmed and track the actual movement of funds.

## Fields

<ParamTable
  label="Field"
  rows={[
    { name: "id", type: "string", required: true, desc: "Unique identifier for the transaction" },
    { name: "intentId", type: "string", required: true, desc: "Associated payment intent ID" },
    { name: "merchantId", type: "string", required: true, desc: "Merchant ID that received the payment" },
    { name: "customerId", type: "string", required: false, desc: "Customer ID if the customer was registered" },
    { name: "customerName", type: "string", required: false, desc: "Name of the customer" },
    { name: "customerEmail", type: "string", required: false, desc: "Email of the customer" },
    { name: "amount", type: "number", required: true, desc: "Transaction amount in the smallest currency unit" },
    { name: "currency", type: "string", required: true, desc: "Three-letter ISO currency code" },
    { name: "status", type: "PaymentStatus", required: true, desc: "Current status of the transaction [PaymentStatus](/docs/reference/enums/payment-status)" },
    { name: "paymentMethod", type: "PaymentMethodType", required: false, desc: "Payment method used for this transaction [PaymentMethodType](/docs/reference/enums/payment-status)" },
    { name: "tspProvider", type: "string", required: false, desc: "Third-party service provider that processed the payment" },
    { name: "externalTransactionId", type: "string", required: false, desc: "External transaction ID from the payment provider" },
    { name: "processingFee", type: "number", required: false, desc: "Processing fee charged for this transaction" },
    { name: "netAmount", type: "number", required: false, desc: "Net amount after fees" },
    { name: "failureReason", type: "string", required: false, desc: "Reason for failure if the transaction failed" },
    { name: "metadata", type: "Record<string, unknown>", required: false, desc: "Custom key-value data attached to the transaction" },
    { name: "createdAt", type: "string", required: true, desc: "ISO 8601 timestamp when the transaction was created" },
    { name: "updatedAt", type: "string", required: true, desc: "ISO 8601 timestamp when the transaction was last updated" },
  ]}
/>

## Example

```json
{
  "id": "obj_1a2b3c",
  "intentId": "intent_1a2b3c",
  "merchantId": "merchant_1a2b3c",
  "customerId": "customer_1a2b3c",
  "customerName": "string",
  "customerEmail": "customer@example.com",
  "amount": 5000,
  "currency": "USD",
  "status": "pending",
  "createdAt": "2026-01-15T09:30:00Z",
  "updatedAt": "2026-01-15T09:30:00Z"
}
```
