Skip to main content

Overview

A Moyasar connection in Flexprice stores encrypted credentials so Flexprice can sync invoices to Moyasar and generate payment links for them.

Steps required

1

Gather credentials

Get Secret Key (required), and Webhook Secret (required) from the Moyasar Dashboard.
2

Configure webhook

Add webhook URL in Moyasar, select payment_paid, and copy the Webhook Secret.
3

Create connection

In the Flexprice dashboard (Integrations → Moyasar → Add a connection), enter your Secret Key and Webhook Secret.

Gather Moyasar Credentials

Required Credentials

CredentialLocation in Moyasar DashboardRequiredPurpose
Secret KeySettings → API KeysAPI authentication (Required for all operations)
Publishable KeySettings → API Keys⚠️ OptionalFrontend integration (if using client-side elements)
Webhook SecretSettings → Webhooks → [Your Endpoint]⚠️ OptionalWebhook signature verification

Finding Your Credentials

1

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_).
2

Get Webhook Secret

Go to Moyasar Dashboard → Settings → Webhooks. Create or select your webhook endpoint and copy the webhook secret (used to verify that events are from Moyasar).

Required Webhook Events

Configure the following events so Flexprice can update invoice status when payments occur:
Event TypePurpose
payment_paidTrack 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/v1/webhooks/moyasar/tenant_YOUR_TENANT_ID/env_YOUR_ENV_ID
(If you use a different Flexprice region, use the base URL for your region instead of https://api.cloud.flexprice.io.)
Moyasar Connection Setup

Setting Up the Webhook

1

Open Webhooks

Go to Moyasar Dashboard → Settings → Webhooks and click + Add New Webhook.
2

Enter URL and events

Enter the Flexprice webhook endpoint URL (see Webhook configuration endpoint URL above) and select payment_paid.
3

Create and copy secret

Click Create Webhook, then copy the Webhook Secret and save it for your Flexprice connection.

Create Moyasar Connection

Using Flexprice Dashboard

1

Navigate to Integrations

Go to Flexprice dashboardIntegrationsMoyasarAdd a connection.
2

Enter credentials

Enter your Secret Key (required) and Webhook Secret (required).
3

Save connection

Click to create the connection. Flexprice will store your credentials securely.
Moyasar Connection Setup

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

CurrencyPrecisionUnitExample
SAR2Halalah10.00 SAR = 1000
USD2Cents10.00 USD = 1000
KWD3Fils10.000 KWD = 10000
JPY0Yen1000 JPY = 1000

Security Best Practices

1

HTTPS Only

Webhooks must use HTTPS.
2

Signature Verification

Always configure the webhook_secret to enable HMAC-SHA256 signature verification.
3

Key Rotation

Rotate API keys periodically from the Moyasar dashboard.

Troubleshooting

IssueCauseSolution
Connection test failsInvalid Secret KeyVerify the key in Moyasar Dashboard.
Webhook not updating invoiceEvent type mismatchEnsure specific payment_paid event is selected.
Webhook signature errorWrong Webhook SecretUpdate the secret in Flexprice connection.
Invoice not syncingMissing credentialsEnsure connection is active and valid.