> ## Documentation Index
> Fetch the complete documentation index at: https://docs.withbenji.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a transaction

> Create a transaction using the reward transaction authentication token from the previous step.

> [!NOTE]
>
> The `x-api-key` header value to be used on this API is a **user-based access token**.

**reward\_authentication\_token** `string` *required*

The token received from the [authenticate reward transaction](https://docs.withbenji.com/api-reference/endpoint/transactions/authenticate) API call.

### Return values

**reward\_transactions** `array`

An array of reward transaction objects created with this transaction

**items**

A reward transaction object property

**properties**

**id** `integer`

Benji Platform reward transaction identifier

**partner\_id** `integer`

The ID of the partner associated with this transaction in the Benji Platform

**campaign\_id** `integer`

The ID of the campaign triggered for this transaction in the Benji Platform

**user\_id** `integer`

The ID of the user associated with the transaction in the Benji Platform

**merchant\_id** `integer`

The ID of the merchant partner associated with this campaign in the Benji Platform

**transaction\_amount** `integer`

The total dollar amount of the transaction

**reward\_amount** `integer`

The total amount of rewards earned or redeemed on this transaction

**external\_order\_id** `string`

The external reference of the order on the merchant partner system

**transaction\_type** `integer`

Integer representing an enum of one of the following transaction type values:

**possible transaction type values**

* **EARN (1)** : Indicating an earn transaction type \\

* **REDEEM (2)** : Indicating a redeem transaction type  \\

**status** `integer`

Integer representing an enum of one of the following transaction status values:

**possible transaction status values**

* **PENDING (1)** : Indicating a transaction that is pending and has not been confirmed by the partner yet \\

* **CONFIRMED (2)** : Indicating a transaction that has been confirmed by the partner  \\

* **FAILED (3)** : Indicating a transaction that has been rejected by the partner  \\

**error\_reason** `string`

If status is FAILED, the reason why this transaction was rejected

**last\_update\_date** `datetime`

Datetime indicating the last status change. For instance, if the status is CONFIRMED, this date will indicate when the transaction was confirmed

**created\_date** `datetime`

The transaction date

```json 200 theme={null}
{
    "code": "ok",
    "data": {
        "reward_transactions": [{
            "created_date": "2024-08-23T19:55:12.015047+00:00",
            "last_updated_date": "2024-08-23T19:57:12.015047+00:00",
            "status": 2,
            "external_order_id": "5856681787572",
            "id": 1,
            "merchant_id": 1,
            "partner_id": 1,
            "campaign_id": 1,
            "reward_amount": 266,
            "transaction_amount": 885.95,
            "transaction_type": 1,
            "user_id": 1
        }]
    }
}
```

```json 400 theme={null}
{
  "error": "invalid_token",
  "message": "Invalid token"
}
```

```json 400 theme={null}
{
  "error": "transaction_already_exists",
  "message": "The transaction has already been created"
}
```

```json 401 theme={null}
{
  "error": "unauthorized_request",
  "message": "Token is not authorized to make this request"
}
```

> [!TIP]
>
> Make sure to store the returned reward transaction ID. You can use this ID to get the status of the reward transaction when receiving reward\_transaction\_update webhooks.

> [!WARNING]
>
> The transaction authentication token is valid for 10 minutes.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.