- 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.
Requirements
Before you begin, take into account the following requirements and preparations.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 encodedOperation object with both the AmountToTipOn parameter and the TipSuggestions object.
-
Create an
OperationJSON object with the following parameters:Operation object -
Encode the
OperationJSON object to Base64. You will pass the resulting string inSaleData.SaleToPOIData. The example below shows a Base64-encoded string of theOperationobject format. Converted to a Base64-encoded string -
Make a payment request, specifying:
-
The standard
SaleToPOIRequest.MessageHeaderobject, withMessageClassset to Service andMessageCategoryset to Payment.
-
The standard
-
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.
-
