Overview
A Moyasar connection in Flexprice stores encrypted credentials so Flexprice can sync invoices to Moyasar, generate payment links, and enable autopay via the Flexprice checkout page.Steps required
Gather credentials
Get your Secret Key, Publishable Key, and Webhook Secret from the Moyasar Dashboard.
Gather Moyasar Credentials
Required Credentials
| Credential | Location in Moyasar Dashboard | Required | Purpose |
|---|---|---|---|
| Secret Key | Settings → API Keys | ✅ | API authentication for all server-side operations |
| Publishable Key | Settings → API Keys | ✅ | Required for the Flexprice checkout page (autopay card entry) |
| Webhook Secret | Settings → Webhooks → [Your Endpoint] | ✅ | Webhook signature verification |
Finding Your Credentials
Get API Keys
Go to Moyasar Dashboard → Settings → API Keys. Copy both your Secret Key (starts with
sk_) and your Publishable Key (starts with pk_). Both are required.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. |

