Skip to content

Calculates transaction amounts

Request

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.

Security
Bearer
Query
amountnumber, (double), decimal places <= 2

Specifies the base transaction amount (in USD) before discounts and fees.

Example: 29.49

Example:amount=29.49
currencyIdinteger, (int32)

Specifies the the Flute currency code.

It must be 1 (for USD).

Example: 1

Example:currencyId=1
useCardPriceboolean

Specifies to calculate the transaction amount for card payment.

If true, calculate transaction amount for card payment.
If false, calculate transaction amount for cash or an ACH payment.

Example: true

Default:true
Example:useCardPrice=true
percentageOffRatenumber, (double), [ 0 .. 100 ]

Specifies the percentage off or the discount rate.

Example: 25 (for 25%)

Default:0
Example:percentageOffRate=25
surchargeRatenumber, (double), [ 0 .. 4 ]

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%)

Example:surchargeRate=15
tipAmountnumber, (double)

Specifies the absolute amount (in USD) of the tip to be added.

Values for `tipAmount` and `tipRate` are mutually exclusive. Care must be taken to include one or the other but not both.
Example:tipAmount=62.38
tipRatenumber, (double)

Specifies the relative value of the tip to be added.

Values for `tipAmount` and `tipRate` are mutually exclusive. Care must be taken to include one or the other but not both.

Example: 18 (for 18%)

Example:tipRate=18
curl -i -X GET \
  'https://developer.flute.com/_mock/api-reference/pay-api/v1/transactions/calculate-amount?amount=29.49&currencyId=1&useCardPrice=true&percentageOffRate=25&surchargeRate=15&tipAmount=62.38&tipRate=18' \
  -H 'Authorization: Bearer <YOUR_JWT_HERE>'

Responses

OK

Bodyapplication/json
currencyIdinteger, (int32)

Possible values:

ValueName
1USD

Example: 1

Example:1
currencystring or nullread-only

Indicates the currency code (in ISO 4217 currency code).

Example: USD

Example:"USD"
zeroCostProcessingOptionIdinteger, (int32)


Identifies the zero cost processing option.

Possible values:

IdType
1None
2CashDiscount
3DualPricing
4Surcharge

Example: 3

Example:3
zeroCostProcessingOptionstring or nullread-only

Zero Cost Processing Option name.

Possible values:

TypeId
None1
CashDiscount2
DualPricing3
Surcharge4

Example: DualPricing

Example:"DualPricing"
useCardPriceboolean or null
cashobject
creditCardobject
debitCardobject
achobject
Response
{ "currencyId": 1, "currency": "USD", "zeroCostProcessingOptionId": 3, "zeroCostProcessingOption": "DualPricing", "useCardPrice": true, "cash": { "baseAmount": 129.99, "percentageOffAmount": 12.5, "percentageOffRate": 3.5, "cashDiscountAmount": 0.1, "cashDiscountRate": 1.5, "cashDiscountPercentage": 1.5, "surchargeAmount": 6.45, "surchargeRate": 1.5, "tipAmount": 14.5, "tipRate": 15, "taxAmount": 0.1, "taxRate": 0.1, "totalAmount": 3219.45 }, "creditCard": { "baseAmount": 129.99, "percentageOffAmount": 12.5, "percentageOffRate": 3.5, "cashDiscountAmount": 0.1, "cashDiscountRate": 1.5, "cashDiscountPercentage": 1.5, "surchargeAmount": 6.45, "surchargeRate": 1.5, "tipAmount": 14.5, "tipRate": 15, "taxAmount": 0.1, "taxRate": 0.1, "totalAmount": 3219.45 }, "debitCard": { "baseAmount": 129.99, "percentageOffAmount": 12.5, "percentageOffRate": 3.5, "cashDiscountAmount": 0.1, "cashDiscountRate": 1.5, "cashDiscountPercentage": 1.5, "surchargeAmount": 6.45, "surchargeRate": 1.5, "tipAmount": 14.5, "tipRate": 15, "taxAmount": 0.1, "taxRate": 0.1, "totalAmount": 3219.45 }, "ach": { "baseAmount": 129.99, "percentageOffAmount": 12.5, "percentageOffRate": 3.5, "cashDiscountAmount": 0.1, "cashDiscountRate": 1.5, "cashDiscountPercentage": 1.5, "surchargeAmount": 6.45, "surchargeRate": 1.5, "tipAmount": 14.5, "tipRate": 15, "taxAmount": 0.1, "taxRate": 0.1, "totalAmount": 3219.45 } }