
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
splitz-payments
Advanced tools
Official Node.js SDK for SPLITZ payment and subscription management API
ספריית JavaScript רשמית לעבודה עם SPLITZ API - ניהול תשלומים ומנויים
לתיעוד מפורט כולל מודלים, API reference ודוגמאות מתקדמות:
npm install splitz-payments
או עם yarn:
yarn add splitz-payments
const SplitzClient = require('splitz-payments');
const splitz = new SplitzClient({
apiKey: 'your-api-key-here'
});
import SplitzClient from 'splitz-payments';
const splitz = new SplitzClient({
apiKey: 'your-api-key-here',
baseURL: 'https://api.splitz.co.il', // אופציונלי
timeout: 30000 // אופציונלי - timeout בms
});
כאשר אתה מקבל מנוי, האובייקט המוחזר מכיל את השדות הבאים:
{
uid: string; // מזהה ייחודי
status: string; // ACTIVE | CANCELLED | PAST_DUE | PAUSED
subscriber_email: string; // אימייל המנוי
subscriber_name: string; // שם המנוי
order_uid: string; // מזהה ההזמנה
product_uid: string; // מזהה התוכנית הנוכחית
pending_plan_change?: { // שינוי תוכנית מתוכנן (אופציונלי)
current_product_uid: string;
future_product_uid: string;
future_product_name: string;
effective_date: string;
status: string;
};
}
// שליפה לפי מזהה מנוי
const result = await splitz.subscriptions.get({
subscription_uid: 'sub_xxx'
});
const sub = result.subscription;
console.log(sub.status); // 'ACTIVE'
console.log(sub.product_uid); // 'prod_xxx'
// בדיקה אם יש שינוי תוכנית מתוכנן
if (sub.pending_plan_change) {
console.log('מעבר ל:', sub.pending_plan_change.future_product_name);
}
// או לפי אימייל לקוח ומזהה חנות
const result = await splitz.subscriptions.get({
customer_email: 'customer@example.com',
shop_uid: 'shop_xxx'
});
const changeRequest = await splitz.subscriptions.requestProductChange({
subscription_uid: 'sub_xxx',
target_product_uid: 'prod_yyy',
return_url: 'https://myapp.com/success'
});
// הפנה את הלקוח לעמוד האישור
console.log(changeRequest.data.approval_url);
console.log(changeRequest.data.prorated_amount); // סכום prorated
console.log(changeRequest.data.requires_payment); // true/false
פרמטרים שחוזרים ב-return_url:
// לאחר אישור, הלקוח מופנה ל:
// https://myapp.com/success?status=success&subscription_uid=sub_xxx&new_plan=Premium%20Plan&prorated_charge=50
// טיפול בפרמטרים:
const urlParams = new URLSearchParams(window.location.search);
if (urlParams.get('status') === 'success') {
console.log('✅ שינוי הצליח!');
console.log('מנוי:', urlParams.get('subscription_uid'));
console.log('תוכנית:', decodeURIComponent(urlParams.get('new_plan')));
console.log('סכום:', urlParams.get('prorated_charge'), '₪');
}
const portal = await splitz.subscriptions.createManagementLink('sub_xxx');
// שלח ללקוח
console.log(portal.data.management_url);
console.log(portal.data.expires_in_hours); // 24
const paymentLink = await splitz.paymentLinks.generate({
payment_link_uid: 'pl_xxx',
customer_email: 'customer@example.com'
});
// שלח ללקוח את הקישור
console.log(paymentLink.url);
// https://app.splitz.co.il/pay-link/pl_xxx/token...
למנוי:
// הלקוח חוזר עם: ?subscription_uid=sub_xxx
const subscriptionUid = new URLSearchParams(window.location.search).get('subscription_uid');
לתשלום חד פעמי:
// מידע מפורט (כרטיס): ?uid=order_xxx&email=...&price=...&card_last_four=...&card_type=...
// או מידע בסיסי (PayPal): ?order_uid=order_xxx
const params = new URLSearchParams(window.location.search);
const orderUid = params.get('uid') || params.get('order_uid');
// אמת תשלום
const status = await splitz.orders.isPaid(orderUid);
const status = await splitz.orders.isPaid('order_xxx');
if (status.paid) {
console.log('✅ ההזמנה שולמה');
} else {
console.log('⏳ ההזמנה ממתינה לתשלום');
}
const response = await splitz.orders.get('order_xxx');
const order = response.order;
console.log('מזהה:', order.uid);
console.log('אימייל לקוח:', order.email);
console.log('מחיר:', order.price, order.currency);
console.log('סטטוס:', order.status);
console.log('שולם:', order.is_paid);
console.log('תאריך תשלום:', order.paid_at);
console.log('תאריך יצירה:', order.createdAt);
הספרייה מספקת error classes ייעודיים:
const { errors } = require('splitz-payments');
try {
const subscription = await splitz.subscriptions.get({
subscription_uid: 'invalid_id'
});
} catch (error) {
if (error instanceof errors.NotFoundError) {
console.error('מנוי לא נמצא');
} else if (error instanceof errors.ValidationError) {
console.error('שגיאת ולידציה:', error.field);
} else if (error instanceof errors.AuthenticationError) {
console.error('API key לא תקין');
} else if (error instanceof errors.ForbiddenError) {
console.error('אין הרשאה לגשת למשאב זה');
} else if (error instanceof errors.SplitzAPIError) {
console.error('שגיאת API:', error.message);
console.error('סטטוס:', error.statusCode);
}
}
SplitzAPIError - שגיאה כללית מה-APIValidationError - פרמטרים לא תקיניםAuthenticationError - API key לא תקין או חסרNotFoundError - משאב לא נמצא (404)ForbiddenError - אין הרשאה (403)const SplitzClient = require('splitz-payments');
async function upgradePlan(subscriptionId, newPlanId) {
const splitz = new SplitzClient({
apiKey: process.env.SPLITZ_API_KEY
});
try {
// 1. שלוף את המנוי הנוכחי
const subscription = await splitz.subscriptions.get({
subscription_uid: subscriptionId
});
console.log('מנוי נוכחי:', subscription.subscription.product_uid);
// 2. צור בקשה לשינוי תוכנית
const changeRequest = await splitz.subscriptions.requestProductChange({
subscription_uid: subscriptionId,
target_product_uid: newPlanId,
return_url: 'https://myapp.com/plan-changed'
});
// 3. הפנה את הלקוח לעמוד האישור
return {
approvalUrl: changeRequest.data.approval_url,
amount: changeRequest.data.prorated_amount,
requiresPayment: changeRequest.data.requires_payment
};
} catch (error) {
console.error('שגיאה בשינוי תוכנית:', error.message);
throw error;
}
}
// שימוש
upgradePlan('sub_xxx', 'prod_premium')
.then(result => {
console.log('הפנה את הלקוח ל:', result.approvalUrl);
})
.catch(console.error);
async function sendPaymentLink(paymentLinkId, customerEmail) {
const splitz = new SplitzClient({
apiKey: process.env.SPLITZ_API_KEY
});
const link = await splitz.paymentLinks.generate({
payment_link_uid: paymentLinkId,
customer_email: customerEmail
});
// שלח את הקישור במייל / SMS
await sendEmail(customerEmail, link.url);
return link.url;
}
async function getCustomerPortal(subscriptionId) {
const splitz = new SplitzClient({
apiKey: process.env.SPLITZ_API_KEY
});
const portal = await splitz.subscriptions.createManagementLink(subscriptionId);
return {
url: portal.data.management_url,
expiresAt: portal.data.expires_at
};
}
| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | Required | Your SPLITZ API key |
baseURL | string | https://api.splitz.co.il | API base URL |
timeout | number | 30000 | Request timeout (ms) |
הספרייה כוללת TypeScript definitions מלאות:
import SplitzClient, {
GetSubscriptionOptions,
GetSubscriptionResponse,
RequestProductChangeOptions
} from 'splitz-payments';
const splitz = new SplitzClient({ apiKey: 'key' });
const options: GetSubscriptionOptions = {
subscription_uid: 'sub_xxx'
};
const result: GetSubscriptionResponse = await splitz.subscriptions.get(options);
MIT © SPLITZ
Made with ❤️ by SPLITZ
FAQs
Official Node.js SDK for SPLITZ payment and subscription management API
The npm package splitz-payments receives a total of 3 weekly downloads. As such, splitz-payments popularity was classified as not popular.
We found that splitz-payments demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.