Tutorial
Getting Started with SniptCart JavaScript SDK
Sarah JohnsonDeveloper Advocate
5 min read
Welcome to SniptCart! This guide will walk you through integrating our JavaScript SDK into your website in just a few minutes.
The easiest way to get started is via npm:
npm install @sniptcart/sdk
Or if you prefer using a CDN, you can include it directly in your HTML:
<script src="https://cdn.sniptcart.com/sdk/v1/sniptcart.min.js"></script>
Once installed, initialize the SDK in your application:
import { SniptCart } from '@sniptcart/sdk';
const cart = new SniptCart({
apiKey: 'your-api-key',
environment: 'production' // or 'sandbox' for testing
});
Let's add a product to the cart:
cart.addItem({
id: 'product-123',
name: 'Awesome Product',
price: 29.99,
quantity: 1
});
Now that you have the basics working, check out our documentation for:
Happy building! 🚀
Subscribe to our newsletter to get the latest updates and tutorials delivered to your inbox.
No spam • Unsubscribe anytime