Add a credit/debit card for a guest

POST https://api.zenoti.com/v1/guests/{guest_id}/accounts

Add a credit/debit card for a guest


On this page


Before you begin

Permission: Manage API Keys (on the Administrator security object) — Required to access Zenoti APIs.

Endpoint

POST /v1/guests/{guest_id}/accounts

Base URL: https://api.zenoti.com

Request

Headers

Header Required Description
Authorization Yes bearer {{access_token}}

Path parameters

Parameter Type Required Description
guest_id string Yes Unique 32-character identifier of the guest.

Request body

Field Type Required Description
center_id string Yes Unique 32-character ID of the center
redirect_uri string Yes URI to redirect the guest after payment completion
source string No Source of the request. 1 : WebStore , 5 : Mobile
host string No Custom domain URL
avs_source string No AVS source: 0 = Client, 1 = Provider
billing_info object No Address details of the guest

Response

Success (201 Created)

{
  "success": true,
  "error": {},
  "hosted_payment_uri": "https://secure-payment.zenoti.com/add-card?token=550e8400-e29b-41d4-a716-446655440124&redirect=https%3A%2F%2Fexample.com%2Fcard-added-success",
  "token_id": "550e8400-e29b-41d4-a716-446655440124"
}

Response fields

Field Type Description
success boolean
error object
hosted_payment_uri string
token_id string

Example

curl --request POST \
  --url 'https://api.zenoti.com/v1/guests/{guest_id}/accounts' \
  --header 'Authorization: bearer {{access_token}}' \
  --header 'Content-Type: application/json' \
  --data '{
  "center_id": "string",
  "redirect_uri": "string",
  "source": "1",
  "host": "string",
  "avs_source": "string",
  "billing_info": {
    "first_name": "string",
    "last_name": "string",
    "email": "string",
    "country": "string",
    "name": "string",
    "address": "string",
    "state": "string",
    "zipcode": "string",
    "city": "string",
    "phone": "string",
    "house_number": "string",
    "address2": "string"
  }
}'
const response = await fetch('https://api.zenoti.com/v1/guests/{guest_id}/accounts', {
  method: 'POST',
  headers: {
    'Authorization': 'bearer {{access_token}}',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
  center_id: 'string',
  redirect_uri: 'string',
  source: '1',
  host: 'string',
  avs_source: 'string',
  billing_info: {
    first_name: 'string',
    last_name: 'string',
    email: 'string',
    country: 'string',
    name: 'string',
    address: 'string',
    state: 'string',
    zipcode: 'string',
    city: 'string',
    phone: 'string',
    house_number: 'string',
    address2: 'string'
  }
})
});
const data = await response.json();
import requests

response = requests.post(
    'https://api.zenoti.com/v1/guests/{guest_id}/accounts',
    headers={
        'Authorization': 'bearer {{access_token}}',
    },
    json={'center_id': 'string', 'redirect_uri': 'string', 'source': '1', 'host': 'string', 'avs_source': 'string', 'billing_info': {'first_name': 'string', 'last_name': 'string', 'email': 'string', 'country': 'string', 'name': 'string', 'address': 'string', 'state': 'string', 'zipcode': 'string', 'city': 'string', 'phone': 'string', 'house_number': 'string', 'address2': 'string'}}
)
data = response.json()
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "bearer {{access_token}}");
var content = new StringContent(
    JsonSerializer.Serialize(new {
    center_id = "string",
    redirect_uri = "string",
    source = "1",
    host = "string",
    avs_source = "string",
    billing_info = new {
        first_name = "string",
        last_name = "string",
        email = "string",
        country = "string",
        name = "string",
        address = "string",
        state = "string",
        zipcode = "string",
        city = "string",
        phone = "string",
        house_number = "string",
        address2 = "string"
    }
}),
    Encoding.UTF8, "application/json");
var response = await client.PostAsync(
    "https://api.zenoti.com/v1/guests/{guest_id}/accounts", content);
var data = await response.Content.ReadAsStringAsync();
require 'net/http'
require 'json'

uri = URI('https://api.zenoti.com/v1/guests/{guest_id}/accounts')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'bearer {{access_token}}'
request['Content-Type'] = 'application/json'
request.body = { center_id: 'string', redirect_uri: 'string', source: '1', host: 'string', avs_source: 'string', billing_info: { first_name: 'string', last_name: 'string', email: 'string', country: 'string', name: 'string', address: 'string', state: 'string', zipcode: 'string', city: 'string', phone: 'string', house_number: 'string', address2: 'string' } }.to_json
response = http.request(request)
data = JSON.parse(response.body)

Error codes

Status Description
401 Unauthorized -- invalid or expired access token
429 Too many requests -- rate limit exceeded