@buclepay/node 0.1.0 → 0.1.1
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.
- package/README.md +2 -2
- package/index.d.ts +4 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,11 +37,11 @@ app.post('/webhooks/buclepay', express.raw({ type: 'application/json' }), (req,
|
|
|
37
37
|
|
|
38
38
|
## bucleScore: reward your best customers
|
|
39
39
|
|
|
40
|
-
Each payer has a bucleScore built from all their payments on buclePay. **You never see the score or the history.** You see the customer's **level (1–4)
|
|
40
|
+
Each payer has a bucleScore built from all their payments on buclePay. **You never see the score or the history.** You see the customer's **level**: Spark, Glow, Shine or Star (1–4) only if they chose to show it to you, and you use it to give rewards: discounts (1–50%), free charges (1–3), gifts, priority or early access.
|
|
41
41
|
|
|
42
42
|
```js
|
|
43
43
|
await bp.perks.create({ min_level: 3, kind: 'discount_pct', value: 10, title: '10% off your renewal' });
|
|
44
|
-
const { data } = await bp.customers.perks('cus_…'); // { level_shared, level, perks }
|
|
44
|
+
const { data } = await bp.customers.perks('cus_…'); // { level_shared, level: 3, level_name: 'Shine', perks }
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
The level is for rewards only. Never use it to deny service, ask for deposits, offer credit or installments, or charge differently.
|
package/index.d.ts
CHANGED
|
@@ -72,9 +72,11 @@ export interface BuclePayEvent {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
export type PerkKind = 'discount_pct' | 'free_period' | 'gift' | 'priority' | 'early_access' | 'custom';
|
|
75
|
-
|
|
75
|
+
/** bucleScore levels: 1 Spark · 2 Glow · 3 Shine · 4 Star. */
|
|
76
|
+
export type LevelName = 'Spark' | 'Glow' | 'Shine' | 'Star';
|
|
77
|
+
export interface Perk { id: string; object: 'perk'; min_level: 1 | 2 | 3 | 4; min_level_name: LevelName; kind: PerkKind; value: number | null; title: string }
|
|
76
78
|
export interface PerkParams { min_level: 1 | 2 | 3 | 4; kind: PerkKind; /** discount_pct 1–50 · free_period 1–3 · the rest take no value */ value?: number; title: string }
|
|
77
|
-
export interface CustomerPerks { object: 'customer_perks'; customer: string; /** the customer agreed to show you their level */ level_shared: boolean; level: 1 | 2 | 3 | 4 | null; perks: Perk[] }
|
|
79
|
+
export interface CustomerPerks { object: 'customer_perks'; customer: string; /** the customer agreed to show you their level */ level_shared: boolean; level: 1 | 2 | 3 | 4 | null; level_name: LevelName | null; perks: Perk[] }
|
|
78
80
|
|
|
79
81
|
export class BuclePay {
|
|
80
82
|
constructor(apiKey: string, opts?: { baseUrl?: string; timeoutMs?: number; fetch?: typeof fetch });
|
package/package.json
CHANGED