Overview
A Moyasar connection in Flexprice stores encrypted credentials so Flexprice can sync invoices to Moyasar and generate payment links for them.Steps required
Gather credentials
Get Secret Key (required), and Webhook Secret (required) from the Moyasar Dashboard.
Gather Moyasar Credentials
Required Credentials
| Credential | Location in Moyasar Dashboard | Required | Purpose |
|---|---|---|---|
| Secret Key | Settings → API Keys | ✅ | API authentication (Required for all operations) |
| Publishable Key | Settings → API Keys | ⚠️ Optional | Frontend integration (if using client-side elements) |
| Webhook Secret | Settings → Webhooks → [Your Endpoint] | ⚠️ Optional | Webhook signature verification |
Finding Your Credentials
Get API Keys
Go to Moyasar Dashboard → Settings → API Keys. Copy your Secret Key (starts with
sk_). Optionally copy your Publishable Key (starts with pk_).Required Webhook Events
Configure the following events so Flexprice can update invoice status when payments occur:| Event Type | Purpose |
|---|---|
payment_paid | Track successful payment completions |
Webhook configuration endpoint URL
In the Moyasar Dashboard, use this Flexprice webhook URL when creating your webhook.https://api.cloud.flexprice.io.)

Setting Up the Webhook
Enter URL and events
Enter the Flexprice webhook endpoint URL (see Webhook configuration endpoint URL above) and select
payment_paid.Create Moyasar Connection
Using Flexprice Dashboard

Connection Configuration
Default Currency (required in Moyasar)
The default currency for Moyasar is SAR (Saudi Riyal).- Supported Currencies: SAR, USD, EUR, KWD, etc.
- Currency Precision: Moyasar requires amounts in the smallest currency unit (e.g., Halalah for SAR). Flexprice handles this conversion automatically.
Currency Precision Table
| Currency | Precision | Unit | Example |
|---|---|---|---|
| SAR | 2 | Halalah | 10.00 SAR = 1000 |
| USD | 2 | Cents | 10.00 USD = 1000 |
| KWD | 3 | Fils | 10.000 KWD = 10000 |
| JPY | 0 | Yen | 1000 JPY = 1000 |
Security Best Practices
Signature Verification
Always configure the
webhook_secret to enable HMAC-SHA256 signature verification.Troubleshooting
| Issue | Cause | Solution |
|---|---|---|
| Connection test fails | Invalid Secret Key | Verify the key in Moyasar Dashboard. |
| Webhook not updating invoice | Event type mismatch | Ensure specific payment_paid event is selected. |
| Webhook signature error | Wrong Webhook Secret | Update the secret in Flexprice connection. |
| Invoice not syncing | Missing credentials | Ensure connection is active and valid. |

