# Calculates transaction amounts

<a id="flute-v2-post-transactions-calculate-amount"></a>
<span class="api-endpoint">POST {{<a href="#urlbases">baseURL</a>}}/v2/transactions/calculate-amount</span>
This endpoint calculates transaction amounts.
The amounts are based on the merchant's ZCP (zero cost processing) mode.
This includes dual pricing, cash discounts, or credit card surcharges.
Applications, such as payment terminals or point of service devices, can then display the appropriate amounts.
<span class="api-seealso">See Also:</span><br>
To list transactions, see `GET /v2/transactions`.<br>
To retrieve a transaction by ID, see `GET /v2/transactions/{transactionId}`.<br>
To create a new transaction, see `POST /v2/transactions`.<br>
To share a transaction receipt by SMS, see `POST /v2/transactions/{transactionId}/share-receipt`.

Endpoint: POST /v2/transactions/calculate-amount
Version: V2 Beta
Security: Bearer

## Request fields (application/json):

  - `baseAmount` (number)
    Specifies the base transaction amount before adjustments.
Examples:
125
125.5
125.50
    Example: 125.5

  - `currencyCode` (string)
    Identifies the transaction's currency code (in ISO 4217 currency code).

Example: USD
    Example: USD

  - `pricingType` (string)
    Identifies the type of pricing.
This value is only relevant when Dual Pricing is enabled.
Valid values are:
| Status | Explanation |
|  --- | --- |
| Card | The transaction uses the card price, which may include a surcharge. |
| Cash | The transaction uses the cash price, which may include a cash discount. |

Example: Card
    Enum: "Card", "Cash"

  - `tipAmount` (number)
    Specifies the absolute tip amount (in USD) to add.

Care must be taken that a value other than zero can be provided to either `tipAmount` or `tipRate`.
A non-zero value cannot be provided to both.

Example: 10.5 (as $10.5)
    Example: 10.5

  - `tipRate` (number)
    Specifies the tip rate to apply.
Encoded as raw percentage.
For example: 18.5 for 18.5%.

Care must be taken that a value other than zero can be provided to either `tipAmount` or `tipRate`.
A non-zero value cannot be provided to both.

Example: 18.5 (as 18.5%)
    Example: 18.5

  - `discountAmount` (number)
    Indicates the absolute amount (in USD) of discount to be applied.
If this value is provided, it must be greater than zero.

Care must be taken that a value other than zero can be provided to either `discountAmount` or `discountRate`.
A non-zero value cannot be provided to both.

Example: 25 (for $25)
    Example: 25

  - `discountRate` (number)
    Indicates a percentage of a discount to be applied.
If this value is provided, it must be greater than zero.

Care must be taken that a value other than zero can be provided to either `discountAmount` or `discountRate`.
A non-zero value cannot be provided to both.

Example: 5.5 (for 5.5%)
    Example: 5.5

  - `surchargeRate` (number)
    Specifies the credit Card surcharge rate override.
Example: 2.5 (for 2.5%)
    Example: 2.5

## Response 200 fields (application/json):

  - `currencyCode` (string)
    Identifies the transaction's currency code (in ISO 4217 currency code).

Example: USD
    Example: USD

  - `zeroCostProcessingOption` (string)
    Indicates the ZCP (zero cost processing) options.
Valid values are:
| Type | Description |
|  --- | --- |
| CashDiscount | Listed price includes a discount for cash payment. |
| DualPricing | Displays a separate price for cash and card. |
| None | No zero cost processing program applied. |
| Surcharge | Adds a fee to the card price at checkout. |

Example: CashDiscount
    Enum: "None", "CashDiscount", "DualPricing", "Surcharge"

  - `pricingType` (string)
    Identifies the type of pricing.
This value is only relevant when Dual Pricing is enabled.
Valid values are:
| Status | Explanation |
|  --- | --- |
| Card | The transaction uses the card price, which may include a surcharge. |
| Cash | The transaction uses the cash price, which may include a cash discount. |

Example: Card
    Enum: "Card", "Cash"

  - `cash` (object)
    Amount breakdown for a specific payment method.

  - `cash.baseAmount` (number)
    Identifies the base transaction amount (in USD) before adjustments.
Examples:
125
125.5
125.50
    Example: 125.5

  - `cash.discountAmount` (number)
    Indicates the discount amount (in USD) applied.
Example: 22.5 (for $22.5)
    Example: 22.5

  - `cash.discountRate` (number)
    Indicates the discount percent applied.
Example: 18.5 (for 18.5%)
    Example: 18.5

  - `cash.surchargeAmount` (number)
    Indicates the surcharge amount (in USD) applied.
Example: 12.75 (for $12.75)
    Example: 12.75

  - `cash.surchargeRate` (number)
    Indicates the surcharge percent applied.
Example: 8.25 (for 8.25%)
    Example: 8.25

  - `cash.tipAmount` (number)
    Indicates the absolute amount (in USD) of the tip to be added.
If this value is provided, it must be greater than zero.
This amount adds to the base amount of the original transaction.
That transaction must be authorized first (`POST /pay-api/v1/transactions/auth`).
Example: 14.50 (for $14.50)
    Example: 14.5

  - `cash.tipRate` (number)
    Indicates the tip percent applied.
Example: 15.25 (for 15.25%)
    Example: 15.25

  - `cash.totalAmount` (number)
    Indicates the final total amount  (in USD).

Example: 124.99
    Example: 124.99

## Response 400 fields (application/json):

  - `details` (string)
    Indicates details about the error.

Example: Validation failed: -- Email: 'Email' is not a valid email address. Severity: Error
    Example: Validation failed: -- Email: 'Email' is not a valid email address. Severity: Error

  - `statusCode` (integer)
    Specifies the HTTP response status code.
This is the HTTP status code returned by the attempted delivery.
The following is a list of HTTP response status codes that include but are not limited to:
| HTTP Status | Meaning |
|  --- | --- |
| 200 | Delivery succeeded |
| 400 | Bad request |
| 401 | Unauthorized |
| 404 | Endpoint not found |
| 429 | Rate limited |

Example: 401
    Example: 401

  - `source` (string)
    Indicates the source of the error.
Example: <Service>
    Example: <Service>

  - `exceptionType` (string)
    Indicates the error's exception type.

Example: FluentValidation.ValidationException
    Example: FluentValidation.ValidationException

  - `correlationId` (string)
    Indicates the correlation identifier.

Example: aa6cfcd0-0295-4a4c-b074-8c901f114fef
    Example: aa6cfcd0-0295-4a4c-b074-8c901f114fef

  - `entityId` (string)
    Indicates the entity identifier.
Example:
null

  - `errorCode` (string)
    Indicates the error code.
Example:
null

  - `title` (string)

  - `cause` (string)

  - `resolution` (string)

  - `documentationUrl` (string)
    https://developer.flute.com/

## Response 401 fields (application/json):

  - `details` (string)
    Indicates details about the error.

Example: Validation failed: -- Email: 'Email' is not a valid email address. Severity: Error
    Example: Validation failed: -- Email: 'Email' is not a valid email address. Severity: Error

  - `statusCode` (integer)
    Specifies the HTTP response status code.
This is the HTTP status code returned by the attempted delivery.
The following is a list of HTTP response status codes that include but are not limited to:
| HTTP Status | Meaning |
|  --- | --- |
| 200 | Delivery succeeded |
| 400 | Bad request |
| 401 | Unauthorized |
| 404 | Endpoint not found |
| 429 | Rate limited |

Example: 401
    Example: 401

  - `source` (string)
    Indicates the source of the error.
Example: <Service>
    Example: <Service>

  - `exceptionType` (string)
    Indicates the error's exception type.

Example: FluentValidation.ValidationException
    Example: FluentValidation.ValidationException

  - `correlationId` (string)
    Indicates the correlation identifier.

Example: aa6cfcd0-0295-4a4c-b074-8c901f114fef
    Example: aa6cfcd0-0295-4a4c-b074-8c901f114fef

  - `entityId` (string)
    Indicates the entity identifier.
Example:
null

  - `errorCode` (string)
    Indicates the error code.
Example:
null

  - `title` (string)

  - `cause` (string)

  - `resolution` (string)

  - `documentationUrl` (string)
    https://developer.flute.com/

## Response 403 fields (application/json):

  - `details` (string)
    Indicates details about the error.

Example: Validation failed: -- Email: 'Email' is not a valid email address. Severity: Error
    Example: Validation failed: -- Email: 'Email' is not a valid email address. Severity: Error

  - `statusCode` (integer)
    Specifies the HTTP response status code.
This is the HTTP status code returned by the attempted delivery.
The following is a list of HTTP response status codes that include but are not limited to:
| HTTP Status | Meaning |
|  --- | --- |
| 200 | Delivery succeeded |
| 400 | Bad request |
| 401 | Unauthorized |
| 404 | Endpoint not found |
| 429 | Rate limited |

Example: 401
    Example: 401

  - `source` (string)
    Indicates the source of the error.
Example: <Service>
    Example: <Service>

  - `exceptionType` (string)
    Indicates the error's exception type.

Example: FluentValidation.ValidationException
    Example: FluentValidation.ValidationException

  - `correlationId` (string)
    Indicates the correlation identifier.

Example: aa6cfcd0-0295-4a4c-b074-8c901f114fef
    Example: aa6cfcd0-0295-4a4c-b074-8c901f114fef

  - `entityId` (string)
    Indicates the entity identifier.
Example:
null

  - `errorCode` (string)
    Indicates the error code.
Example:
null

  - `title` (string)

  - `cause` (string)

  - `resolution` (string)

  - `documentationUrl` (string)
    https://developer.flute.com/

## Response 429 fields (application/json):

  - `details` (string)
    Indicates details about the error.

Example: Validation failed: -- Email: 'Email' is not a valid email address. Severity: Error
    Example: Validation failed: -- Email: 'Email' is not a valid email address. Severity: Error

  - `statusCode` (integer)
    Specifies the HTTP response status code.
This is the HTTP status code returned by the attempted delivery.
The following is a list of HTTP response status codes that include but are not limited to:
| HTTP Status | Meaning |
|  --- | --- |
| 200 | Delivery succeeded |
| 400 | Bad request |
| 401 | Unauthorized |
| 404 | Endpoint not found |
| 429 | Rate limited |

Example: 401
    Example: 401

  - `source` (string)
    Indicates the source of the error.
Example: <Service>
    Example: <Service>

  - `exceptionType` (string)
    Indicates the error's exception type.

Example: FluentValidation.ValidationException
    Example: FluentValidation.ValidationException

  - `correlationId` (string)
    Indicates the correlation identifier.

Example: aa6cfcd0-0295-4a4c-b074-8c901f114fef
    Example: aa6cfcd0-0295-4a4c-b074-8c901f114fef

  - `entityId` (string)
    Indicates the entity identifier.
Example:
null

  - `errorCode` (string)
    Indicates the error code.
Example:
null

  - `title` (string)

  - `cause` (string)

  - `resolution` (string)

  - `documentationUrl` (string)
    https://developer.flute.com/

## Response 500 fields (application/json):

  - `details` (string)
    Indicates details about the error.

Example: Validation failed: -- Email: 'Email' is not a valid email address. Severity: Error
    Example: Validation failed: -- Email: 'Email' is not a valid email address. Severity: Error

  - `statusCode` (integer)
    Specifies the HTTP response status code.
This is the HTTP status code returned by the attempted delivery.
The following is a list of HTTP response status codes that include but are not limited to:
| HTTP Status | Meaning |
|  --- | --- |
| 200 | Delivery succeeded |
| 400 | Bad request |
| 401 | Unauthorized |
| 404 | Endpoint not found |
| 429 | Rate limited |

Example: 401
    Example: 401

  - `source` (string)
    Indicates the source of the error.
Example: <Service>
    Example: <Service>

  - `exceptionType` (string)
    Indicates the error's exception type.

Example: FluentValidation.ValidationException
    Example: FluentValidation.ValidationException

  - `correlationId` (string)
    Indicates the correlation identifier.

Example: aa6cfcd0-0295-4a4c-b074-8c901f114fef
    Example: aa6cfcd0-0295-4a4c-b074-8c901f114fef

  - `entityId` (string)
    Indicates the entity identifier.
Example:
null

  - `errorCode` (string)
    Indicates the error code.
Example:
null

  - `title` (string)

  - `cause` (string)

  - `resolution` (string)

  - `documentationUrl` (string)
    https://developer.flute.com/

