If you have defined tipping options in your Customer Area, the default behavior is that the tipping options apply to the total purchase amount. However, there are situations when you may want to let the customer add a tip to a different amount:
-
When a customer buys a mix of products and services. For example, if the total amount consists of the costs of a haircut and a hair product, you can let the customer add a tip only for the cost of having the haircut.
-
To exclude product-related charges, taxes, or other fees. For example, a regulation in Quebec, Canada requires tips to be calculated on pre-tax amounts. To comply with this regulation, in your payment request you can add the purchase amount before taxes as the amount to tip on.
The terminal will present the customer with the adjusted amount before adding the tip. Note that you need to implement logic in your system when to override the total purchase amount as the amount to tip on.
Requirements
Before you begin, take into account the following requirements and preparations.
Requirement | Description |
---|---|
Integration type | Terminal API integration with Adyen-provided payment terminals. |
Hardware | Terminal models on software version 1.103 or later. |
Setup steps | Before you begin, you need to implement logic in your system when to trigger the override. |
Specify amount to tip on in the payment request
When you override the amount to tip on, you are automatically overriding the tipping options defined in your Customer Area as well. This means that your payment request needs to include the AskGratuity tender option and a base-64 encoded Operation
object with both the AmountToTipOn
parameter and the TipSuggestions
object.
-
Create an
Operation
JSON object with the following parameters:Parameter Description Type
Payment AmountToTipOn
The amount that the customer can tip on. TipOptions
Contains the TipSuggestions
object with:
- Up to three predefined tipping options for either a fixed tipping amount (Amount1, Amount2, and Amount3) or a percentage of the specified amount to tip on (Percentage1, Percentage2, and Percentage3). The numeric value for percentage tipping options must not be greater than 100.
TipCustom
(optional): lets the customer enter a custom tipping amount. Value true or false.
-
Encode the
Operation
JSON object to Base64. You will pass the resulting string inSaleData.SaleToPOIData
. The example below shows a Base64-encoded string of theOperation
object format. -
Make a
PaymentRequest
with:-
MessageHeader
: the standardSaleToPOIRequest.MessageHeader
object. Specify:Parameter Required Description ProtocolVersion
3.0 MessageClass
Service MessageCategory
Payment MessageType
Request ServiceID
Your unique ID for this request, consisting of 1-10 alphanumeric characters. Must be unique within the last 48 hours for the terminal ( POIID
) being used.SaleID
Your unique ID for the POS system component to send this request from. POIID
The unique ID of the terminal to send this request to. Format: [device model]-[serial number].
-
PaymentRequest
: the request body. This includes:Parameter Description SaleData.SaleToAcquirerData
The AskGratuity tender option that triggers the terminal to start the tipping flow. See the Specify tender options.
SaleData.SaleToPOIData
An object with the Base64-encoded Operation
string that contains the tipping options.PaymentTransaction.AmountsReq
An object with: Currency
: The transaction currency.RequestedAmount
: The total purchase amount, with decimals.
The example below shows how to initiate a transaction with an adjusted amount to tip on.
-
-
In the
PaymentResponse
note the following:-
PaymentReceipt
: receipt data with the original purchase amount, the gratuity amount, and the total amount. If the customer didn't add a tip, the gratuity amount is not included. -
PaymentResult.AmountsResp
:TipAmount
: the amount of the tip. If the customer didn't add a tip, this field is not included.AuthorizedAmount
: the total authorized amount of the transaction, consisting of the original purchase amount plus the tip amount.Currency
: the currency of the payment.
-
Response.AdditionalResponse
: additional transaction data. Depending on your settings, you receive either a string of form-encoded key-value pairs or a Base64 string that you need to decode to get a JSON object. This includes:posadditionalamounts.originalAmountValue
: the original purchase amount in minor units.posAmountGratuityValue
: the tip amount in minor units.authorisedAmountValue
: the total authorized amount in minor units.
The example below shows the response for a transaction where the original purchase amount was EUR 20.00, the adjusted amount to tip on was EUR 15.00, and a 20 percent tip was added.
-