# Calculates transaction amounts

GET {{baseURL}}/pay-api/v1/transactions/calculate-amount
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.
The calculated amounts are for information only.
Applications, such as payment terminals or point of service devices, can display the appropriate values.
For example, clients could review the suggestions before submitting the payment.
ZCP (zero cost processing) affects the parameter usage.
**ZCP = None**
Only `amount`, `percentageOffRate` (if the merchant has IsPercentageOffEnabled), and `tipAmount/tipRate` are applied.
All other values are ignored, even if present.
**ZCP = CashDiscount**
The discount rate always comes from the merchant's DefaultCashDiscountRate.
Applies only to cash and ACH transactions.
All other values are ignored, even if present.
**ZCP = DualPricing**
The `useCardPrice` is required.
The `surchargeRate` is ignored.
See Also:
To create a transaction, see POST /pay-api/v1/transactions/sale.
To authorize a transaction, see POST /pay-api/v1/transactions/auth.
To adjust a transaction for tips, see POST /pay-api/v1/transactions/tip-adjustment.

Endpoint: GET /pay-api/v1/transactions/calculate-amount
Version: V1
Security: Bearer

## Security:

  - `Bearer` (unknown)
    http bearer JWT

## Query parameters:

  - `amount` (number, required)
    Specifies the base transaction amount (in USD) before discounts and fees.

Example: 29.49

  - `currencyId` (integer, required)
    Specifies the the Flute currency code.

It must be **1** (for USD).

Example: 1

  - `useCardPrice` (boolean)
    Specifies to calculate the transaction amount for card payment.

If `true`, calculate transaction amount for card payment.<br>
If `false`, calculate transaction amount for cash or an ACH payment.

Example: true

  - `percentageOffRate` (number)
    Specifies the percentage off or the discount rate.

Example: 25 (for 25%)

  - `surchargeRate` (number)
    Specifies the credit card surcharge rate.

Only applies when `useCardPrice` ia `true`.

It may be omitted to use the default credit card surcharge rate setting in the merchant account.

Example: 3.5 (for 3.5%)

  - `tipAmount` (number)
    Specifies the absolute amount (in USD) of the tip to be added.

<span class="note">
Values for `tipAmount` and `tipRate` are mutually exclusive.
Care must be taken to include one or the other but not both.
</span>

Example: 62.38

  - `tipRate` (number)
    Specifies the relative value of the tip to be added.

<span class="note">
Values for `tipAmount` and `tipRate` are mutually exclusive.
Care must be taken to include one or the other but not both.
</span>

Example: 18 (for 18%)

## Response 200:

  - `200` (unknown)
    OK

## Response 200 fields (application/json):

  - `currencyId` (integer)
    Possible values:
| Value | Name |
|  --- | --- |
| 1 | USD |

Example: 1
    Example: 1

  - `currency` (string)
    Indicates the currency code (in ISO 4217 currency code).

Example: USD
    Example: USD

  - `zeroCostProcessingOptionId` (integer)
    Identifies the zero cost processing option.
Possible values:
| Id | Type |
|  --- | --- |
| 1 | None |
| 2 | CashDiscount |
| 3 | DualPricing |
| 4 | Surcharge |

Example: 3
    Example: 3

  - `zeroCostProcessingOption` (string)
    Zero Cost Processing Option name.
Possible values:
| Type | Id |
|  --- | --- |
| None | 1 |
| CashDiscount | 2 |
| DualPricing | 3 |
| Surcharge | 4 |

Example: DualPricing
    Example: DualPricing

  - `useCardPrice` (boolean)
    Indicates whether the card price is used for the transaction.
If `true`, the card price is used.
If `false`, the cash price is used.
Example: true
    Example: true

  - `cash` (object)
    Indicates the amounts for the transaction.

  - `cash.baseAmount` (number)
    Identifies the original amount (in USD) of a transaction before adjustments are applied.
Example: 129.99 (for $129.99)
    Example: 129.99

  - `cash.percentageOffAmount` (number)
    Identifies the discount amount (in USD) taken off.
This discount was calculated using the preset percentage from `percentageOffRate`.
Example: 12.50 (for $12.50)
    Example: 12.5

  - `cash.percentageOffRate` (number)
    Identifies the discount percentage.
This value is the percentage rate for the discount.
This discount percentage calculates the discount amount for `percentageOffAmount`.
Example: 3.5 (as 3.5%)
    Example: 3.5

  - `cash.cashDiscountAmount` (number)
    Identifies the discount amount (in USD) when a cash (or cash-equivalent) discount is applied.
This discount was calculated using the preset percentage from `cashDiscountRate`.
Example: 10.55 (for $10.55)
    Example: 10.55

  - `cash.cashDiscountRate` (number)
    Identifies the discount percentage for a cash (or cash-equivalent) discount.
This value is the percentage rate for the discount.
This discount percentage calculates the discount amount for `cashDiscountAmount`.
Example: 1.5 (as 1.5%)
    Example: 1.5

  - `cash.cashDiscountPercentage` (number)
    Identifies the discount percentage for a cash (or cash-equivalent) discount.
This value is the percentage rate for the discount.
This discount percentage calculates the discount amount for `cashDiscountAmount`.
Example: 1.5 (as 1.5%)
    Example: 1.5

  - `cash.surchargeAmount` (number)
    Identifies the amount (in USD) when a surcharge is applicable.
This is a surcharge on the base amount.
This surcharge was calculated using the preset percentage from `surchargeRate`.
Example: 6.45 (for $6.45)
    Example: 6.45

  - `cash.surchargeRate` (number)
    Identifies the surcharge percentage.
This is a surcharge on the base amount.
This value is surcharge percentage rate.
This surcharge percentage calculates the surcharge amount for `surchargeAmount`.
Example: 1.5 (as 1.5%)
    Example: 1.5

  - `cash.tipAmount` (number)
    Specifies the absolute amount (in USD) of the tip to be added.
This amount adds to the base amount of the original transaction.
That transaction must be authorized first.

Values for `tipAmount` and `tipRate` are mutually exclusive.
Care must be taken to include one or the other but not both.
Example: 14.50 (for $14.50)
    Example: 14.5

  - `cash.tipRate` (number)
    Specifies the tip rate as a percentage of the base amount to be added.
This amount adds to the base amount of the original transaction.
That transaction must be authorized first.

Values for `tipAmount` and `tipRate` are mutually exclusive.
Care must be taken to include one or the other but not both.
Example: 15 (as 15%)
    Example: 15

  - `cash.taxAmount` (number)
    Identifies the tax amount (in USD).
Example: 273.65 (for $273.65)
    Example: 273.65

  - `cash.taxRate` (number)
    Identifies the tax percentage.
Example: 8.50 (as 8.50%)
    Example: 8.5

  - `cash.totalAmount` (number)
    Specifies the transaction's total amount.

This includes the base amount, tips, taxes, shipping, discounts, and other charges.

Example: 3219.45
    Example: 3219.45

## Response 400:

  - `400` (unknown)
    Bad Request

## 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: FluteOpsDeveloper.MSG322
    Example: FluteOpsDeveloper.MSG322

  - `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

  - `errors` (object)
    Indicates the collection of validation errors, keyed by field name.
Example:
{ "Email": ["'Email' is not a valid email address."] }

## Response 401:

  - `401` (unknown)
    Unauthorized

## 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: FluteOpsDeveloper.MSG322

  - `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)
    Indicates a short summary of the error.

Example: Validation failed
    Example: Validation failed

  - `cause` (string)
    Indicates the cause of the error.

Example: One or more fields failed validation rules.
    Example: One or more fields failed validation rules.

  - `resolution` (string)
    Indicates how to resolve the error.

Example: Review the errors and correct the invalid fields.
    Example: Review the errors and correct the invalid fields.

  - `documentationUrl` (string)
    Indicates a URL to relevant documentation about the error.

Example: https://developer.risewithaurora.com/
    Example: https://developer.risewithaurora.com/

## Response 404:

  - `404` (unknown)
    Resource not found

## Response 404 fields (application/json):

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

Example: Entity with ID 'aa6cfcd0-0295-4a4c-b074-8c901f114fef' was not found.
    Example: Entity with ID 'aa6cfcd0-0295-4a4c-b074-8c901f114fef' was not found.

  - `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: FluteOpsDeveloper.MSG322
    Example: FluteOpsDeveloper.MSG322

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

Example: System.Collections.Generic.KeyNotFoundException
    Example: System.Collections.Generic.KeyNotFoundException

  - `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

## Response 500:

  - `500` (unknown)
    Internal Error

## Response 500 fields (application/json):

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

Example: An unexpected error occurred while processing the request.
    Example: An unexpected error occurred while processing the request.

  - `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: System.Exception
    Example: System.Exception

  - `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

