Authorize and capture a tipped payment on screen
United States
Canada
Europe
Some merchants, such as quick service restaurants or coffee shops, may want to allow the customer to tip before submitting the transaction. The order subtotal is calculated by the POS and then used as the baseAmount for the /device/v1/read-tip request. Once the customer tips, the POS calculates the order total (the amount) and completes the transaction.
Use the /v1/payments, /v1/device/read-tip, and /v1/payments/{paymentId}/capture endpoints to:
- Authorize the customer's card for an amount.
- Allow the customer to add a tip.
- Capture the final amount—the original amount plus the tip.
Prerequisites
- POS is connected to the device using a network or cloud connection.
- Clover device is idle; that is, no payment is being taken.
Steps
To start the payment flow for a tip-on-screen payment:
- Construct a request with the minimum required data:
- The
amountto be charged in cents. - A flag to indicate the charge should not be captured.
- An
externalPaymentId.
{
"amount": 3440,
"capture": false,
"externalPaymentId": "{externalPaymentId}"
}
- Send a POST request to the
/v1/paymentsendpoint. - Required. Include the required headers for your request.
The payment flow is started for the specified amount. After the authorization is complete, a success message appears.
- Store the returned
amountandidvalues. - Construct a request with the amount of the uncaptured charge.
{
"baseAmount": 3440
}
- Send the
baseAmountas a POST request to/device/v1/read-tip.
The tip screen displays the specified amount.
Once the customer selects a tip amount, a success message is returned with the tip amount.
- Save the
responsevalue. - To finalize the charge, construct a request with the
amountas the total charge amount. Optionally, include the receipt type in the request.
{
"amount": 4128,
"receipt_email" : "[email protected]"
}
- Send a POST request to
/v1/payments/{paymentId}/capture—where{paymentId}is the final chargeamountas the request body.
The capture request is sent and returns"captured": truefor the charge ID.
After closeout, thestatechanges fromPENDINGtoCLOSED. - To return to the welcome screen, send a POST request to the
/v1/device/welcomeendpoint.
Updated almost 2 years ago
