Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/own-pay/OwnPay-Documentation/llms.txt

Use this file to discover all available pages before exploring further.

SMS match templates are the intelligence layer of OwnPay’s mobile payment automation. When a paired Android device forwards an incoming wallet notification to the server, OwnPay needs to know which gateway the message belongs to and how to extract the payment amount and transaction ID from the raw SMS text. Templates define these rules using regular expressions (regex), sender identifiers, and priority ordering. A well-configured set of templates means your manual wallet gateways — bKash, Nagad, Rocket, and others — confirm payments automatically without any staff intervention. In the OwnPay admin dashboard, expand the MOBILE & SMS section in the left sidebar and click SMS Centre. The SMS Centre opens with the templates list, creation form, and testing tools.

How Templates Work

When an SMS arrives from a paired device, the server runs it through the template evaluation engine:
  1. The message’s sender identifier (the “From” field) is matched against each template’s Sender Pattern.
  2. The first template whose sender pattern matches (ordered by Priority) is selected.
  3. The template’s Amount Regex and Transaction ID Regex are applied to the message body using capture group (1) to extract the values.
  4. The extracted Transaction ID is matched against open pending transactions on the server.
  5. If a match is found and the amount aligns, the transaction is automatically marked completed.

Template Fields

FieldRequiredExampleDescription
GatewayYesNagad PersonalThe manual gateway this template serves. Matched transactions are approved against this gateway’s pending checkouts.
Sender PatternYesNAGADThe SMS sender identifier. Case-sensitive. Must match the “From” field of the wallet provider’s SMS exactly.
PriorityNo10Evaluation order (1–999). Lower numbers are evaluated first. Use priority to resolve conflicts when multiple templates could match the same sender.
Amount RegexYesAmount: Tk ([\d\.]+)Regex with a capture group (1) that extracts the payment amount from the message body.
Transaction ID RegexNoTxID: (\w+)Regex with a capture group (1) that extracts the unique Transaction ID from the message body.
Sender Account RegexNoCustomer: (01\d{9})Regex with a capture group (1) that extracts the customer’s phone number from the message body. Optional but useful for cross-referencing.
StatusYesActiveActive templates are evaluated; Inactive templates are skipped.
All regex patterns must include parentheses () to designate a capture group. OwnPay extracts the value matched inside group (1). A pattern without parentheses will cause parsing failure — for example, use Amount: Tk ([\d\.]+) rather than Amount: Tk [\d\.]+.

Creating a Template Manually

1

Open the SMS Centre and click + New Template

Navigate to Mobile & SMS → SMS Centre and click the + New Template button to open the creation form.
2

Select the target gateway

Open the Gateway dropdown and select the manual gateway this template will serve (e.g. Nagad Personal). Matched transactions will be looked up against pending checkouts on this gateway.
3

Set the sender pattern

Enter the Sender Pattern exactly as it appears in the SMS “From” field for this wallet provider (e.g. NAGAD for Nagad, bKash for bKash). Remember that this field is case-sensitive.
4

Write the amount regex

In the Amount Regex field, enter a regex pattern that captures the payment amount in group (1). For example: Amount: Tk ([\d,]+\.?\d*) captures the amount from “Amount: Tk 1,500.00”.
5

Write the transaction ID regex

In the Transaction ID Regex field, enter a pattern that captures the unique TrxID in group (1). For example: TxID: (\w+) captures the ID from “TxID: 12A34B56C7”.
6

Set priority and status

Assign a Priority value (lower = evaluated first). Leave Status set to Active.
7

Save the template

Click Create Template. The new rule appears in the templates list and is immediately active for incoming SMS matching.

Testing a Template Against Sample SMS

OwnPay provides a Live Regex Tester sandbox directly in the SMS Centre, allowing you to verify a pattern before saving it as an active template.
1

Scroll to the Live Regex Tester section

On the SMS Centre page, scroll down to the Live Regex Tester panel.
2

Paste a real SMS message

Paste the full text of an actual wallet SMS into the SMS Body textbox. Use a real message to ensure your pattern accounts for the exact formatting the provider uses.
3

Enter your regex pattern

Type your capture group regex in the Regex Pattern input (e.g. TxID: (\w+)).
4

Select the target field

Choose the field you are testing from the Field dropdown — Amount, Transaction ID, or Sender Account.
5

Click Test Regex

Click Test Regex. The result box shows the value extracted from group (1) of your pattern (e.g. 12A34B56C7). If the result is empty or incorrect, adjust the pattern and test again before saving.
Always test every regex pattern in the Live Regex Tester with at least two or three real SMS samples before saving. Wallet providers occasionally change their message formats with app updates — a template that worked last month may need a minor adjustment after a provider update.

Alternative Template Creation Methods

OwnPay offers two additional methods for creating templates if you are unfamiliar with regex syntax:
Paste a sample SMS message into the Smart SMS Parser section. The system analyses the message structure using heuristic rules and suggests a pre-built regex template. Review the suggested patterns, adjust if needed, and click Use Template to populate the creation form automatically.
Click Generate AI Prompt to produce a structured prompt you can copy and paste into an AI assistant such as ChatGPT, Gemini, or Claude. The AI translates your sample SMS text into a JSON parsing block that maps directly to OwnPay’s template fields. Paste the AI’s output into the creation form to populate all regex fields at once.

Templates List View

The templates table shows all active and inactive parsing rules:
ColumnDescription
GatewayThe manual gateway this template is bound to.
Sender PatternThe “From” identifier matched against incoming SMS sender fields.
Amount RegexThe capture pattern used to extract the payment amount.
TrxID RegexThe capture pattern used to extract the Transaction ID.
PriorityEvaluation order — lower numbers run first.
StatusActive (evaluated) or Inactive (skipped).
ActionsEdit modifies the template; Delete removes it permanently.
Sender patterns are case-sensitive. NAGAD and nagad are treated as different patterns. Always copy the sender identifier directly from a real SMS message rather than typing it from memory to avoid case mismatches that prevent any messages from matching.
Avoid using nested quantifiers in your regex patterns (e.g. (a+)+). These can cause catastrophic backtracking, known as a ReDoS (Regular Expression Denial of Service) attack, which will severely degrade server performance when processing SMS messages. Keep patterns simple and specific.

Build docs developers (and LLMs) love