-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic-usage.js
More file actions
38 lines (30 loc) · 1.05 KB
/
basic-usage.js
File metadata and controls
38 lines (30 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* Basic usage example for @profullstack/stripe-config
*
* This example shows how to use the ConfigManager to load
* project configuration and perform basic operations.
*/
import { ConfigManager, StripeClient } from '@profullstack/stripe-config';
async function main() {
// Initialize config manager
const config = new ConfigManager();
// Load all projects
const projects = await config.listProjects();
console.log(`Found ${projects.length} project(s)`);
if (projects.length === 0) {
console.log('No projects configured. Run "stripeconf setup" first.');
return;
}
// Get the first project
const project = projects[0];
console.log(`Using project: ${project.name} (${project.environment})`);
// Initialize Stripe client
const stripe = new StripeClient(project);
// List products
const products = await stripe.listProducts({ limit: 5 });
console.log(`\nFound ${products.length} product(s):`);
products.forEach((product) => {
console.log(` - ${product.name} (${product.id})`);
});
}
main().catch(console.error);