Paddle Billing
Search

Create a transaction

Transactions are the central billing entity in Paddle. Create a transaction to collect using checkout or invoice. Paddle automatically creates transactions for subscription lifecycle events.

To bill a customer, you need a transaction. It holds all the information about a charge you're billing for, including customer details, items, calculated tax and localized pricing, and payments.

Paddle automatically creates transactions for subscription lifecycle events and when checkouts are opened, but you can create your own transactions using the API or Paddle dashboard.

How it works

Transactions are at the heart of Paddle. They tie together products, prices, and discounts with customers to calculate and capture revenue for checkouts, invoices, and subscriptions.

All revenue in Paddle is calculated and captured using transactions. Paddle creates transactions automatically for subscription lifecycle events and when checkouts are opened, and you may also create your own transactions using the API or Paddle dashboard.

Transaction lifecycle

Transactions are initially created as draft or ready, depending on the information supplied. As you work with a transaction entity, they move to completed:

  1. Draft

    draft transactions are missing required fields for billing. Checkouts opened by Paddle.js with only items create draft transactions, since they're missing customer and address information initially.

  2. Ready

    Transactions are ready when they have all the required fields for billing. When Paddle Checkout captures customer name, country and (in some regions) ZIP or postal code, then transactions move to ready.

  3. Billed

    You may optionally mark a transaction as billed. At this point, it's considered a financial record and can't be changed. This is typically used as part of an invoicing workflow to issue an invoice, or to prevent a customer from changing items or quantities at checkout.

  4. Paid

    When Paddle collects payment successfully, transactions are automatically paid. This is an interim status while completed transaction processing happens. Paddle updates the transaction with information about fees, earnings, and totals for payouts. It also adds the related subscription_id and invoice_number for automatically-collected transactions.

    Completed transaction processing usually takes less than a second, so you won't typically encounter transactions that are paid when working with the API.

  5. Completed

    After all transaction processing is completed, transactions are automatically completed.

Paddle automatically sets transactions as draft, ready, paid, and completed. You can set transactions as billed or canceled using the API.

This guide focuses on creating automatically-collected transactions. You can also create manually-collected transactions, meaning Paddle sends an invoice document that must be paid manually.

Before you begin

Set your default payment link

Before creating a transaction, you'll need to:

  • Set your default payment link under Paddle > Checkout > Checkout settings > Default payment link.
  • Get your default payment link domain approved, if you're working with the live environment.

We recommend starting the domain approval early in your integration process, so your domains are approved for when you're ready to go live.

Create customers

If you're working with the Paddle dashboard, you can create all the entities that you'll be working with as you create your transaction.

If you're working with the API, you'll need to:

Create products and prices — optional

Transactions work with products and prices to say what you're billing for. You can bill for items from your catalog, or non-catalog items for one-off or bespoke items.

To bill for an item in your catalog, create a product and a related price.

Create a draft or ready transaction

Draft transactions contain an items list, but don't include address or customer details which are required for billing. Ready transactions contain an items list and all required fields for billing, including address and customer details.

You may pass a draft or ready transaction to a checkout to capture customer or address information, and collect for payment.

Create a draft or transaction using the API in three steps:

  1. Build request

    Build a request that includes a list of items that you'd like to bill for, and information about who you're billing.

  2. Preview your transaction (optional)

    Preview your transaction. Paddle returns a preview of the transaction, including tax and localized pricing. You may like to present this information to a customer, depending on your workflow.

  3. Create your transaction

    Send the request to create your transaction. Paddle creates it. Its status is draft or ready depending on the information you supplied.

Build request

Build an array of items, with an object containing either:

  • An item from your catalog

    Include a price ID and quantity for each item.

  • A non-catalog item

    Include a price object and quantity for each item.

Non-catalog items are one-off or bespoke items that are specific to that transaction. See: Bill for non-catalog items

Recurring items on a transaction must have the same billing interval. For example, you can't have a transaction with some prices that are billed monthly and some products that are billed annually.

itemsarray[object]

List of items to charge for.

quantityinteger

Quantity of this item on the transaction.

price_idstring

Paddle ID of an existing catalog price to add to this transaction, prefixed with pri_.

Include customer_id and address_id to say who this invoice is for.

If you're working with a business, include business_id too.

Transactions are automatically marked as ready when they have customer_id, address_id, and items. This means that they're ready to be issued (marked as billed).

customer_idstring

Paddle ID of the customer that this invoice is for, prefixed with ctm_.

address_idstring

Paddle ID of the address that this invoice is for, prefixed with add_.

business_idstring

Paddle ID of the business that this invoice is for, prefixed with biz_.

Preview request

Send a POST request to the /transactions/preview endpoint with the request you built.

POSThttps://api.paddle.com/transactions/preview

Send request

Send a POST request to the /transactions endpoint with the request you built.

POSThttps://api.paddle.com/transactions

Update a transaction

While your transaction is draft or ready, you can make changes to it and the items on it. You can work with items, apply a discount, change customer information, or add or remove custom data.

If you're working with a draft transaction, Paddle automatically marks it as ready when you add customer_id and address_id.

Transactions are financial records. You can't edit them if they're billed, canceled, or completed. Cancel a transaction and create another or create an adjustment if you need to make changes to a billed or completed transaction.

Update a transaction using the API in two steps:

  1. Build request

    Build a request that includes a list of items that you'd like to bill for, and information about who you're billing. If you're adding new items, your request should include any existing items that you'd like to keep.

  2. Update your invoice

    Send the request to update your transaction. Paddle updates it.

Build request

Build a request with any data that you'd like to change. You can change any writeable fields at this point, including address, customer, and items.

When working with items, you should send the complete list of items that you'd like to be against your invoice — including any existing items. If you omit an item, it's removed from the items list. See: Work with lists

Request

This example adds a discount to a transaction. Apply a discount by including discount_id in your request.

Send request

Send a PATCH request to the /transactions/{transaction_id} endpoint.

Response

If successful, Paddle responds with a copy of the updated transaction entity.

Mark a transaction as billed

You can mark a transaction as billed using the API to say it's finalized, meaning it's considered a financial record and cannot be changed.

This is typically used for manually-collected transactions (invoices), as part of an invoicing workflow. Marking a transaction as billed is essentially issuing an invoice. It gets an invoice number and is sent to the customer.

You don't need to mark an automatically-collected transaction as billed, and it's not typically part of a self-service workflow. However, you may like to do this if you plan to create a checkout for this transaction to prevent a customer from changing items or quantities at checkout.

See: Issue an invoice

You can create a transaction and mark it as billed by including "status": "billed" in your initial request, along with the other required fields — no need to make a separate request.

Pass a transaction to a checkout

Automatically-collected transactions include checkout.url, which you can send to customers to open a checkout to capture customer information and collect payment for this transaction.

You can also pass a transaction to a checkout using Paddle.js to collect for it.

Events

transaction.createdOccurs when a transaction is created initially.
transaction.updatedOccurs when a transaction is updated.
transaction.readyOccurs when a transaction is ready to be billed. It has all of the required fields for billing.
transaction.billedOccurs when a transaction is marked as billed.

Related pages