POST

Customer.Appointments.ApplyCoupon

Apply selected coupon id(s) for the logged-in customer and return amount / left_amount totals. Same as dashboard get_coupon_amount_for_customer_appointment when Apply is clicked.

Permissions

  • User must be logged in with a valid bearer token.
  • The user must be from the same company domain as the request Host (call the API on that account subdomain or allowed custom domain). A token from another company returns success=0, error user_not_in_company.
  • Returned or changed records are limited by the user permissions, team access, folder access, and account settings.

Action

  • Runs the Customer.Appointments.ApplyCoupon function and returns JSON.

Push Service

No push is sent because this function only reads data or returns helper information.

Automation

No automation is run for this function.

Special Instructions

  • On a company subdomain (e.g. https://{user_domain}.bull36.com) the user must match that Host — Login and protected APIs reject another company with success=0, error user_not_in_company. On a main brand host (bull36.com, biz1.co.il, mastrocrm.com, …) the company domain gate is skipped.
  • Requires Customer.Login token. Coupons must belong to JWT c_id.
  • Staff alias: AppointmentCoupon.Apply (also accepts customer tokens; scoped to c_id for clients).
  • If a coupon already has a tax invoice PDF, returns success=0 like the dashboard.

Required Parameters

NameTypeSampleExplanation
coupon_ids
post
array|string388,389One or more coupon ids. Aliases: coupon_id, data_id, id.

Optional Parameters

No optional body parameters are defined for this function.

Authentication

Send the bearer token returned by Login in the request header. The user must be from the same company domain as this Host — a token from another company is rejected (user_not_in_company).

Authorization: Bearer YOUR TOKEN

Sample Request

{
    "url": "\/app\/Customer.Appointments.ApplyCoupon",
    "method": "POST",
    "headers": {
        "Authorization": "Bearer YOUR TOKEN"
    },
    "body": {
        "coupon_ids": [
            "388"
        ]
    },
    "url_user": "https:\/\/{user}.bull36.com\/app\/Customer.Appointments.ApplyCoupon",
    "url_domain": "https:\/\/{domain}\/app\/Customer.Appointments.ApplyCoupon"
}

Endpoint

POST /app/Customer.Appointments.ApplyCoupon
POST https://{user}.bull36.com/app/Customer.Appointments.ApplyCoupon
POST https://{domain}/app/Customer.Appointments.ApplyCoupon

Sample Output

{
    "success": 1,
    "amount": 100,
    "left_amount": 50,
    "coupon_ids": {
        "388": {
            "amount": "100",
            "left_amount": "50"
        }
    }
}

JavaScript Example

const token = 'YOUR TOKEN';
const body = new URLSearchParams();
body.set('coupon_ids', '388');

const res = await fetch('/app/Customer.Appointments.ApplyCoupon', {
  method: 'POST',
  headers: { Authorization: `Bearer ${token}` },
  body
});
const data = await res.json();
console.log(data);

Error Example

{
    "success": 0,
    "message": "Coupon not found"
}