# Offline payments tools

[All tool areas](/docs/tools.md). Each tool acts within your access.

## Offline payments

### mark_refund_given

Mark a refund Lokl owes a guest at the desk as given back: when a session is called off or moved with refunds, the part of a booking paid at the desk (cash, debit, an e-transfer, a cheque, the venue's card machine, a voucher) is owed back, shown in the Inbox's Needs action (list_inbox, kind desk_refund, with its refundId). Hand it over the same way it was paid, then mark it here: it records who gave it back and when, and leaves Needs action. Needs refunds:create and orders:amounts where the booking is. Undo puts it back as owed within 15 minutes, until something else is paid or refunded on the booking. Returns a preview to confirm.

Changes · Members of an organization · Needs orders:amounts, refunds:create

#### Input

- `refundId` — string; required. The refund's id

#### Output

- `refund` — object; required. 
  - `refund.id` — string; required. The refund, rfd_…
  - `refund.orderId` — string; required. 
  - `refund.tender` — string; required. How the payment was made, and so how it's given back Allowed: "card\_terminal", "cash", "debit", "e\_transfer", "cheque", "voucher"
  - `refund.amount` — integer; required. Minor units (cents) in the location's currency
  - `refund.currency` — string; required. 
  - `refund.status` — string; required. succeeded once given back; pending while it's owed Allowed: "pending", "succeeded"
  - `refund.givenBy` — string or null; required. The member (usr_…) who gave it back
  - `refund.givenAt` — string or null; required.  format: "date-time"
- `order` — object; required. The booking as list_bookings shows it, after it
  - `order.id` — string; required. 
  - `order.code` — string; required. The booking code guests quote
  - `order.status` — string; required.  Allowed: "pending", "confirmed", "canceled"
  - `order.cancelReason` — string or null; required.  Allowed: "seats\_unavailable", "guest\_request", "session\_canceled", "duplicate", "other"
  - `order.cancelNote` — string or null; required. Staff's own words. Null without orders:amounts
  - `order.createdAt` — string; required.  format: "date-time"
  - `order.confirmedAt` — string or null; required.  format: "date-time"
  - `order.canceledAt` — string or null; required.  format: "date-time"
  - `order.customer` — object; required. 
    - `order.customer.id` — string; required. 
    - `order.customer.name` — string; required. The first name only, without customers:contact
    - `order.customer.email` — string or null; required. Null without customers:contact
    - `order.customer.phone` — string or null; required. Null without customers:contact, or when there's none
    - `order.customer.contactHidden` — boolean; required. True when email and phone are hidden from you (you lack customers:contact here). False with a null email or phone means the guest gave none
  - `order.product` — object; required. 
    - `order.product.id` — string; required. 
    - `order.product.name` — string; required. 
  - `order.location` — object; required. 
    - `order.location.id` — string; required. 
    - `order.location.name` — string; required. 
    - `order.location.timeZone` — string; required. 
  - `order.session` — object; required. 
    - `order.session.id` — string; required. 
    - `order.session.startsAt` — string; required.  format: "date-time"
    - `order.session.when` — string; required. In the location's time zone
  - `order.partySize` — integer; required.  minimum: -9007199254740991; maximum: 9007199254740991
  - `order.currency` — string; required. 
  - `order.total` — integer or null; required. Null without orders:amounts
  - `order.paid` — integer or null; required. Null without orders:amounts
  - `order.refunded` — integer or null; required. Refunded or on its way back. Null without orders:amounts
  - `order.kept` — integer or null; required. Fees sold as non-refundable (the service charge) and their tax, kept on staff refunds, as far as the money is still held: 0 once everything paid has come back, refunded or as a credit in its place (a session the operator moved or called off), and none on an order canceled before it was booked. Null without orders:amounts
  - `order.refundable` — integer or null; required. What staff can still refund: paid, less refunds, less a credit given in place of a refund (a session moved or called off), less what's kept. Null without orders:amounts
  - `order.refunds` — array; required. 
    - `order.refunds[]` — object; optional. 
      - `order.refunds[].id` — string; required. 
      - `order.refunds[].amount` — integer or null; required. Null without orders:amounts
      - `order.refunds[].status` — string; required. pending (on its way), succeeded, failed, or reversed: given as a credit or gift certificate that was voided unused since, so it was taken back and isn't counted as refunded Allowed: "pending", "succeeded", "failed", "reversed"
      - `order.refunds[].reason` — string or null; required.  Allowed: "seats\_unavailable", "guest\_request", "session\_canceled", "service\_issue", "duplicate", "goodwill", "other"
      - `order.refunds[].note` — string or null; required. Staff's own words. Null without orders:amounts
      - `order.refunds[].failureReason` — string or null; required. 
      - `order.refunds[].createdAt` — string; required.  format: "date-time"
      - `order.refunds[].tender` — string; optional. What the refunded payment was made with: card (back to the guest's card), gift_certificate or credit (back to it), or an offline tender (card_terminal, cash, debit, e_transfer, cheque), which staff gave back that way at the desk; a voucher's part is given back as a credit (creditId), and a guest's own refund under the booking's refundDestination as a credit (creditId) or gift certificate (giftCertificateId) instead of back to the card or the desk Allowed: "card", "gift\_certificate", "credit", "card\_terminal", "cash", "debit", "e\_transfer", "cheque", "voucher"
      - `order.refunds[].creditId` — string or null; optional. The credit this refund became instead of going back where it was paid: a third party's voucher can't be handed back, so its part is a credit (voucher_refunded); a guest's own cancellation or change under refundDestination credit gives one (guest_change). The same credit the booking's credits list shows. Null for every other refund. Always present
      - `order.refunds[].giftCertificateId` — string or null; optional. The gift certificate (kind refund) this refund became instead of going back where it was paid: a guest's own cancellation or change under refundDestination gift_certificate. Null for every other refund. Always present
      - `order.refunds[].issuer` — string or null; optional. Who issued the voucher the refunded payment was (such as Costco); null for any other tender, and without orders:amounts. Always present
  - `order.bookingId` — string or null; optional. Null until it's booked. Always present
  - `order.booker` — string; optional. Who made it: a guest at checkout, or staff. Always present Allowed: "customer", "staff"
  - `order.balanceDue` — integer or null; optional. What's still owing. Above 0 on a staff booking with payment to come, or seats added since: confirmed isn't paid. Null without orders:amounts. Always present
  - `order.overPaid` — integer or null; optional. What's been paid beyond the total: seats removed, which refunds nothing by itself. Null without orders:amounts. Always present
  - `order.paymentStatus` — string or null; optional. unpaid, partly_paid, paid, over_paid, refunded (all but any kept fee has gone back), or nothing_due, from what's actually been paid. A partial refund stays paid. Null without orders:amounts. Always present Allowed: "unpaid", "partly\_paid", "paid", "over\_paid", "refunded", "nothing\_due"
  - `order.staffNote` — string or null; optional. Staff's own note, never shown to the guest. Null without orders:amounts, or when there's none. Always present

### record_payment

Record money taken outside Lokl's online checkout against a confirmed booking: a card on the venue's own machine (card_terminal), cash, debit, an e-transfer, a cheque, or a third party's voucher (Costco, WagJag: give its issuer and its code in reference). `amount` in minor units, at most the balance due (list_bookings' balanceDue); a reference (an e-transfer's, a cheque's number, a terminal's receipt number) is optional except for a voucher; `note` is staff's own, never shown to the guest. Needs bookings:write and orders:amounts where the booking is; someone who may book walk-ins there (bookings:write and products:read) without amounts may record up to what that booking owes. A checkout still waiting on its online payment, a canceled order, and a gift certificate purchase are refused. The guest is emailed a receipt when the booking has an address. Undo removes it within 15 minutes, until it's refunded or something else is paid or refunded on the booking. Returns a preview to confirm; applying it is refused if what's owed has changed since.

Changes · Members of an organization · Needs bookings:write

#### Input

- `orderId` — string; required. The order's id, from list_bookings or list_orders
- `tender` — string; required. card_terminal: the venue's own card machine (card at the desk); cash; debit; e_transfer; cheque; voucher: a third party's (Costco, WagJag), with its issuer and code Allowed: "card\_terminal", "cash", "debit", "e\_transfer", "cheque", "voucher"
- `amount` — integer; required. Minor units in the order's currency, at most the balance due exclusiveMinimum: 0
- `reference` — string; optional. An e-transfer's reference, a cheque's number, a voucher's code (required for voucher), or a terminal's receipt number minLength: 1; maxLength: 100
- `issuer` — string; optional. Who issued a voucher, such as Costco or WagJag. Required for voucher, and only for it minLength: 1; maxLength: 100
- `note` — string; optional. Staff's own note. Never shown to the guest minLength: 1; maxLength: 500
- `invoiceId` — string; optional. The invoice it pays (ivc_…). Required when the booking has more than one invoice with something owed; with one, it goes to that one. The amount is capped by both the invoice's balance and the booking's

#### Output

- `payment` — object; required. 
  - `payment.id` — string; required. The payment, pay_…
  - `payment.orderId` — string; required. 
  - `payment.tender` — string; required.  Allowed: "card\_terminal", "cash", "debit", "e\_transfer", "cheque", "voucher"
  - `payment.amount` — integer; required. Minor units (cents) in the location's currency
  - `payment.currency` — string; required. 
  - `payment.reference` — string or null; required. 
  - `payment.issuer` — string or null; required. 
  - `payment.note` — string or null; required. Staff's own note, never shown to the guest
  - `payment.recordedBy` — string or null; required. The member's user id (usr_…) who recorded it
  - `payment.createdAt` — string; required.  format: "date-time"
- `order` — object; required. The booking as list_bookings shows it, after the payment: balanceDue and paymentStatus
  - `order.id` — string; required. 
  - `order.code` — string; required. The booking code guests quote
  - `order.status` — string; required.  Allowed: "pending", "confirmed", "canceled"
  - `order.cancelReason` — string or null; required.  Allowed: "seats\_unavailable", "guest\_request", "session\_canceled", "duplicate", "other"
  - `order.cancelNote` — string or null; required. Staff's own words. Null without orders:amounts
  - `order.createdAt` — string; required.  format: "date-time"
  - `order.confirmedAt` — string or null; required.  format: "date-time"
  - `order.canceledAt` — string or null; required.  format: "date-time"
  - `order.customer` — object; required. 
    - `order.customer.id` — string; required. 
    - `order.customer.name` — string; required. The first name only, without customers:contact
    - `order.customer.email` — string or null; required. Null without customers:contact
    - `order.customer.phone` — string or null; required. Null without customers:contact, or when there's none
    - `order.customer.contactHidden` — boolean; required. True when email and phone are hidden from you (you lack customers:contact here). False with a null email or phone means the guest gave none
  - `order.product` — object; required. 
    - `order.product.id` — string; required. 
    - `order.product.name` — string; required. 
  - `order.location` — object; required. 
    - `order.location.id` — string; required. 
    - `order.location.name` — string; required. 
    - `order.location.timeZone` — string; required. 
  - `order.session` — object; required. 
    - `order.session.id` — string; required. 
    - `order.session.startsAt` — string; required.  format: "date-time"
    - `order.session.when` — string; required. In the location's time zone
  - `order.partySize` — integer; required.  minimum: -9007199254740991; maximum: 9007199254740991
  - `order.currency` — string; required. 
  - `order.total` — integer or null; required. Null without orders:amounts
  - `order.paid` — integer or null; required. Null without orders:amounts
  - `order.refunded` — integer or null; required. Refunded or on its way back. Null without orders:amounts
  - `order.kept` — integer or null; required. Fees sold as non-refundable (the service charge) and their tax, kept on staff refunds, as far as the money is still held: 0 once everything paid has come back, refunded or as a credit in its place (a session the operator moved or called off), and none on an order canceled before it was booked. Null without orders:amounts
  - `order.refundable` — integer or null; required. What staff can still refund: paid, less refunds, less a credit given in place of a refund (a session moved or called off), less what's kept. Null without orders:amounts
  - `order.refunds` — array; required. 
    - `order.refunds[]` — object; optional. 
      - `order.refunds[].id` — string; required. 
      - `order.refunds[].amount` — integer or null; required. Null without orders:amounts
      - `order.refunds[].status` — string; required. pending (on its way), succeeded, failed, or reversed: given as a credit or gift certificate that was voided unused since, so it was taken back and isn't counted as refunded Allowed: "pending", "succeeded", "failed", "reversed"
      - `order.refunds[].reason` — string or null; required.  Allowed: "seats\_unavailable", "guest\_request", "session\_canceled", "service\_issue", "duplicate", "goodwill", "other"
      - `order.refunds[].note` — string or null; required. Staff's own words. Null without orders:amounts
      - `order.refunds[].failureReason` — string or null; required. 
      - `order.refunds[].createdAt` — string; required.  format: "date-time"
      - `order.refunds[].tender` — string; optional. What the refunded payment was made with: card (back to the guest's card), gift_certificate or credit (back to it), or an offline tender (card_terminal, cash, debit, e_transfer, cheque), which staff gave back that way at the desk; a voucher's part is given back as a credit (creditId), and a guest's own refund under the booking's refundDestination as a credit (creditId) or gift certificate (giftCertificateId) instead of back to the card or the desk Allowed: "card", "gift\_certificate", "credit", "card\_terminal", "cash", "debit", "e\_transfer", "cheque", "voucher"
      - `order.refunds[].creditId` — string or null; optional. The credit this refund became instead of going back where it was paid: a third party's voucher can't be handed back, so its part is a credit (voucher_refunded); a guest's own cancellation or change under refundDestination credit gives one (guest_change). The same credit the booking's credits list shows. Null for every other refund. Always present
      - `order.refunds[].giftCertificateId` — string or null; optional. The gift certificate (kind refund) this refund became instead of going back where it was paid: a guest's own cancellation or change under refundDestination gift_certificate. Null for every other refund. Always present
      - `order.refunds[].issuer` — string or null; optional. Who issued the voucher the refunded payment was (such as Costco); null for any other tender, and without orders:amounts. Always present
  - `order.bookingId` — string or null; optional. Null until it's booked. Always present
  - `order.booker` — string; optional. Who made it: a guest at checkout, or staff. Always present Allowed: "customer", "staff"
  - `order.balanceDue` — integer or null; optional. What's still owing. Above 0 on a staff booking with payment to come, or seats added since: confirmed isn't paid. Null without orders:amounts. Always present
  - `order.overPaid` — integer or null; optional. What's been paid beyond the total: seats removed, which refunds nothing by itself. Null without orders:amounts. Always present
  - `order.paymentStatus` — string or null; optional. unpaid, partly_paid, paid, over_paid, refunded (all but any kept fee has gone back), or nothing_due, from what's actually been paid. A partial refund stays paid. Null without orders:amounts. Always present Allowed: "unpaid", "partly\_paid", "paid", "over\_paid", "refunded", "nothing\_due"
  - `order.staffNote` — string or null; optional. Staff's own note, never shown to the guest. Null without orders:amounts, or when there's none. Always present
