Skip to content

Calculates transaction amounts

Request

POST {{baseURL}}/v2/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.

See Also:
To list transactions, see GET /v2/transactions.
To retrieve a transaction by ID, see GET /v2/transactions/{transactionId}.
To create a new transaction, see POST /v2/transactions.
To share a transaction receipt by SMS, see POST /v2/transactions/{transactionId}/share-receipt.

Security
Bearer
Bodyapplication/json
baseAmountnumber, (double), decimal places <= 2

Specifies the base transaction amount before adjustments.

Examples:
125
125.5
125.50

Example:125.5
currencyCodestring or null

Identifies the transaction's currency code (in uppercase ISO 4217 currency code).

Example: USD

Default:"USD"
Example:"USD"
pricingTypestring or null

Identifies the type of pricing.

This value is required only when Dual Pricing is enabled.

Valid values are:

StatusExplanation
CardThe transaction uses the card price, which may include a surcharge.
CashThe transaction uses the cash price, which may include a cash discount.

Example: Card

Enum:"Card""Cash"
Example:"Card"
tipAmountnumber, (double), decimal places <= 2

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
tipRatenumber, (double)

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
discountAmountnumber, (double), decimal places <= 2

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
discountRatenumber, (double)

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
surchargeRatenumber, (double)

Specifies the credit Card surcharge rate override.

Example: 2.5 (for 2.5%)

Example:2.5
curl -i -X POST \
  https://sandbox.api.flute.com/v2/transactions/calculate-amount \
  -H 'Authorization: Bearer <YOUR_JWT_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "baseAmount": 100,
    "currencyCode": "USD",
    "pricingType": "Card",
    "discountAmount": 0,
    "discountRate": 5,
    "surchargeRate": 2.5,
    "tipAmount": 15,
    "tipRate": 0
  }'

Responses

OK

Bodyapplication/json
currencyCodestring or null

Identifies the transaction's currency code (in uppercase ISO 4217 currency code).

Example: USD

Default:"USD"
Example:"USD"
zeroCostProcessingOptionstring

Indicates the ZCP (zero cost processing) options.

Valid values are:

TypeDescription
CashDiscountListed price includes a discount for cash payment.
DualPricingDisplays a separate price for cash and card.
NoneNo zero cost processing program applied.
SurchargeAdds a fee to the card price at checkout.

Example: CashDiscount

Enum:"None""CashDiscount""DualPricing""Surcharge"
Example:"CashDiscount"
pricingTypestring or null

Identifies the type of pricing.

This value is required only when Dual Pricing is enabled.

Valid values are:

StatusExplanation
CardThe transaction uses the card price, which may include a surcharge.
CashThe transaction uses the cash price, which may include a cash discount.

Example: Card

Enum:"Card""Cash"
Example:"Card"
cashobject

Amount breakdown for a specific payment method.

creditCardobject

Amount breakdown for a specific payment method.

debitCardobject

Amount breakdown for a specific payment method.

achobject

Amount breakdown for a specific payment method.

Response
{ "currencyCode": "USD", "zeroCostProcessingOption": "Surcharge", "pricingType": "Card", "cash": { "baseAmount": 100, "discountAmount": 15, "discountRate": 0, "surchargeAmount": 0, "surchargeRate": 0, "tipAmount": 15, "tipRate": 0, "totalAmount": 110 }, "creditCard": { "baseAmount": 100, "discountAmount": 15, "discountRate": 0, "surchargeAmount": 3.5, "surchargeRate": 0, "tipAmount": 15, "tipRate": 0, "totalAmount": 113.5 }, "debitCard": { "baseAmount": 100, "discountAmount": 5, "discountRate": 0, "surchargeAmount": 0, "surchargeRate": 0, "tipAmount": 15, "tipRate": 0, "totalAmount": 110 }, "ach": { "baseAmount": 100, "discountAmount": 5, "discountRate": 0, "surchargeAmount": 0, "surchargeRate": 0, "tipAmount": 15, "tipRate": 0, "totalAmount": 110 } }