Skip to content

Quick Start

Build a complete Islamic Open Finance™ integration in 15 minutes.

In this quick start, you’ll:

  1. Create a sandbox account
  2. Install the SDK
  3. Create your first Murabaha contract
  4. Set up webhook notifications
  5. Query contract status
  • Node.js 18+ or Python 3.9+
  • An IDE or text editor
  • Basic REST API knowledge
  1. Sign up at cloud.islamicopenfinance.com
  2. Navigate to SettingsAPI Keys
  3. Click Create API Key
  4. Name it “Quickstart Demo”
  5. Copy the key (you won’t see it again!)
Terminal window
# Set your API key as an environment variable
export IOF_API_KEY=sk_sandbox_your_key_here
Terminal window
npm install @iof/sdk
Terminal window
pnpm add @iof/sdk
Terminal window
pip install iof-sdk

:::

Create a new file quickstart.ts (or quickstart.py):

import { IOFClient } from "@iof/sdk";
const client = new IOFClient({
apiKey: process.env.IOF_API_KEY!,
environment: "sandbox",
});
async function main() {
// We'll add code here
}
main().catch(console.error);
import os
from iof import IOFClient
client = IOFClient(
api_key=os.environ["IOF_API_KEY"],
environment="sandbox"
)
def main():
# We'll add code here
pass
if __name__ == "__main__":
main()

:::

Before creating a contract, we need to create the parties:

// Create the financier (bank/institution)
const financier = await client.entities.create({
type: "institution",
name: "Al Rajhi Bank",
jurisdiction: "SA",
registrationNumber: "123456789",
});
// Create the customer
const customer = await client.entities.create({
type: "individual",
name: "Ahmed Al-Rashid",
jurisdiction: "SA",
nationalId: "1234567890",
email: "ahmed@example.com",
});
console.log("Financier:", financier.id);
console.log("Customer:", customer.id);
# Create the financier (bank/institution)
financier = client.entities.create(
type="institution",
name="Al Rajhi Bank",
jurisdiction="SA",
registration_number="123456789"
)
# Create the customer
customer = client.entities.create(
type="individual",
name="Ahmed Al-Rashid",
jurisdiction="SA",
national_id="1234567890",
email="ahmed@example.com"
)
print(f"Financier: {financier.id}")
print(f"Customer: {customer.id}")

:::

Now let’s create a vehicle financing contract:

const contract = await client.contracts.create({
type: "murabaha",
jurisdiction: "SA",
parties: {
financier: { entityId: financier.id },
customer: { entityId: customer.id },
},
asset: {
description: "Toyota Land Cruiser 2024",
category: "vehicle",
vin: "JTDKN3DU5A0123456",
costPrice: {
amount: 250000,
currency: "SAR",
},
profitMargin: 0.07, // 7% profit margin
},
terms: {
paymentSchedule: "monthly",
numberOfInstallments: 60, // 5 years
gracePeriodDays: 30,
lateFeePercentage: 0.02,
},
});
console.log("Contract created:", contract.id);
console.log("Status:", contract.status);
console.log("Monthly payment:", contract.payment.monthlyAmount, "SAR");
console.log("Total amount:", contract.payment.totalAmount, "SAR");
contract = client.contracts.create(
type="murabaha",
jurisdiction="SA",
parties={
"financier": {"entity_id": financier.id},
"customer": {"entity_id": customer.id},
},
asset={
"description": "Toyota Land Cruiser 2024",
"category": "vehicle",
"vin": "JTDKN3DU5A0123456",
"cost_price": {
"amount": 250000,
"currency": "SAR",
},
"profit_margin": 0.07, # 7% profit margin
},
terms={
"payment_schedule": "monthly",
"number_of_installments": 60, # 5 years
"grace_period_days": 30,
"late_fee_percentage": 0.02,
}
)
print(f"Contract created: {contract.id}")
print(f"Status: {contract.status}")
print(f"Monthly payment: {contract.payment.monthly_amount} SAR")
print(f"Total amount: {contract.payment.total_amount} SAR")

:::

// Submit for Shariah compliance review
const submitted = await client.contracts.submit(contract.id);
console.log("Contract submitted for review:", submitted.status);
// In sandbox, approval is automatic
// In production, this would go through the Shariah board
# Submit for Shariah compliance review
submitted = client.contracts.submit(contract.id)
print(f"Contract submitted for review: {submitted.status}")
# In sandbox, approval is automatic
# In production, this would go through the Shariah board

:::

Create a webhook subscription to receive real-time updates:

const webhook = await client.webhooks.create({
url: "https://your-app.com/webhooks/iof",
events: [
"contract.approved",
"contract.activated",
"payment.received",
"payment.overdue",
],
secret: process.env.WEBHOOK_SECRET,
});
console.log("Webhook created:", webhook.id);
webhook = client.webhooks.create(
url="https://your-app.com/webhooks/iof",
events=[
"contract.approved",
"contract.activated",
"payment.received",
"payment.overdue",
],
secret=os.environ["WEBHOOK_SECRET"]
)
print(f"Webhook created: {webhook.id}")

:::

// Get contract details
const details = await client.contracts.get(contract.id);
console.log("Contract details:", details);
// List all contracts
const contracts = await client.contracts.list({
status: "active",
type: "murabaha",
});
for (const c of contracts.data) {
console.log(`${c.id}: ${c.asset.description} - ${c.status}`);
}
# Get contract details
details = client.contracts.get(contract.id)
print(f"Contract details: {details}")
# List all contracts
contracts = client.contracts.list(
status="active",
type="murabaha"
)
for c in contracts.data:
print(f"{c.id}: {c.asset.description} - {c.status}")

:::

Here’s the complete quickstart script:

import { IOFClient } from "@iof/sdk";
const client = new IOFClient({
apiKey: process.env.IOF_API_KEY!,
environment: "sandbox",
});
async function main() {
// 1. Create entities
const financier = await client.entities.create({
type: "institution",
name: "Al Rajhi Bank",
jurisdiction: "SA",
registrationNumber: "123456789",
});
const customer = await client.entities.create({
type: "individual",
name: "Ahmed Al-Rashid",
jurisdiction: "SA",
nationalId: "1234567890",
});
// 2. Create contract
const contract = await client.contracts.create({
type: "murabaha",
jurisdiction: "SA",
parties: {
financier: { entityId: financier.id },
customer: { entityId: customer.id },
},
asset: {
description: "Toyota Land Cruiser 2024",
category: "vehicle",
costPrice: { amount: 250000, currency: "SAR" },
profitMargin: 0.07,
},
terms: {
paymentSchedule: "monthly",
numberOfInstallments: 60,
},
});
console.log("Contract created:", contract.id);
console.log("Monthly payment:", contract.payment.monthlyAmount, "SAR");
// 3. Submit for review
await client.contracts.submit(contract.id);
console.log("Contract submitted for Shariah review");
// 4. Set up webhook
await client.webhooks.create({
url: "https://your-app.com/webhooks/iof",
events: ["contract.approved", "payment.received"],
});
console.log("Setup complete!");
}
main().catch(console.error);

:::

Congratulations! You’ve created your first Islamic Open Finance™ contract.