Collect invoice payment by redeeming a guest's gift card
This API helps you to collect payment for the amount of an invoice by redeeming the balance of a guest’s gift card.
You must first verify the balance of a guest’s gift card. If the gift card contains sufficient balance, you can then call this API to collect payment for the specified invoice.
This gift card redemption for an invoice enables you to display the relevant details in your Zenoti UI, and map it to the respective fields in Reports and Analytics.
You must specify 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}/payments/gift_card
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 identifier of the guest's invoice. |
Response
Success (201 Created)
{
"is_applied": true,
"payment": {
"payment_option": {
"...": "..."
},
"total_amount_paid": 23,
"amount_paid": 13,
"tip_amount": 10,
"ssg_amount": 0,
"fee_amount": 0,
"cash_back_amount": 0,
"transaction_id": "ab8bc8dc-5f69-4325-b06a-1d7586636568",
"payment_date": "2020-03-27T05:35:12.2",
"cash_regester_id": "00000000-0000-0000-0000-000000000000"
},
"error": {
"code": 716,
"message": "Error While Adding Payment."
}
}
Response fields
| Field | Type | Description |
|---|---|---|
| is_applied | boolean | |
| payment | object | |
| payment.payment_option | object | |
| payment.total_amount_paid | integer | |
| payment.amount_paid | integer | |
| payment.tip_amount | integer | |
| payment.ssg_amount | integer | |
| payment.fee_amount | integer | |
| payment.cash_back_amount | integer | |
| payment.transaction_id | string | |
| payment.payment_date | string | |
| payment.cash_regester_id | string | |
| error | object | |
| error.code | integer | |
| error.message | string |
Example
curl --request POST \
--url 'https://api.zenoti.com/v1/invoices/{invoice_id}/payments/gift_card' \
--header 'Authorization: bearer {{access_token}}'
const response = await fetch('https://api.zenoti.com/v1/invoices/{invoice_id}/payments/gift_card', {
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}/payments/gift_card',
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}/payments/gift_card");
var data = await response.Content.ReadAsStringAsync();
require 'net/http'
require 'json'
uri = URI('https://api.zenoti.com/v1/invoices/{invoice_id}/payments/gift_card')
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 |