Collect tip amount by using a guest's credit/debit card
This API helps you to charge a tip amount for the specified invoice from a guest's saved credit/debit card.
You can add the tip while taking payment for the invoice amount. You can also charge only the tip amount for an invoice, after the invoice payment has been completed.
For example, if the amount of an invoice is $100 and the tip amount is $15, you can charge a total of $115 from the guest's card at one go. Alternatively, you can first complete the invoice payment of $100 and then add the $15 tip amount.
After you have taken payment for the invoice amount and tip amount, you can close the invoice.
You must provide appropriate data for the invoice_id parameter.
Before you begin
- You need a valid API key or access token. See Set up API authentication.
Permission: Manage API Keys (on the Administrator security object) — Required to access Zenoti APIs.
Endpoint
POST /v1/invoices/{invoice_id}/online_payments
Base URL: https://api.zenoti.com
Request
Headers
| Header | Required | Description |
|---|---|---|
| Authorization | Yes | bearer {{access_token}} |
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| invoice_id | string | Yes | Mandatory Unique 32-character ID of the specific invoice. This is a mandatory parameter. |
Response
Success (201 Created)
{
"invoice_transaction_id": "b0b61718-77c8-4b70-889f-eda59cbf3811",
"token_id": "55482148",
"success": true
}
Response fields
| Field | Type | Description |
|---|---|---|
| invoice_transaction_id | string | |
| token_id | string | |
| success | boolean |
Example
curl --request POST \
--url 'https://api.zenoti.com/v1/invoices/{invoice_id}/online_payments' \
--header 'Authorization: bearer {{access_token}}'
const response = await fetch('https://api.zenoti.com/v1/invoices/{invoice_id}/online_payments', {
method: 'POST',
headers: {
'Authorization': 'bearer {{access_token}}'
},
});
const data = await response.json();
import requests
response = requests.post(
'https://api.zenoti.com/v1/invoices/{invoice_id}/online_payments',
headers={
'Authorization': 'bearer {{access_token}}',
},
)
data = response.json()
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "bearer {{access_token}}");
var response = await client.PostAsync(
"https://api.zenoti.com/v1/invoices/{invoice_id}/online_payments");
var data = await response.Content.ReadAsStringAsync();
require 'net/http'
require 'json'
uri = URI('https://api.zenoti.com/v1/invoices/{invoice_id}/online_payments')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'bearer {{access_token}}'
response = http.request(request)
data = JSON.parse(response.body)
Error codes
| Status | Description |
|---|---|
| 400 | 400 |
| 401 | Unauthorized -- invalid or expired access token |
| 429 | Too many requests -- rate limit exceeded |