Skip to content
PaalChat Docs

Use cases

PaalPOS receipts

Send a WhatsApp receipt when a sale completes.

.md

In a nutshell

Each shop is a business. When a sale completes and the customer gave a number, send an approved receipt template with the sale ID as reference. A URL button can link to the full receipt.

Setup per shop

  1. POST /businesses with external_id = the shop ID.
  2. The shop owner connects WhatsApp through a connect link.
  3. The owner creates a UTILITY template in WhatsApp Manager, for example:
Text
Thank you for shopping at {{1}}. Total: GHS {{2}}. Receipt no. {{3}}.
[Button: View receipt → https://pos.example.com/r/{{1}}]

On each sale

Http::withToken(config('services.paalchat.token'))->acceptJson()
    ->post("https://whatsapp.paaltech.org/api/v1/businesses/{$shop->id}/messages", [
        'to' => $sale->customer_phone,
        'type' => 'template',
        'reference' => 'receipt-'.$sale->id,
        'template' => [
            'name' => 'sale_receipt',
            'language' => 'en_US',
            'components' => [
                ['type' => 'body', 'parameters' => [
                    ['type' => 'text', 'text' => $shop->name],
                    ['type' => 'text', 'text' => number_format($sale->total, 2)],
                    ['type' => 'text', 'text' => $sale->number],
                ]],
                ['type' => 'button', 'sub_type' => 'url', 'index' => '0', 'parameters' => [
                    ['type' => 'text', 'text' => $sale->public_token],
                ]],
            ],
        ],
    ]);

Tip

Send receipts from a queue so a slow network never delays the till. The receipt-{sale id} reference means a retried job never sends a second receipt.