@nimee/inforu 1.0.17 → 1.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,361 @@
1
+ # InfoRu Ecommerce API - cURL Examples
2
+
3
+ ## Abandoned Cart Example
4
+
5
+ ### Event Type: ABANDONED_CART_BOOK
6
+
7
+ ```bash
8
+ curl -X POST https://capi.inforu.co.il/api/v2/EcommerceApi \
9
+ -H "Authorization: YOUR_API_KEY_HERE" \
10
+ -H "Content-Type: application/json" \
11
+ -d '{
12
+ "Data": {
13
+ "Event": "cart_abandoned",
14
+ "StoreName": "Nimi Bookstore",
15
+ "StoreBaseUrl": "https://www.nimi.co.il/",
16
+ "LinkToCart": "https://www.nimi.co.il/checkout/cart/?session=abc123",
17
+ "IP": "192.168.1.100",
18
+ "CustomerEmail": "customer@example.com",
19
+ "CustomerFirstName": "John",
20
+ "CustomerLastName": "Doe",
21
+ "ContactRefId": "USR-123456",
22
+ "SubscriberStatus": "Subscribed",
23
+ "AddToGroupName": ["abandoned_cart_books"],
24
+ "OrderNumber": "CART-2024-001234",
25
+ "OrderAmount": "259.85",
26
+ "OrderStatus": "abandoned",
27
+ "BillingAddress": "123 Main St, Tel Aviv, Israel",
28
+ "PaymentDescription": "credit card",
29
+ "ShippingDescription": "Standard shipping",
30
+ "OrderTime": "2024-01-15 14:30:00",
31
+ "OrderItems": [
32
+ {
33
+ "ProductCode": "ISBN-978-0-123456-78-9",
34
+ "ProductName": "Advanced TypeScript Programming",
35
+ "ProductPrice": 79.95,
36
+ "ProductQty": 1,
37
+ "ProductDescription": "A comprehensive guide to TypeScript",
38
+ "ProductLink": "https://www.nimi.co.il/books/advanced-typescript",
39
+ "ProductImage": "https://www.nimi.co.il/images/advanced-typescript.jpg",
40
+ "Custom1": "978-0-123456-78-9",
41
+ "Custom2": "Jane Smith",
42
+ "Custom3": "Tech Publications",
43
+ "Custom4": "abandoned_book",
44
+ "ProductAttributes": [
45
+ {
46
+ "label": "format",
47
+ "value": "physical"
48
+ },
49
+ {
50
+ "label": "author",
51
+ "value": "Jane Smith"
52
+ }
53
+ ]
54
+ },
55
+ {
56
+ "ProductCode": "EBOOK-001",
57
+ "ProductName": "Cloud Architecture Patterns (Digital)",
58
+ "ProductPrice": 49.95,
59
+ "ProductQty": 1,
60
+ "ProductDescription": "Digital book on cloud architecture",
61
+ "ProductLink": "https://www.nimi.co.il/ebooks/cloud-architecture",
62
+ "ProductImage": "https://www.nimi.co.il/images/cloud-ebook.jpg",
63
+ "Custom1": "978-0-111111-11-1",
64
+ "Custom2": "Sarah Williams",
65
+ "Custom3": "Cloud Press Digital",
66
+ "Custom4": "abandoned_book",
67
+ "ProductAttributes": [
68
+ {
69
+ "label": "format",
70
+ "value": "digital"
71
+ },
72
+ {
73
+ "label": "author",
74
+ "value": "Sarah Williams"
75
+ }
76
+ ]
77
+ }
78
+ ]
79
+ }
80
+ }'
81
+ ```
82
+
83
+ ## Purchase Examples
84
+
85
+ ### Event Type: PURCHASED_PHYSICAL_BOOK
86
+
87
+ ```bash
88
+ curl -X POST https://capi.inforu.co.il/api/v2/EcommerceApi \
89
+ -H "Authorization: YOUR_API_KEY_HERE" \
90
+ -H "Content-Type: application/json" \
91
+ -d '{
92
+ "Data": {
93
+ "Event": "sales_order_place_after",
94
+ "StoreName": "Nimi Bookstore",
95
+ "StoreBaseUrl": "https://www.nimi.co.il/",
96
+ "LinkToCart": "https://www.nimi.co.il/checkout/cart/",
97
+ "IP": "192.168.1.100",
98
+ "CustomerEmail": "customer@example.com",
99
+ "CustomerFirstName": "Jane",
100
+ "CustomerLastName": "Smith",
101
+ "ContactRefId": "USR-789012",
102
+ "SubscriberStatus": "Subscribed",
103
+ "AddToGroupName": ["physical_book_buyers"],
104
+ "OrderNumber": "ORD-2024-001235",
105
+ "OrderAmount": "159.90",
106
+ "OrderStatus": "processing",
107
+ "BillingAddress": "456 Book Street, Tel Aviv, Israel",
108
+ "ShippingAddress": "456 Book Street, Tel Aviv, Israel",
109
+ "PaymentDescription": "credit card",
110
+ "ShippingDescription": "Standard shipping",
111
+ "OrderTime": "2024-01-15 10:30:00",
112
+ "OrderItems": [
113
+ {
114
+ "ProductCode": "ISBN-978-0-987654-32-1",
115
+ "ProductName": "Node.js Best Practices",
116
+ "ProductPrice": 79.95,
117
+ "ProductQty": 2,
118
+ "ProductDescription": "Production-ready Node.js patterns",
119
+ "ProductLink": "https://www.nimi.co.il/books/nodejs-best-practices",
120
+ "ProductImage": "https://www.nimi.co.il/images/nodejs-book.jpg",
121
+ "Custom1": "978-0-987654-32-1",
122
+ "Custom2": "Michael Johnson",
123
+ "Custom3": "Dev Books Inc.",
124
+ "Custom4": "physical_book",
125
+ "ProductAttributes": [
126
+ {
127
+ "label": "format",
128
+ "value": "hardcover"
129
+ },
130
+ {
131
+ "label": "author",
132
+ "value": "Michael Johnson"
133
+ },
134
+ {
135
+ "label": "publisher",
136
+ "value": "Dev Books Inc."
137
+ }
138
+ ]
139
+ }
140
+ ]
141
+ }
142
+ }'
143
+ ```
144
+
145
+ ### Event Type: PURCHASED_DIGITAL_BOOK
146
+
147
+ ```bash
148
+ curl -X POST https://capi.inforu.co.il/api/v2/EcommerceApi \
149
+ -H "Authorization: YOUR_API_KEY_HERE" \
150
+ -H "Content-Type: application/json" \
151
+ -d '{
152
+ "Data": {
153
+ "Event": "sales_order_place_after",
154
+ "StoreName": "Nimi Digital Library",
155
+ "StoreBaseUrl": "https://www.nimi.co.il/",
156
+ "LinkToCart": "https://www.nimi.co.il/checkout/cart/",
157
+ "IP": "10.0.0.50",
158
+ "CustomerEmail": "digital@example.com",
159
+ "CustomerFirstName": "David",
160
+ "CustomerLastName": "Cohen",
161
+ "ContactRefId": "USR-456789",
162
+ "SubscriberStatus": "Subscribed",
163
+ "AddToGroupName": ["digital_book_buyers"],
164
+ "OrderNumber": "ORD-2024-001236",
165
+ "OrderAmount": "39.99",
166
+ "OrderStatus": "completed",
167
+ "BillingAddress": "789 Digital Ave, Herzliya, Israel",
168
+ "PaymentDescription": "PayPal",
169
+ "ShippingDescription": "Digital delivery - Instant",
170
+ "OrderTime": "2024-01-15 15:45:00",
171
+ "OrderItems": [
172
+ {
173
+ "ProductCode": "EBOOK-002",
174
+ "ProductName": "React Hooks in Action",
175
+ "ProductPrice": 39.99,
176
+ "ProductQty": 1,
177
+ "ProductDescription": "Master React Hooks with examples",
178
+ "ProductLink": "https://www.nimi.co.il/ebooks/react-hooks",
179
+ "ProductImage": "https://www.nimi.co.il/images/react-hooks-ebook.jpg",
180
+ "Custom1": "978-0-333333-33-3",
181
+ "Custom2": "John Larsen",
182
+ "Custom3": "Manning Digital",
183
+ "Custom4": "digital_book",
184
+ "Custom5": "https://downloads.nimi.co.il/ebooks/react-hooks.pdf",
185
+ "ProductAttributes": [
186
+ {
187
+ "label": "format",
188
+ "value": "PDF"
189
+ },
190
+ {
191
+ "label": "author",
192
+ "value": "John Larsen"
193
+ }
194
+ ]
195
+ }
196
+ ]
197
+ }
198
+ }'
199
+ ```
200
+
201
+ ### Event Type: PURCHASED_VOD_PRODUCT
202
+
203
+ ```bash
204
+ curl -X POST https://capi.inforu.co.il/api/v2/EcommerceApi \
205
+ -H "Authorization: YOUR_API_KEY_HERE" \
206
+ -H "Content-Type: application/json" \
207
+ -d '{
208
+ "Data": {
209
+ "Event": "sales_order_place_after",
210
+ "StoreName": "Nimi VOD Platform",
211
+ "StoreBaseUrl": "https://vod.nimi.co.il/",
212
+ "LinkToCart": "https://vod.nimi.co.il/checkout/cart/",
213
+ "IP": "192.168.1.200",
214
+ "CustomerEmail": "viewer@example.com",
215
+ "CustomerFirstName": "Rachel",
216
+ "CustomerLastName": "Green",
217
+ "ContactRefId": "USR-VOD-001",
218
+ "SubscriberStatus": "Subscribed",
219
+ "AddToGroupName": ["vod_purchasers"],
220
+ "OrderNumber": "VOD-2024-001001",
221
+ "OrderAmount": "29.99",
222
+ "OrderStatus": "completed",
223
+ "BillingAddress": "321 Stream Street, Ramat Gan, Israel",
224
+ "PaymentDescription": "credit card",
225
+ "ShippingDescription": "Digital delivery - Instant",
226
+ "OrderTime": "2024-01-15 20:00:00",
227
+ "OrderItems": [
228
+ {
229
+ "ProductCode": "VOD-COURSE-001",
230
+ "ProductName": "Advanced JavaScript Course",
231
+ "ProductPrice": 29.99,
232
+ "ProductQty": 1,
233
+ "ProductDescription": "8-hour comprehensive JavaScript course",
234
+ "ProductLink": "https://vod.nimi.co.il/courses/advanced-javascript",
235
+ "ProductImage": "https://vod.nimi.co.il/images/js-course-thumb.jpg",
236
+ "Custom1": "480 minutes",
237
+ "Custom2": "2024-07-15",
238
+ "Custom3": "https://stream.nimi.co.il/course/js-advanced",
239
+ "Custom4": "vod",
240
+ "ProductAttributes": [
241
+ {
242
+ "label": "duration",
243
+ "value": "8 hours"
244
+ },
245
+ {
246
+ "label": "access_period",
247
+ "value": "6 months"
248
+ },
249
+ {
250
+ "label": "language",
251
+ "value": "Hebrew"
252
+ }
253
+ ]
254
+ }
255
+ ]
256
+ }
257
+ }'
258
+ ```
259
+
260
+ ### Event Type: PURCHASED_EVENT_TICKET
261
+
262
+ ```bash
263
+ curl -X POST https://capi.inforu.co.il/api/v2/EcommerceApi \
264
+ -H "Authorization: YOUR_API_KEY_HERE" \
265
+ -H "Content-Type: application/json" \
266
+ -d '{
267
+ "Data": {
268
+ "Event": "sales_order_place_after",
269
+ "StoreName": "Nimi Events",
270
+ "StoreBaseUrl": "https://events.nimi.co.il/",
271
+ "LinkToCart": "https://events.nimi.co.il/checkout/cart/",
272
+ "IP": "192.168.1.150",
273
+ "CustomerEmail": "attendee@example.com",
274
+ "CustomerFirstName": "Michael",
275
+ "CustomerLastName": "Scott",
276
+ "ContactRefId": "USR-EVENT-001",
277
+ "SubscriberStatus": "Subscribed",
278
+ "AddToGroupName": ["event_attendees"],
279
+ "OrderNumber": "TKT-2024-005678",
280
+ "OrderAmount": "150.00",
281
+ "OrderStatus": "processing",
282
+ "BillingAddress": "555 Event Plaza, Tel Aviv, Israel",
283
+ "ShippingAddress": "555 Event Plaza, Tel Aviv, Israel",
284
+ "PaymentDescription": "credit card",
285
+ "ShippingDescription": "E-ticket delivery",
286
+ "OrderTime": "2024-01-15 12:00:00",
287
+ "OrderItems": [
288
+ {
289
+ "ProductCode": "EVT-2024-CONF-001",
290
+ "ProductName": "Tech Conference 2024 - VIP Ticket",
291
+ "ProductPrice": 150.00,
292
+ "ProductQty": 1,
293
+ "ProductDescription": "Annual Tech Conference VIP Access",
294
+ "ProductLink": "https://events.nimi.co.il/tech-conference-2024",
295
+ "ProductImage": "https://events.nimi.co.il/images/tech-conf-2024.jpg",
296
+ "Custom1": "2024-03-15 09:00:00",
297
+ "Custom2": "Tel Aviv Convention Center",
298
+ "Custom3": "A-15",
299
+ "Custom4": "event_ticket",
300
+ "ProductAttributes": [
301
+ {
302
+ "label": "event_date",
303
+ "value": "2024-03-15"
304
+ },
305
+ {
306
+ "label": "location",
307
+ "value": "Tel Aviv Convention Center"
308
+ },
309
+ {
310
+ "label": "seat",
311
+ "value": "A-15"
312
+ },
313
+ {
314
+ "label": "ticket_type",
315
+ "value": "VIP"
316
+ }
317
+ ]
318
+ }
319
+ ]
320
+ }
321
+ }'
322
+ ```
323
+
324
+ ## Response Example
325
+
326
+ All successful requests will return a response similar to:
327
+
328
+ ```json
329
+ {
330
+ "Success": true,
331
+ "Message": "Order processed successfully",
332
+ "OrderId": "ORD-2024-001234",
333
+ "TransactionId": "TRX-123456789"
334
+ }
335
+ ```
336
+
337
+ ## Error Response Example
338
+
339
+ ```json
340
+ {
341
+ "Success": false,
342
+ "Error": "Invalid API key",
343
+ "ErrorCode": "AUTH_001"
344
+ }
345
+ ```
346
+
347
+ ## Notes
348
+
349
+ 1. All events use the same endpoint: `https://capi.inforu.co.il/api/v2/EcommerceApi`
350
+ 2. Purchase events (`PURCHASED_*`) use `"Event": "sales_order_place_after"`
351
+ 3. Abandoned cart events use `"Event": "cart_abandoned"`
352
+ 4. The `AddToGroupName` array should contain appropriate group names for segmentation
353
+ 5. Custom fields (Custom1-5) can store different data based on product type:
354
+ - Books: ISBN, Author, Publisher, Format, Download Link
355
+ - VOD: Duration, Expiry Date, Stream URL
356
+ - Events: Event Date, Location, Seat Number
357
+ 6. Physical products require `ShippingAddress`, digital products don't
358
+ 7. The `OrderStatus` field typically uses:
359
+ - "processing" for new orders
360
+ - "completed" for instant/digital deliveries
361
+ - "abandoned" for abandoned carts