# POST /transactions/preview

**Preview a transaction**

Previews a transaction without creating a transaction entity. Typically used for creating more advanced, dynamic pricing pages where users can build their own plans.

Consider using [the preview prices operation](https://developer.paddle.com/api-reference/pricing-preview/preview-prices) for simpler pricing pages.

You can provide location information when previewing a transaction. You must provide this if you want Paddle to calculate tax or [automatically localize prices](https://developer.paddle.com/build/products/offer-localized-pricing). You can provide one of:

* `customer_ip_address`: Paddle fetches location using the IP address to calculate totals.
* `address`: Paddle uses the country and ZIP code (where supplied) to calculate totals.
* `customer_id`, `address_id`, `business_id`: Paddle uses existing customer data to calculate totals. Typically used for logged-in customers.

When supplying items, you can exclude items from the total calculation using the `include_in_totals` boolean.

By default, recurring items with trials are considered to have a zero charge when previewing. Set `ignore_trials` to `true` to ignore trial periods against prices for transaction preview calculations.

If successful, your response includes the data you sent with a `details` object that includes totals for the supplied prices.

Transaction previews don't create transactions, so no `id` is returned.

**Required permissions:** `transaction.read`

## Request body



### Request example

```json
{
  "items": [
    {
      "quantity": 20,
      "price_id": "pri_01gsz8x8sawmvhz1pv30nge1ke"
    },
    {
      "quantity": 1,
      "price_id": "pri_01h1vjfevh5etwq3rb416a23h2"
    },
    {
      "quantity": 1,
      "price_id": "pri_01gsz98e27ak2tyhexptwc58yk",
      "include_in_totals": false
    }
  ],
  "discount_id": "dsc_01gtgztp8fpchantd5g1wrksa3",
  "address": {
    "country_code": "US"
  },
  "currency_code": "USD"
}
```

## Response (200)

- `data`: object (required) — Represents a transaction entity when previewing transactions.
  - `customer_id` (required) — Paddle ID of the customer that this transaction preview is for, prefixed with `ctm_`.
  - `address_id` (required) — Paddle ID of the address that this transaction preview is for, prefixed with `add_`. Send one of `address_id`, `customer_ip_address`, or the `address` object when previewing.
  - `business_id` (required) — Paddle ID of the business that this transaction preview is for, prefixed with `biz_`.
  - `currency_code`: string (required) — Supported three-letter ISO 4217 currency code.
  - `discount_id` (required) — Paddle ID of the discount applied to this transaction preview, prefixed with `dsc_`.
  - `customer_ip_address` (required) — IP address for this transaction preview. Send one of `address_id`, `customer_ip_address`, or the `address` object when previewing.
  - `address` (required) — Address for this transaction preview. Send one of `address_id`, `customer_ip_address`, or the `address` object when previewing.
  - `ignore_trials`: boolean (required) — Whether trials should be ignored for transaction preview calculations.

By default, recurring items with trials are considered to have a zero charge when previewing. Set to `true` to disable this.
  - `items`: array (required) — List of items to preview transaction calculations for. (Items: 1–100)
  - `details`: object (required) — Calculated totals for a transaction preview, including discounts, tax, and currency conversion. Considered the source of truth for totals on a transaction preview.
    - `tax_rates_used`: array (required) — List of tax rates applied to this transaction preview.
    - `totals`: object (required) — Breakdown of the total for a transaction preview. `fee` and `earnings` always return `null` for transaction previews.
      - `subtotal`: string (required) — Subtotal before discount, tax, and deductions. If an item, unit price multiplied by quantity.
      - `discount`: string (required) — Total discount as a result of any discounts applied.

Except for percentage discounts, Paddle applies tax to discounts based on the line item `price.tax_mode`. If `price.tax_mode` for a line item is `internal`, Paddle removes tax from the discount applied.
      - `tax`: string (required) — Total tax on the subtotal.
      - `total`: string (required) — Total after discount and tax.
      - `credit`: string (required) — Total credit applied to this transaction. This includes credits applied using a customer's credit balance and adjustments to a `billed` transaction.
      - `credit_to_balance`: string (required) — Additional credit generated from negative `details.line_items`. This credit is added to the customer balance.
      - `balance`: string (required) — Total due on a transaction after credits and any payments.
      - `grand_total`: string (required) — Total due on a transaction after credits but before any payments.
      - `grand_total_tax`: string (required) — Net tax amount included in `grand_total`. Equals the full `tax` amount unless credits are applied, in which case this value is proportionally reduced.
      - `fee` (required) — Total fee taken by Paddle for this transaction. `null` until the transaction is `completed` and the fee is processed.
      - `earnings` (required) — Total earnings for this transaction. This is the total minus the Paddle fee. `null` until the transaction is `completed` and the fee is processed.
      - `currency_code`: string (required) — Three-letter ISO 4217 currency code of the currency used for this transaction.
    - `line_items`: array (required) — Information about line items for this transaction preview. Different from transaction preview `items` as they include totals calculated by Paddle. Considered the source of truth for line item totals.
  - `available_payment_methods`: array (required) — List of available payment methods for Paddle Checkout given the price and location information passed.
- `meta`: object (required) — Information about this response.
  - `request_id`: string (required) — Unique ID for the request relating to this response. Provide this when contacting Paddle support about a specific request.

### Response example

```json
{
  "data": {
    "customer_id": null,
    "address_id": null,
    "business_id": null,
    "currency_code": "USD",
    "discount_id": "dsc_01gtgztp8fpchantd5g1wrksa3",
    "address": {
      "postal_code": "",
      "country_code": "US"
    },
    "customer_ip_address": null,
    "items": [
      {
        "price": {
          "id": "pri_01gsz8x8sawmvhz1pv30nge1ke",
          "description": "Monthly",
          "type": "standard",
          "name": "Monthly (per seat)",
          "product_id": "pro_01gsz4t5hdjse780zja8vvr7jg",
          "billing_cycle": {
            "interval": "month",
            "frequency": 1
          },
          "trial_period": null,
          "tax_mode": "account_setting",
          "unit_price": {
            "amount": "3000",
            "currency_code": "USD"
          },
          "unit_price_overrides": [],
          "custom_data": null,
          "quantity": {
            "minimum": 1,
            "maximum": 999
          },
          "status": "active",
          "created_at": "2023-02-23T13:55:22.538367Z",
          "updated_at": "2024-04-11T13:54:52.254748Z",
          "import_meta": null
        },
        "quantity": 20,
        "proration": null,
        "include_in_totals": true
      },
      {
        "price": {
          "id": "pri_01h1vjfevh5etwq3rb416a23h2",
          "description": "Monthly",
          "type": "standard",
          "name": "Monthly (recurring addon)",
          "product_id": "pro_01h1vjes1y163xfj1rh1tkfb65",
          "billing_cycle": {
            "interval": "month",
            "frequency": 1
          },
          "trial_period": null,
          "tax_mode": "account_setting",
          "unit_price": {
            "amount": "10000",
            "currency_code": "USD"
          },
          "unit_price_overrides": [],
          "custom_data": null,
          "quantity": {
            "minimum": 1,
            "maximum": 100
          },
          "status": "active",
          "created_at": "2023-06-01T13:31:12.625056Z",
          "updated_at": "2024-04-09T07:23:00.907834Z",
          "import_meta": null
        },
        "quantity": 1,
        "proration": null,
        "include_in_totals": true
      },
      {
        "price": {
          "id": "pri_01gsz98e27ak2tyhexptwc58yk",
          "description": "One-time addon",
          "type": "standard",
          "name": "One-time addon",
          "product_id": "pro_01gsz97mq9pa4fkyy0wqenepkz",
          "billing_cycle": null,
          "trial_period": null,
          "tax_mode": "account_setting",
          "unit_price": {
            "amount": "19900",
            "currency_code": "USD"
          },
          "unit_price_overrides": [],
          "custom_data": null,
          "quantity": {
            "minimum": 1,
            "maximum": 1
          },
          "status": "active",
          "created_at": "2023-02-23T14:01:28.391712Z",
          "updated_at": "2024-04-09T07:23:10.921392Z",
          "import_meta": null
        },
        "quantity": 1,
        "proration": null,
        "include_in_totals": false
      }
    ],
    "details": {
      "tax_rates_used": [
        {
          "tax_rate": "0",
          "totals": {
            "subtotal": "70000",
            "discount": "7000",
            "tax": "0",
            "total": "63000"
          }
        }
      ],
      "totals": {
        "subtotal": "70000",
        "tax": "0",
        "discount": "7000",
        "total": "63000",
        "grand_total": "63000",
        "grand_total_tax": "0",
        "fee": null,
        "credit": "0",
        "credit_to_balance": "0",
        "balance": "63000",
        "earnings": null,
        "currency_code": "USD"
      },
      "line_items": [
        {
          "price_id": "pri_01gsz8x8sawmvhz1pv30nge1ke",
          "quantity": 20,
          "totals": {
            "subtotal": "60000",
            "tax": "0",
            "discount": "6000",
            "total": "54000"
          },
          "product": {
            "id": "pro_01gsz4t5hdjse780zja8vvr7jg",
            "name": "AeroEdit Pro",
            "description": "Designed for professional pilots, including all features plus in Basic plus compliance monitoring, route optimization, and third-party integrations.",
            "type": "standard",
            "tax_category": "standard",
            "image_url": "https://paddle.s3.amazonaws.com/user/165798/bT1XUOJAQhOUxGs83cbk_pro.png",
            "custom_data": {
              "features": {
                "aircraft_performance": true,
                "compliance_monitoring": true,
                "flight_log_management": true,
                "payment_by_invoice": false,
                "route_planning": true,
                "sso": false
              },
              "suggested_addons": [
                "pro_01h1vjes1y163xfj1rh1tkfb65",
                "pro_01gsz97mq9pa4fkyy0wqenepkz"
              ],
              "upgrade_description": "Move from Basic to Pro to take advantage of aircraft performance, advanced route planning, and compliance monitoring."
            },
            "status": "active",
            "created_at": "2023-02-23T12:43:46.605Z",
            "updated_at": "2024-04-05T15:53:44.687Z",
            "import_meta": null
          },
          "tax_rate": "0",
          "unit_totals": {
            "subtotal": "3000",
            "tax": "0",
            "discount": "300",
            "total": "2700"
          },
          "proration": null
        },
        {
          "price_id": "pri_01h1vjfevh5etwq3rb416a23h2",
          "quantity": 1,
          "totals": {
            "subtotal": "10000",
            "tax": "0",
            "discount": "1000",
            "total": "9000"
          },
          "product": {
            "id": "pro_01h1vjes1y163xfj1rh1tkfb65",
            "name": "Analytics addon",
            "description": "Unlock advanced insights into your flight data with enhanced analytics and reporting features. Includes customizable reporting templates and trend analysis across flights.",
            "type": "standard",
            "tax_category": "standard",
            "image_url": "https://paddle.s3.amazonaws.com/user/165798/97dRpA6SXzcE6ekK9CAr_analytics.png",
            "custom_data": null,
            "status": "active",
            "created_at": "2023-06-01T13:30:50.302Z",
            "updated_at": "2024-04-05T15:47:17.163Z",
            "import_meta": null
          },
          "tax_rate": "0",
          "unit_totals": {
            "subtotal": "10000",
            "tax": "0",
            "discount": "1000",
            "total": "9000"
          },
          "proration": null
        },
        {
          "price_id": "pri_01gsz98e27ak2tyhexptwc58yk",
          "quantity": 1,
          "totals": {
            "subtotal": "19900",
            "tax": "0",
            "discount": "1990",
            "total": "17910"
          },
          "product": {
            "id": "pro_01gsz97mq9pa4fkyy0wqenepkz",
            "name": "Custom domains",
            "description": "Make AeroEdit truly your own with custom domains. Custom domains reinforce your brand identity and make it easy for your team to access your account.",
            "type": "standard",
            "tax_category": "standard",
            "image_url": "https://paddle.s3.amazonaws.com/user/165798/XIG7UXoJQHmlIAiKcnkA_custom-domains.png",
            "custom_data": null,
            "status": "active",
            "created_at": "2023-02-23T14:01:02.441Z",
            "updated_at": "2024-04-05T15:43:28.971Z",
            "import_meta": null
          },
          "tax_rate": "0",
          "unit_totals": {
            "subtotal": "19900",
            "tax": "0",
            "discount": "1990",
            "total": "17910"
          },
          "proration": null
        }
      ]
    },
    "ignore_trials": false,
    "available_payment_methods": [
      "apple_pay",
      "card",
      "paypal",
      "google_pay"
    ]
  },
  "meta": {
    "request_id": "eb3d6481-6799-4e30-8676-0dc96a356182"
  }
}
```
