Charge a payment line to the hotel room
curl --request POST \
--url https://app.eat-now.io/api/partner/v1/activities/{id}/payments/{paymentId}/room-charge \
--header 'Authorization: Bearer <token>' \
--header 'Idempotency-Key: <idempotency-key>'import requests
url = "https://app.eat-now.io/api/partner/v1/activities/{id}/payments/{paymentId}/room-charge"
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Idempotency-Key': '<idempotency-key>', Authorization: 'Bearer <token>'}
};
fetch('https://app.eat-now.io/api/partner/v1/activities/{id}/payments/{paymentId}/room-charge', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.eat-now.io/api/partner/v1/activities/{id}/payments/{paymentId}/room-charge",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Idempotency-Key: <idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.eat-now.io/api/partner/v1/activities/{id}/payments/{paymentId}/room-charge"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.eat-now.io/api/partner/v1/activities/{id}/payments/{paymentId}/room-charge")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.eat-now.io/api/partner/v1/activities/{id}/payments/{paymentId}/room-charge")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"cart_id": "<string>",
"external_id": "<string>",
"cart_external_id": "<string>",
"status": "PENDING",
"start_at": "2023-11-07T05:31:56Z",
"party_size": 1,
"source": "WALK_IN",
"product": {
"id": "<string>",
"name": "<string>"
},
"variant": {
"id": "<string>",
"name": "<string>"
},
"variants": [
{
"id": "<string>",
"name": "<string>",
"quantity": 1
}
],
"assigned_staff": {
"id": "<string>",
"name": "<string>"
},
"prescriber": {
"id": "<string>",
"name": "<string>",
"phone_number": "<string>"
},
"customer": {
"id": "<string>",
"name": "<string>",
"email": "jsmith@example.com",
"phone_number": "<string>",
"lang": "FR"
},
"hotel_guest": {
"room_number": "<string>",
"pms_reference": {
"stay_id": "<string>"
}
},
"additional_comment": "<string>",
"metadata": {},
"attached_files": [
"<string>"
],
"tags": [
"<string>"
],
"cancellation_reason": "<string>",
"payment_summary": {
"currency": "MAD",
"total_amount": 123,
"paid_amount": 123,
"gift_card_amount": 123,
"authorized_amount": 123,
"pending_amount": 123,
"refunded_amount": 123,
"statuses": [
"FREE"
]
},
"payments": [
{
"id": "<string>",
"provider_id": "<string>",
"payment_type": "DEPOSIT",
"payment_mode": "SOFT_PREAUTH",
"provider": "PAYZONE",
"status": "FREE",
"amount": 123,
"gift_card_amount": 123,
"quantity": 123,
"unit_price": 123,
"percent_of_total": 123,
"currency": "MAD",
"is_refundable": true,
"external_reference": "<string>",
"expiration_date": "2023-11-07T05:31:56Z",
"max_cancellation_date": "2023-11-07T05:31:56Z",
"authorized_at": "2023-11-07T05:31:56Z",
"capture_deadline": "2023-11-07T05:31:56Z",
"captured_at": "2023-11-07T05:31:56Z",
"voided_at": "2023-11-07T05:31:56Z",
"linked_product": {
"id": "<string>",
"name": "<string>"
},
"linked_variant": {
"id": "<string>",
"name": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"sensitive_data_included": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"data": {
"id": "<string>",
"cart_id": "<string>",
"external_id": "<string>",
"cart_external_id": "<string>",
"status": "PENDING",
"start_at": "2023-11-07T05:31:56Z",
"party_size": 1,
"source": "WALK_IN",
"product": {
"id": "<string>",
"name": "<string>"
},
"variant": {
"id": "<string>",
"name": "<string>"
},
"variants": [
{
"id": "<string>",
"name": "<string>",
"quantity": 1
}
],
"assigned_staff": {
"id": "<string>",
"name": "<string>"
},
"prescriber": {
"id": "<string>",
"name": "<string>",
"phone_number": "<string>"
},
"customer": {
"id": "<string>",
"name": "<string>",
"email": "jsmith@example.com",
"phone_number": "<string>",
"lang": "FR"
},
"hotel_guest": {
"room_number": "<string>",
"pms_reference": {
"stay_id": "<string>"
}
},
"additional_comment": "<string>",
"metadata": {},
"attached_files": [
"<string>"
],
"tags": [
"<string>"
],
"cancellation_reason": "<string>",
"payment_summary": {
"currency": "MAD",
"total_amount": 123,
"paid_amount": 123,
"gift_card_amount": 123,
"authorized_amount": 123,
"pending_amount": 123,
"refunded_amount": 123,
"statuses": [
"FREE"
]
},
"payments": [
{
"id": "<string>",
"provider_id": "<string>",
"payment_type": "DEPOSIT",
"payment_mode": "SOFT_PREAUTH",
"provider": "PAYZONE",
"status": "FREE",
"amount": 123,
"gift_card_amount": 123,
"quantity": 123,
"unit_price": 123,
"percent_of_total": 123,
"currency": "MAD",
"is_refundable": true,
"external_reference": "<string>",
"expiration_date": "2023-11-07T05:31:56Z",
"max_cancellation_date": "2023-11-07T05:31:56Z",
"authorized_at": "2023-11-07T05:31:56Z",
"capture_deadline": "2023-11-07T05:31:56Z",
"captured_at": "2023-11-07T05:31:56Z",
"voided_at": "2023-11-07T05:31:56Z",
"linked_product": {
"id": "<string>",
"name": "<string>"
},
"linked_variant": {
"id": "<string>",
"name": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"sensitive_data_included": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "AUTHENTICATION_REQUIRED",
"message": "<string>",
"request_id": "<string>",
"details": {}
}
}{
"error": {
"code": "AUTHENTICATION_REQUIRED",
"message": "<string>",
"request_id": "<string>",
"details": {}
}
}{
"error": {
"code": "AUTHENTICATION_REQUIRED",
"message": "<string>",
"request_id": "<string>",
"details": {}
}
}{
"error": {
"code": "AUTHENTICATION_REQUIRED",
"message": "<string>",
"request_id": "<string>",
"details": {}
}
}{
"error": {
"code": "AUTHENTICATION_REQUIRED",
"message": "<string>",
"request_id": "<string>",
"details": {}
}
}{
"error": {
"code": "AUTHENTICATION_REQUIRED",
"message": "<string>",
"request_id": "<string>",
"details": {}
}
}{
"error": {
"code": "AUTHENTICATION_REQUIRED",
"message": "<string>",
"request_id": "<string>",
"details": {}
}
}Payments
Charge a payment line to the hotel room
Adds a line of the activity still owed to the guest’s folio in the hotel PMS. The stay is the cart’s: the cart must be linked to one (pms_reference) with its room number. EatNow reads the stay again from the PMS and charges only that very stay, open to charges. Send an Idempotency-Key header: a replay of the key answers the charge’s current state, never a second charge. An activity awaiting its payment is confirmed once nothing else is owed online on it. Cancelling the activity while the PMS’s answer is awaited is refused (capture_pending); a refund or a cancellation with a refund reverses the charge on the folio. Requires PAYMENTS_WRITE; the line in full also needs ACTIVITIES_READ_SENSITIVE. Publishes activity.updated when the line moves.
POST
/
api
/
partner
/
v1
/
activities
/
{id}
/
payments
/
{paymentId}
/
room-charge
Charge a payment line to the hotel room
curl --request POST \
--url https://app.eat-now.io/api/partner/v1/activities/{id}/payments/{paymentId}/room-charge \
--header 'Authorization: Bearer <token>' \
--header 'Idempotency-Key: <idempotency-key>'import requests
url = "https://app.eat-now.io/api/partner/v1/activities/{id}/payments/{paymentId}/room-charge"
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Idempotency-Key': '<idempotency-key>', Authorization: 'Bearer <token>'}
};
fetch('https://app.eat-now.io/api/partner/v1/activities/{id}/payments/{paymentId}/room-charge', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.eat-now.io/api/partner/v1/activities/{id}/payments/{paymentId}/room-charge",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Idempotency-Key: <idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.eat-now.io/api/partner/v1/activities/{id}/payments/{paymentId}/room-charge"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.eat-now.io/api/partner/v1/activities/{id}/payments/{paymentId}/room-charge")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.eat-now.io/api/partner/v1/activities/{id}/payments/{paymentId}/room-charge")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"cart_id": "<string>",
"external_id": "<string>",
"cart_external_id": "<string>",
"status": "PENDING",
"start_at": "2023-11-07T05:31:56Z",
"party_size": 1,
"source": "WALK_IN",
"product": {
"id": "<string>",
"name": "<string>"
},
"variant": {
"id": "<string>",
"name": "<string>"
},
"variants": [
{
"id": "<string>",
"name": "<string>",
"quantity": 1
}
],
"assigned_staff": {
"id": "<string>",
"name": "<string>"
},
"prescriber": {
"id": "<string>",
"name": "<string>",
"phone_number": "<string>"
},
"customer": {
"id": "<string>",
"name": "<string>",
"email": "jsmith@example.com",
"phone_number": "<string>",
"lang": "FR"
},
"hotel_guest": {
"room_number": "<string>",
"pms_reference": {
"stay_id": "<string>"
}
},
"additional_comment": "<string>",
"metadata": {},
"attached_files": [
"<string>"
],
"tags": [
"<string>"
],
"cancellation_reason": "<string>",
"payment_summary": {
"currency": "MAD",
"total_amount": 123,
"paid_amount": 123,
"gift_card_amount": 123,
"authorized_amount": 123,
"pending_amount": 123,
"refunded_amount": 123,
"statuses": [
"FREE"
]
},
"payments": [
{
"id": "<string>",
"provider_id": "<string>",
"payment_type": "DEPOSIT",
"payment_mode": "SOFT_PREAUTH",
"provider": "PAYZONE",
"status": "FREE",
"amount": 123,
"gift_card_amount": 123,
"quantity": 123,
"unit_price": 123,
"percent_of_total": 123,
"currency": "MAD",
"is_refundable": true,
"external_reference": "<string>",
"expiration_date": "2023-11-07T05:31:56Z",
"max_cancellation_date": "2023-11-07T05:31:56Z",
"authorized_at": "2023-11-07T05:31:56Z",
"capture_deadline": "2023-11-07T05:31:56Z",
"captured_at": "2023-11-07T05:31:56Z",
"voided_at": "2023-11-07T05:31:56Z",
"linked_product": {
"id": "<string>",
"name": "<string>"
},
"linked_variant": {
"id": "<string>",
"name": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"sensitive_data_included": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"data": {
"id": "<string>",
"cart_id": "<string>",
"external_id": "<string>",
"cart_external_id": "<string>",
"status": "PENDING",
"start_at": "2023-11-07T05:31:56Z",
"party_size": 1,
"source": "WALK_IN",
"product": {
"id": "<string>",
"name": "<string>"
},
"variant": {
"id": "<string>",
"name": "<string>"
},
"variants": [
{
"id": "<string>",
"name": "<string>",
"quantity": 1
}
],
"assigned_staff": {
"id": "<string>",
"name": "<string>"
},
"prescriber": {
"id": "<string>",
"name": "<string>",
"phone_number": "<string>"
},
"customer": {
"id": "<string>",
"name": "<string>",
"email": "jsmith@example.com",
"phone_number": "<string>",
"lang": "FR"
},
"hotel_guest": {
"room_number": "<string>",
"pms_reference": {
"stay_id": "<string>"
}
},
"additional_comment": "<string>",
"metadata": {},
"attached_files": [
"<string>"
],
"tags": [
"<string>"
],
"cancellation_reason": "<string>",
"payment_summary": {
"currency": "MAD",
"total_amount": 123,
"paid_amount": 123,
"gift_card_amount": 123,
"authorized_amount": 123,
"pending_amount": 123,
"refunded_amount": 123,
"statuses": [
"FREE"
]
},
"payments": [
{
"id": "<string>",
"provider_id": "<string>",
"payment_type": "DEPOSIT",
"payment_mode": "SOFT_PREAUTH",
"provider": "PAYZONE",
"status": "FREE",
"amount": 123,
"gift_card_amount": 123,
"quantity": 123,
"unit_price": 123,
"percent_of_total": 123,
"currency": "MAD",
"is_refundable": true,
"external_reference": "<string>",
"expiration_date": "2023-11-07T05:31:56Z",
"max_cancellation_date": "2023-11-07T05:31:56Z",
"authorized_at": "2023-11-07T05:31:56Z",
"capture_deadline": "2023-11-07T05:31:56Z",
"captured_at": "2023-11-07T05:31:56Z",
"voided_at": "2023-11-07T05:31:56Z",
"linked_product": {
"id": "<string>",
"name": "<string>"
},
"linked_variant": {
"id": "<string>",
"name": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"sensitive_data_included": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "AUTHENTICATION_REQUIRED",
"message": "<string>",
"request_id": "<string>",
"details": {}
}
}{
"error": {
"code": "AUTHENTICATION_REQUIRED",
"message": "<string>",
"request_id": "<string>",
"details": {}
}
}{
"error": {
"code": "AUTHENTICATION_REQUIRED",
"message": "<string>",
"request_id": "<string>",
"details": {}
}
}{
"error": {
"code": "AUTHENTICATION_REQUIRED",
"message": "<string>",
"request_id": "<string>",
"details": {}
}
}{
"error": {
"code": "AUTHENTICATION_REQUIRED",
"message": "<string>",
"request_id": "<string>",
"details": {}
}
}{
"error": {
"code": "AUTHENTICATION_REQUIRED",
"message": "<string>",
"request_id": "<string>",
"details": {}
}
}{
"error": {
"code": "AUTHENTICATION_REQUIRED",
"message": "<string>",
"request_id": "<string>",
"details": {}
}
}