### Initialize GoTab Wallet Source: https://docs.gotab.io/guides/gotab-wallet Complete example demonstrating the HTML structure and JavaScript configuration required to mount the wallet interface. ```html My Wallet
``` -------------------------------- ### Quantity Rule Examples Source: https://docs.gotab.io/guides/create-a-new-tab Demonstrates the correct way to specify quantity for multiple units of the same product versus the incorrect approach. ```json "items": [ { "productUuid": "prd_abc", "quantity": 1 }, { "productUuid": "prd_abc", "quantity": 1 } ] ``` ```json "items": [ { "productUuid": "prd_abc", "quantity": 2 } ] ``` -------------------------------- ### ACCRUAL Event Request Example Source: https://docs.gotab.io/guides/gotab-loyalty-api Example of the JSON payload sent by GoTab for an ACCRUAL event type. This request includes detailed tab, order, item, and customer information. ```json { "method": "POST", "headers": { "Content-Type": "application/json", "Authorization": "example_auth_header_123", "x-api-key": "null" }, "json": true, "body": { "tab_data": { "tab_id": "9200", "tab_uuid": "tOp_3qizc55ojTehKtoGGKZc", "location_id": "100800", "name": "Test User", "spots": ["109104"], "status": "CLOSED", "total": 1619, "subtotal": 1295, "tax": 130, "balance_due": 0, "created": "2025-02-17T13:10:51.759Z", "orders": [ { "tax": 130, "name": "Test User", "notes": null, "total": 1619, "placed": "2025-02-17T13:10:59.358228-05:00", "status": "SCHEDULED", "spot_id": 109104, "user_id": null, "zone_id": 16866, "order_id": 72970599, "subtotal": 1295, "scheduled": "2025-02-17T13:10:59.358228-05:00", "spot_name": "Bar 101", "x_spot_id": null, "x_zone_id": null, "zone_name": "Bar", "zone_type": null, "address_id": null, "dispatched": null, "display_id": null, "order_uuid": "or_WjMDstvFo3HGAC2Ef1qZcvBd", "customer_id": 21569877, "dropoff_eta": null, "location_id": 100800, "spot_user_id": null, "spot_url_name": "bar-101", "zone_group_id": 2425, "zone_group_type": "DINING", "spot_agent_configs": null, "zone_agent_configs": null } ], "items": [ { "fee": false, "tax": 130, "notes": {}, "comped": false, "status": "OPEN", "tab_id": 9200, "x_name": "BBQ Brisket", "created": "2025-02-17T13:10:54.209875", "item_id": 16828, "options": {}, "order_id": 72970599, "prepared": null, "recalled": null, "subtotal": 1295, "tax_rate": 0.1, "discounts": false, "prep_time": 0, "x_item_id": null, "dispatched": null, "product_id": 17680342, "router_ids": [2203], "unit_price": 1295, "x_metadata": null, "x_quantity": 1, "category_id": 55060, "product_tags": ["60employee"], "product_type": "DEFAULT", "product_uuid": "prd_1L4pqUUNkJlDC8cV2d~EtweQ", "x_product_id": null, "adjust_reason": null, "category_name": "Lunch Sandwiches", "item_subtotal": 1295, "order_rule_id": null, "product_delay": null, "x_item_details": {}, "x_product_name": null, "product_options": {}, "tax_rate_detail": [ { "rate": 0.1, "tax_id": 801, "weight": 1, "tax_name": "Tax" } ], "true_unit_price": 1295, "true_x_quantity": 1, "x_price_level_id": null, "product_base_price": 1295, "x_product_base_price": null, "order_rule_discount_percentage": null } ], "adjustments": [], "payments": [ { "amount": 1619, "tip": 130, "name": "TEST USER", "autograt": 194, "created": "2025-02-17T13:10:58.447506-05:00", "customer_id": 21569877 } ], "customers": { "tabOwnerIsPOSUser": false, "tabOwnerCustomerId": "21569877", "allCustomersOnTab": [ { "tab_id": "9200", "customer_id": "21569877", "created": "2025-02-17T13:10:51.759Z", "tab_viewed": "2025-02-17T13:10:51.851Z", "handle": "+16082139087", "protocol": "s", "email": null } ] }, "tab_metadata": null }, "event_type": "ACCRUAL" } } ``` -------------------------------- ### Open Item Structure Source: https://docs.gotab.io/guides/create-a-new-tab Example of an ad-hoc item definition requiring name, quantity, and unit price. ```json { "name": "Custom Catering Fee", "quantity": 1, "unitPrice": 5000, "taxRate": 0.085, "externalId": "catering-fee-001" } ``` -------------------------------- ### REVERSAL Response Examples Source: https://docs.gotab.io/guides/gotab-promo-api Success and error response structures for reversal events. ```json { "reversal_id": 90909 } ``` ```json { "message": "Offer reversal failed for this reason." } ``` -------------------------------- ### Example authentication response Source: https://docs.gotab.io/getting-started/authentication The JSON response body returned after a successful token request. ```json { "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...", "token_type": "Bearer", "expires_in": 86400 } ``` -------------------------------- ### GET /api/rebuild Source: https://docs.gotab.io/reference/adding-docs Retrieves a list of all currently registered documentation sources. ```APIDOC ## GET /api/rebuild ### Description Retrieves a list of all currently registered documentation sources. ### Method GET ### Endpoint https://docs.gotab.org/api/rebuild ``` -------------------------------- ### GET /integrations/customers Source: https://docs.gotab.io/api-reference Retrieves a list of customers from the GoTab platform. ```APIDOC ## GET /integrations/customers ### Description List customers associated with the account. ### Method GET ### Endpoint /integrations/customers ``` -------------------------------- ### Pagination Request and Response Variables Source: https://docs.gotab.io/concepts/pagination Example variables for the initial request and subsequent requests using the endCursor from the previous response. ```json { "limit": 25, "cursor": null, "createdAfter": "2024-01-01" } ``` ```json { "data": { "tabs": { "nodes": [ /* 25 tabs */ ], "pageInfo": { "endCursor": "WyJwcmltYXJ5X2tleV9hc2MiLFs4NjAyNzMyXV0=", "hasNextPage": true } } } } ``` ```json { "limit": 25, "cursor": "WyJwcmltYXJ5X2tleV9hc2MiLFs4NjAyNzMyXV0=", "createdAfter": "2024-01-01" } ``` -------------------------------- ### Refresh Access Token Source: https://docs.gotab.io/api-reference Example request to generate a new access token using a refresh token. ```shell curl https://gotab.io/api/oauth/refresh \ --request POST \ --header 'Content-Type: application/json' \ --data '{ "token": "" }' ``` -------------------------------- ### Example Webhook Request Source: https://docs.gotab.io/concepts/webhooks A sample HTTP POST request sent by the GoTab webhook system, including standard headers and a JSON body. ```http POST /webhook/endpoint HTTP/2 Host: localhost:5000 User-Agent: GoTab-WebhookAgent/1.0 Content-Type: application/json X-GoTab-Event-Type: ORDER_PLACED X-GoTab-Event-Target-UUID: ord_xxxxxxxxx X-GoTab-Event-Target-ID: 12345 X-GoTab-Application-ID: int_xxxxxxx X-GoTab-Signature: [SHA-256 HMAC HEX] { "type": "ORDER_PLACED", "targetUuid": "ord_xxxxxxxxx", "targetId": "12345", "locationUuid": "loc_xxxxxxxxx", "locationName": "Main Street Location", "locationId": "67890", "createdAt": "2023-01-01T00:00:00.000Z", "data": { ... } } ``` -------------------------------- ### GET /manager/oauth Source: https://docs.gotab.io/concepts/oauth-flows Directs the user to the GoTab authorization endpoint to initiate the OAuth flow. ```APIDOC ## GET /manager/oauth ### Description Directs the user to the authorization endpoint to grant the integration access to their account. ### Method GET ### Endpoint https://gotab.io/manager/oauth ### Parameters #### Query Parameters - **response_type** (string) - Required - Must be 'code' - **access_id** (string) - Required - Your api_access_id - **redirect_url** (string) - Required - Must exactly match a URL configured in the Integration Dashboard - **state** (string) - Optional - A random value (e.g. UUID) to prevent CSRF ``` -------------------------------- ### GET /api/knowledge Source: https://docs.gotab.io/reference/adding-docs Retrieves knowledge base articles with support for category filtering. ```APIDOC ## GET /api/knowledge ### Description Returns knowledge base articles in JSON format. Supports filtering by category. ### Method GET ### Endpoint /api/knowledge ``` -------------------------------- ### GET /llms.txt Source: https://docs.gotab.io/reference/adding-docs Retrieves an index of all pages on the site, including their titles and URLs. ```APIDOC ## GET /llms.txt ### Description Returns a text-based index of all pages available on the site, listing their titles and corresponding URLs. ### Method GET ### Endpoint /llms.txt ``` -------------------------------- ### Handle Payment Success Callback Source: https://docs.gotab.io/guides/gotab-wallet Example implementation of the onPaymentSuccess callback to process transaction details. ```javascript onPaymentSuccess: (data) => { const payment = data.payments[0]; const totalDollars = (payment.amount + payment.customer_fee) / 100; console.log(`Charged: $${totalDollars.toFixed(2)}`); console.log(`Payment ID: ${payment.payment_id}`); console.log(`Card Type: ${payment.payment_type}`); } ``` -------------------------------- ### Catalog Item Structure Source: https://docs.gotab.io/guides/create-a-new-tab Example of a standard catalog item object requiring a product identifier and quantity. ```json { "product": { "productUuid": "prd_utucyIkdVyqOwgK4o2KKY819" }, "quantity": 2, "itemUnits": "pints", "modifiers": [] } ``` -------------------------------- ### GET /llms-full.txt Source: https://docs.gotab.io/reference/adding-docs Retrieves the full content of all pages on the site concatenated into a single text file. ```APIDOC ## GET /llms-full.txt ### Description Returns the full content of all pages on the site, concatenated into a single text format for easy ingestion. ### Method GET ### Endpoint /llms-full.txt ``` -------------------------------- ### initAddCardForm(container, config) Source: https://docs.gotab.io/guides/payment-sdk Mounts an “Add Card” form into the specified container, handling VGS Collect setup, form fields, styling, and submission. ```APIDOC ## initAddCardForm(container, config) ### Description Mounts an “Add Card” form into the specified container, handling VGS Collect setup, form fields, styling, and submission. ### Parameters - **container** (HTMLElement | string) - Required - DOM element or CSS selector for rendering the form. - **config** (PaymentsSDKConfig) - Required - Configuration object. ``` -------------------------------- ### GraphQL Connection Pagination Source: https://docs.gotab.io/concepts/pagination Example of a paginated GraphQL query using the tabs connection, including the required variables for cursor-based navigation. ```APIDOC ## GraphQL Query: paginatedTabs ### Description Fetches a paginated list of tabs using cursor-based pagination. The query returns nodes and pageInfo, which contains the endCursor needed for the next page request. ### Query ```graphql query paginatedTabs($limit: Int, $cursor: Cursor, $createdAfter: Datetime) { tabs( first: $limit after: $cursor filter: { created: { greaterThanOrEqualTo: $createdAfter } } ) { nodes { name tabUuid created } pageInfo { endCursor hasNextPage } } } ``` ### Parameters - **limit** (Int) - Optional - Number of items to return per page. - **cursor** (Cursor) - Optional - The cursor string from the previous page's endCursor. - **createdAfter** (Datetime) - Optional - Filter for tabs created after a specific date. ### Response - **nodes** (Array) - The list of tab objects. - **pageInfo** (Object) - Pagination metadata containing endCursor and hasNextPage. ``` -------------------------------- ### Conditional Content Visibility Source: https://docs.gotab.io/reference/adding-docs Example of using the internal directive to restrict content visibility to internal employees. ```markdown This content is visible on both sites. :::internal This section is only visible to GoTab employees on docs.gotab.org. On docs.gotab.io it's stripped at build time — it never reaches the browser. ::: This content is also visible on both sites. ``` -------------------------------- ### initWallet(container, config) Source: https://docs.gotab.io/guides/gotab-wallet Mounts the GoTab Wallet interface into the specified DOM container using the provided configuration. ```APIDOC ## initWallet(container, config) ### Description Mounts the GoTab Wallet interface into the specified container. This creates an embedded iframe and establishes secure communication for payment operations. ### Parameters #### container (HTMLElement | string) - Required: Yes - Description: DOM element or CSS selector for rendering the wallet. #### config (WalletConfig) - Required: Yes - Description: Configuration object for the wallet. ### WalletConfig Properties - **clientApiAccessId** (string) - Required - Your client-side API access ID. - **clientApiAccessSecret** (string) - Required - Your client-side API access secret. - **tabUuid** (string) - Required - UUID of the tab associated with this wallet session. - **paymentSessionId** (string) - Required - Payment session ID for authenticating wallet operations. - **domainName** (string) - Required - Domain name of the website that contains the iframe. - **onPaymentSuccess** ((data) => void) - Required - Callback function executed on successful payment. - **paymentSessionToken** (string) - Optional - Payment session token if customer is already verified. - **customerId** (string) - Optional - Customer ID if customer is already verified. - **theme** (string) - Optional - Theme identifier for styling the wallet interface. ``` -------------------------------- ### Expose local server with ngrok Source: https://docs.gotab.io/concepts/webhooks Use ngrok to create a public URL that forwards requests to your local development server. ```bash ngrok http 3000 # Gives you: https://abc123.ngrok.io → forward to localhost:3000 ``` -------------------------------- ### Validation Error Detail Structure Source: https://docs.gotab.io/concepts/error-handling Example of the details array for 422 errors. ```json { "error": "validation_failed", "statusCode": 422, "details": [ { "field": "locationUuid", "message": "Invalid UUID format" }, { "field": "total", "message": "Must be a positive number" } ] } ``` -------------------------------- ### Documentation Build Workflow Source: https://docs.gotab.io/reference/adding-docs Visual representation of the CI build process pulling documentation from a registered repository. ```text your-repo/docs/ ──registered──→ sources.json ──CI build──→ pulls docs/ (pointer only) from your repo │ builds both sites ├─ docs.gotab.org (all) └─ docs.gotab.io (public only) ``` -------------------------------- ### Initialize Add Card Form Source: https://docs.gotab.io/guides/payment-sdk HTML implementation for rendering a secure card entry form using the GoTab Payments SDK. ```html Checkout
``` -------------------------------- ### GitHub Actions Workflow for Documentation Source: https://docs.gotab.io/reference/adding-docs Automate documentation publishing by triggering a rebuild via the GoTab API on push events. ```yaml name: Publish Docs on: push: branches: [main] paths: ['docs/**'] jobs: publish: runs-on: ubuntu-latest steps: - name: Register and rebuild docs run: | curl -sf -X POST https://docs.gotab.org/api/rebuild \ -H "Content-Type: application/json" \ -H "Authorization: Bearer ${{ secrets.DOCS_API_TOKEN }}" \ -d '{ "source": "GoTab-Inc/${{ github.event.repository.name }}", "path": "docs" }' ``` -------------------------------- ### Create a Deposit Tab via cURL Source: https://docs.gotab.io/guides/reservation-integration Use this POST request to create a deposit tab in GoTab. Ensure the reservation_token and item notes are populated to allow staff to identify and apply deposits to the day-of tab. ```bash curl --request POST \ --url "https://gotab.io/api/loc//tabs" \ --header "Authorization: Bearer " \ --header "Content-Type: application/json" \ --data '{ "openTab": true, "phoneNumber": "", "spotUuid": "", "name": "", "items": [ { "product": { "productUuid": "" }, "quantity": 1, "name": "", "unitPrice": "", "notes": { "reservations_r_us": { "reservation_token": "", "customer_name": "", "customer_handle": "", "reservation_end": "12/12/2025 12:00 PM", -- these should be dynamic as well, but follow this format "reservation_date": "2025-12-12", "reservation_start": "12/12/2054 1:00 PM", } } } ] }' ``` -------------------------------- ### GraphQL response structure Source: https://docs.gotab.io/guides/graphql-intro Example of the JSON object returned by the server, containing the requested data. ```json { "data": { "locationsList": [ { "locationUuid": "loc_abc123", "name": "Main Street" }, { "locationUuid": "loc_def456", "name": "Downtown" } ] } } ``` -------------------------------- ### Webhook Signature Verification Source: https://docs.gotab.io/concepts/webhooks Example implementation for verifying the X-GoTab-Signature header to ensure request authenticity. ```APIDOC ## Signature Verification ### Description Verify the `X-GoTab-Signature` header using HMAC SHA256 to ensure the request originated from GoTab. ### Implementation ```javascript import crypto from 'crypto'; function verifySignature(rawBody, secret, signatureHeader) { const expected = crypto .createHmac('sha256', secret) .update(rawBody) .digest('hex'); return crypto.timingSafeEqual( Buffer.from(expected), Buffer.from(signatureHeader) ); } ``` ``` -------------------------------- ### Initialize PaymentsSDKConfig with Styles Source: https://docs.gotab.io/guides/payment-sdk Apply the style overrides to specific fields within the formProps configuration object. ```javascript const config = { clientApiAccessId: 'YOUR_CLIENT_API_ACCESS_ID', clientApiAccessSecret: 'YOUR_CLIENT_API_ACCESS_SECRET', customerProfileUuid: 'CUSTOMER_PROFILE_UUID', locationUuid: 'LOCATION_UUID', formProps: { first_name: { placeholder: 'First name', ...styleOverrides }, last_name: { placeholder: 'Last name', ...styleOverrides }, email: { placeholder: 'Email', ...styleOverrides }, card_number: { placeholder: 'Card number', showCardIcon: true, ...styleOverrides }, cvc: { placeholder: 'CVC', showCardIcon: true, ...styleOverrides }, card_exp: { placeholder: 'MM / YYYY', ...styleOverrides }, zip: { placeholder: 'ZIP code', ...styleOverrides } }, onLoading: isLoading => { /* e.g. show spinner */ }, onSuccess: (status, data) => { /* handle added card */ }, onError: error => { /* handle error */ }, stateCallback: state => { /* field-level updates */ } }; ``` -------------------------------- ### Manage Documentation Sources via Rebuild API Source: https://docs.gotab.io/reference/adding-docs Use these cURL commands to register, list, or unregister documentation sources. Requires an Authorization header with a Bearer sso_ token. ```bash curl -X POST https://docs.gotab.org/api/rebuild \ -H "Content-Type: application/json" \ -H "Authorization: Bearer sso_..." \ -d '{ "source": "GoTab-Inc/my-service", "path": "docs" }' ``` ```bash curl https://docs.gotab.org/api/rebuild \ -H "Authorization: Bearer sso_..." ``` ```bash curl -X DELETE https://docs.gotab.org/api/rebuild \ -H "Content-Type: application/json" \ -H "Authorization: Bearer sso_..." \ -d '{ "source": "GoTab-Inc/my-service" }' ``` -------------------------------- ### GET /api/loc/{locationUuid}/menus Source: https://docs.gotab.io/getting-started/first-call Fetch available menus for a specific location using its locationUuid. ```APIDOC ## GET /api/loc/{locationUuid}/menus ### Description Use the locationUuid to fetch available menus for that location. ### Method GET ### Endpoint https://gotab.io/api/loc/{locationUuid}/menus ### Parameters #### Path Parameters - **locationUuid** (string) - Required - The unique identifier for the location ``` -------------------------------- ### Create a Scheduled Tab Source: https://docs.gotab.io/guides/create-a-new-tab Use this request for pre-orders or catering where the fiscalDate is set between 1 and 90 days in the future. Scheduled tabs must be created as open tabs, and items can be added later. ```bash curl -X POST https://api.gotab.io/loc/{location}/tabs \ -H "Content-Type: application/json" \ -H "Authorization: Bearer {token}" \ -d '{ "openTab": true, "spotUuid": "{spotUuid}", "fiscalDate": "2026-05-01T00:00:00Z", "items": [] }' ``` -------------------------------- ### Item Notes Field Source: https://docs.gotab.io/guides/create-a-new-tab Example of using the notes field to attach custom integration metadata to an item. ```json { "name": "Loyalty Redemption Item", "quantity": 1, "unitPrice": 0, "notes": { "your_integration_key": { "external_id": "order_abc123" } } } ``` -------------------------------- ### Minimal Service Documentation Template Source: https://docs.gotab.io/reference/adding-docs A standard markdown structure for service documentation including frontmatter and endpoint definitions. ```markdown --- title: Payment Service description: Payment processing APIs and integration guide. access: public --- ## Overview The Payment Service handles all payment processing for GoTab. ## Authentication All requests require a Bearer token from the GoTab OAuth endpoint. :::internal ### Internal: Debug Endpoints POST `/internal/payments/:id/retry` — retry a failed payment. Requires `admin` role. ::: ## Endpoints ### Create Payment Intent POST `/v2/payments/intents` Creates a new payment intent for a tab. ```