@extends('layouts.app') @section('content')
This guide explains how to integrate SarfSDK into your Laravel (or any web) project.
SarfSDK is part of the Sarf application, a digital platform that helps users track budgets, monitor daily expenses, and maintain financial records.
By integrating this SDK, your system can send invoices directly to Sarf users, eliminating manual entry and enabling real-time expense tracking.
<script src="https://sarf.sa/project/sdk/sarf-sdk.js"></script>
<script>
SarfSDK({
key: "YOUR_PUBLIC_KEY",
container: "sarf-sdk",
userid: "9665XXXXXXXX",
invoiceTotal: "total",
customer_mobile: "customer_mobile",
description: "description",
attachments: "attachments",
language: "en" // or "ar"
});
</script>
| Option | Type | Required | Description |
|---|---|---|---|
key | String | β Yes | Your Sarf public API key. |
container | String | β Yes | Element ID where SDK will render. |
userid | String | β Yes | Userβs mobile number (9665XXXXXXXX). |
invoiceTotal | String | β No | Input ID for invoice total. |
customer_mobile | String | β No | Input ID for customerβs mobile number. |
description | String | β No | Input ID for invoice description. |
attachments | String | β No | File input ID for invoice attachments. |
isModal | Boolean | β No | Whether to use modal form (default: true). |
register_div | String | β No | Element ID where register button appears. |
invoice_btn_type | "button" / "submit" | β No | Button type for invoice submission. |
registration_btn_type | "button" / "submit" | β No | Button type for registration. |
language | "en" or "ar" | β No | Interface language (default: "ar"). |
/api/check-user to verify the userid.<div id="sarf-sdk"></div>
<script>
SarfSDK({
key: "MY_PUBLIC_KEY",
container: "sarf-sdk",
userid: "966500123456",
language: "en"
});
</script>
<input type="text" id="customer_mobile" value="966500987654" />
<input type="text" id="total" value="150.75" />
<input type="text" id="description" value="Order #1234" />
<input type="file" id="attachments" multiple />
<div id="sarf-sdk"></div>
<script>
SarfSDK({
key: "MY_PUBLIC_KEY",
container: "sarf-sdk",
userid: "966500123456",
invoiceTotal: "total",
customer_mobile: "customer_mobile",
description: "description",
attachments: "attachments",
language: "en"
});
</script>
/api/validate-key β Validate key/api/check-user β Check user registration/api/user/list β Search customers/api/generate_simple_invoice β Generate invoice