vibecash 0.2.2 → 0.2.4
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/dist/index.js +14 -5
- package/package.json +23 -7
package/dist/index.js
CHANGED
|
@@ -300,22 +300,31 @@ function registerPriceCommands(program2) {
|
|
|
300
300
|
// src/commands/checkout.ts
|
|
301
301
|
function registerCheckoutCommands(program2) {
|
|
302
302
|
const checkout = program2.command("checkout").description("Manage checkout sessions");
|
|
303
|
-
checkout.command("create").description("Create a new checkout session").requiredOption("-p, --price-id <priceId>", "Price ID to checkout").requiredOption("--success-url <url>", "URL to redirect on success").requiredOption("--cancel-url <url>", "URL to redirect on cancel").option("-m, --mode <mode>", "payment or subscription", "payment").option("-q, --quantity <quantity>", "Quantity", "1").option("--methods <methods>", "Payment methods (comma-separated: card,alipay,paynow,wechat)", "card,alipay,paynow,wechat").action(async (opts) => {
|
|
303
|
+
checkout.command("create").description("Create a new checkout session").requiredOption("-p, --price-id <priceId>", "Price ID to checkout").requiredOption("--success-url <url>", "URL to redirect on success").requiredOption("--cancel-url <url>", "URL to redirect on cancel").option("-m, --mode <mode>", "payment or subscription", "payment").option("-q, --quantity <quantity>", "Quantity", "1").option("--methods <methods>", "Payment methods (comma-separated: card,alipay,paynow,wechat)", "card,alipay,paynow,wechat").option("--customer-id <id>", "Customer ID (optional, auto-created from email at payment time)").option("--trial-days <days>", "Trial period in days (subscription mode)").action(async (opts) => {
|
|
304
304
|
try {
|
|
305
305
|
const body = {
|
|
306
306
|
mode: opts.mode,
|
|
307
307
|
lineItems: [{ priceId: opts.priceId, quantity: parseInt(opts.quantity, 10) }],
|
|
308
308
|
successUrl: opts.successUrl,
|
|
309
|
-
cancelUrl: opts.cancelUrl
|
|
310
|
-
paymentMethodTypes: opts.methods.split(",").map((m) => m.trim())
|
|
309
|
+
cancelUrl: opts.cancelUrl
|
|
311
310
|
};
|
|
311
|
+
if (opts.mode === "subscription") {
|
|
312
|
+
body.paymentMethodTypes = ["card"];
|
|
313
|
+
} else {
|
|
314
|
+
body.paymentMethodTypes = opts.methods.split(",").map((m) => m.trim());
|
|
315
|
+
}
|
|
316
|
+
if (opts.customerId) body.customerId = opts.customerId;
|
|
317
|
+
if (opts.trialDays) body.trialPeriodDays = parseInt(opts.trialDays, 10);
|
|
312
318
|
const data = await apiRequest("POST", "/checkout/sessions", body);
|
|
313
319
|
success("Checkout session created");
|
|
314
320
|
output(data, (d) => {
|
|
315
|
-
|
|
321
|
+
const lines = [
|
|
316
322
|
`Session ID: ${d.id}`,
|
|
323
|
+
`Mode: ${d.mode}`,
|
|
317
324
|
`Checkout URL: ${d.url || d.checkoutUrl || "N/A"}`
|
|
318
|
-
]
|
|
325
|
+
];
|
|
326
|
+
if (d.mode === "subscription") lines.push(`(Subscription \u2014 customer will be created from email at checkout)`);
|
|
327
|
+
return lines.join("\n");
|
|
319
328
|
});
|
|
320
329
|
} catch (err) {
|
|
321
330
|
console.error(`Error: ${err.message}`);
|
package/package.json
CHANGED
|
@@ -1,15 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vibecash",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "VibeCash CLI - Payment infrastructure for the AI era. Accept cards, e-wallets, and QR payments in Southeast Asia.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"bin": {
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
"bin": {
|
|
7
|
+
"vibecash": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsup",
|
|
14
|
+
"dev": "tsx src/index.ts"
|
|
15
|
+
},
|
|
9
16
|
"keywords": [
|
|
10
|
-
"payment",
|
|
11
|
-
"
|
|
12
|
-
"
|
|
17
|
+
"payment",
|
|
18
|
+
"cli",
|
|
19
|
+
"checkout",
|
|
20
|
+
"subscription",
|
|
21
|
+
"billing",
|
|
22
|
+
"vibecash",
|
|
23
|
+
"ai-native",
|
|
24
|
+
"southeast-asia",
|
|
25
|
+
"singapore",
|
|
26
|
+
"wechat-pay",
|
|
27
|
+
"alipay",
|
|
28
|
+
"paynow"
|
|
13
29
|
],
|
|
14
30
|
"author": "VibeCash",
|
|
15
31
|
"license": "MIT",
|