---
title: "Create a transaction"
method: POST
path: "/v2/transactions"
tags: ["Transactions"]
---

# Create a transaction

`POST /v2/transactions`

Creates a new transaction

Note that `customer_external_key` or `customer_email` can be provided in
place of `customer_key` to reference the customer. The `customer_key`
referred in this endpoint corresponds to the internal customer key generated
by PartnerStack.

These customer reference fields are required, but mutually exclusive
(i.e. you must provide exactly and only one of the three).

## Request body

- union
  - object — Transaction Base
    - `amount` integer, required — Transaction amount in cents for specified currency.
    - `category_key` string, nullable — Key of transaction category.
    - `currency` string, required — Transaction currency type. Note that the format is the three-letter ISO currency code.
    - `customer_key` string — Key of customer who made the transaction.
    - `key` string — Key of transaction record in PartnerStack.
    - `metadata` object, nullable — Additional data that can be provided for the transaction on creation. Note that you can only store a maximum of 25 metadata attributes. The value of each attribute cannot exceed 100 characters, and the name of each attribute cannot exceed 30 characters.
    - `product_key` string, nullable — Key of transaction product.
    - `test` boolean — True if created in a test partnership or by a test customer
    - `created_at` integer — The created_at date of the transaction in epoch (ms).
    - `stack_key` string, nullable — The unique identifier of the teammate that drove the transaction.
    - `subscription_key` string, nullable — External identifier of the subscription/product associated with the transaction.
    - `customer_external_key` string, required — An external key that can be used to reference the customer. This is the same as the `customer_key` value used when creating the customer with PartnerStackJS.
  - object — Transaction Base
    - `amount` integer, required — Transaction amount in cents for specified currency.
    - `category_key` string, nullable — Key of transaction category.
    - `currency` string, required — Transaction currency type. Note that the format is the three-letter ISO currency code.
    - `customer_key` string — Key of customer who made the transaction.
    - `key` string — Key of transaction record in PartnerStack.
    - `metadata` object, nullable — Additional data that can be provided for the transaction on creation. Note that you can only store a maximum of 25 metadata attributes. The value of each attribute cannot exceed 100 characters, and the name of each attribute cannot exceed 30 characters.
    - `product_key` string, nullable — Key of transaction product.
    - `test` boolean — True if created in a test partnership or by a test customer
    - `created_at` integer — The created_at date of the transaction in epoch (ms).
    - `stack_key` string, nullable — The unique identifier of the teammate that drove the transaction.
    - `subscription_key` string, nullable — External identifier of the subscription/product associated with the transaction.
    - `customer_email` string, required — Customer's email address.
  - object — Transaction Base
    - `amount` integer, required — Transaction amount in cents for specified currency.
    - `category_key` string, nullable — Key of transaction category.
    - `currency` string, required — Transaction currency type. Note that the format is the three-letter ISO currency code.
    - `customer_key` string, required — Key of customer who made the transaction. This refers to the internal customer key that is generated by PartnerStack.
    - `key` string — Key of transaction record in PartnerStack.
    - `metadata` object, nullable — Additional data that can be provided for the transaction on creation. Note that you can only store a maximum of 25 metadata attributes. The value of each attribute cannot exceed 100 characters, and the name of each attribute cannot exceed 30 characters.
    - `product_key` string, nullable — Key of transaction product.
    - `test` boolean — True if created in a test partnership or by a test customer
    - `created_at` integer — The created_at date of the transaction in epoch (ms).
    - `stack_key` string, nullable — The unique identifier of the teammate that drove the transaction.
    - `subscription_key` string, nullable — External identifier of the subscription/product associated with the transaction.

## Response `200`

Creates a new transaction

Note that `customer_external_key` or `customer_email` can be provided in
place of `customer_key` to reference the customer. The `customer_key`
referred in this endpoint corresponds to the internal customer key generated
by PartnerStack.

These customer reference fields are required, but mutually exclusive
(i.e. you must provide exactly and only one of the three).

- object
  - `data` object, required — Transaction
    - `created_at` integer — Immutable Unix timestamp in milliseconds taken at time of creation
    - `key` string — Key of transaction record in PartnerStack.
    - `updated_at` integer — Unix timestamp in milliseconds taken at time of last update
    - `amount` integer — Transaction amount in cents for specified currency.
    - `category_key` string, nullable — Key of transaction category.
    - `currency` string — Transaction currency type. Note that the format is the three-letter ISO currency code.
    - `customer_key` string — Key of customer who made the transaction.
    - `metadata` object, nullable — Additional data that can be provided for the transaction on creation. Note that you can only store a maximum of 25 metadata attributes. The value of each attribute cannot exceed 100 characters, and the name of each attribute cannot exceed 30 characters.
    - `product_key` string, nullable — Key of transaction product.
    - `test` boolean — True if created in a test partnership or by a test customer
    - `amount_usd` integer — Transaction amount in cents converted to USD.
    - `approved` boolean — Used to indicate whether this transaction has been approved
    - `customer` object, nullable — Customer info.
      - `email` string, nullable — Customer's email address.
      - `external_key` string, nullable — An external key that can be used to reference the customer. This is the same as the `customer_key` value used when creating the customer with PartnerStackJS.
      - `key` string — Key of customer who made the transaction.
      - `shared_id` string, nullable — A shared ID that can be used to reference the customer.
    - `extension` object
  - `message` string, required
  - `status` integer, required

## Other responses

- `400` — Bad Request Error
- `401` — Unauthorized Error
- `403` — Forbidden Error
- `404` — Not Found Error
- `500` — Internal Server Error

---

[API](https://skmtc.dev/partnerstack/apis/partnerstack-api.md) · [All operations](https://skmtc.dev/partnerstack/apis/partnerstack-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/partnerstack/partnerstack-api/revisions/0f35aebe53a9/schema)
