Socket
Socket
Sign inDemoInstall

@juspay/blaze-sdk-web

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@juspay/blaze-sdk-web

SDK for integrating Breeze 1CCO into your Web Application


Version published
Weekly downloads
3
Maintainers
0
Weekly downloads
 
Created
Source

Blaze SDK Web

Blaze SDK Web is a Javascript library which enables you to seamlessly integrate and use Breeze 1 Click Checkout in your Web app built using any kind of web technology.

Installation

Run following command in your node project to install the Blaze SDK Web package:

npm install @juspay/blaze-sdk-web

This will install the Blaze SDK Web package in your project.

Note: You can use pnpm, yarn or any other package manager of your choice to install the package.

Usage

To start using the Blaze SDK Web, you need to complete following steps:

Step 1: Initiate the Blaze SDK Web

To initiate the Blaze SDK Web, you need to call the initiate method of the SDK. This method takes an object as an argument which contains the following properties:

ParameterTypeMandatoryDescription
merchantIdStringYesThe merchant ID provided by Juspay.
shopUrlStringYesThe URL of the shop where the SDK will be used.
environmentStringNoThe environment in which the SDK should run. Possible values are beta and production.
shopPlatformStringYesThe platform on which the shop is built. Possible values are shopify, magento, woocommerce, custom
// Import the SDK to your project
import BlazeSDK from '@juspay/blaze-sdk-web';

// Create the initiate payload

const initiatePayload = {
  merchantId: '<merchant-id-shared-by-breeze>',
  shopUrl: '<shop-url>',
  environment: 'production',
  shopPlatform: 'custom'
};

BlazeSDK.initiate(initiatePayload);

Step 2: Process your request through Blaze SDK

To process your request through Blaze SDK, you need to call the process method of the SDK. This method takes an object. Refer below sections to understand the object structure.

Process Payload
ParameterTypeMandatoryDescription
actionStringYesThe action to be performed by the SDK. Possible values are startCheckout
cartBlazeCart or StringYesThe cart object which contains the cart details or Stringified Cart when using signature based integration
utmParamsObjectNoUTP Parameters associated with the user journey
signatureStringNoRSA Signed signature for Stringified BlazeCart JSON
BlazeCart
ParameterTypeMandatoryDescription
initialPriceNumberYesThe initial price of the cart.
totalPriceNumberYesThe total price of the cart.
totalDiscountNumberYesThe total discount applied on the cart.
weightNumberNoThe total weight of the cart.
itemCountNumberYesThe total number of items in the cart.
currencyBlazeCurrencyYesThe currency of the cart.
itemsBlazeCartItem[]YesThe array of items in the cart.
BlazeCurrency

Blaze SDK Web supports the following currencies:

  • 'INR'
  • 'USD'
  • 'GBP'
  • 'AUD'
  • 'CAD'
  • 'SGD'
  • 'AED'
  • 'PKR'
  • 'BDT'
BlazeCartItem
ParameterTypeMandatoryDescription
idStringYesThe ID of the item.
titleStringYesThe title of the item.
variantTitleStringNoThe variant title of the item.
variantIdStringNoThe variant ID of the item.
imageStringNoThe image URL of the item.
weightNumberNoThe weight of the item.
quantityNumberYesThe quantity of the item.
discountNumberYesThe discount applied on the item.
initialPriceNumberYesThe initial price of the item.
finalPriceNumberYesThe final price of the item.

Post you have initiated the SDK, you can call the process method to execute your query.

// Import your SDK
import BlazeSDK from '@juspay/blaze-sdk-web';

// Creating process payload
const processPayload = {
  action: 'startCheckout',
  cart: {
    initialPrice: 1000,
    totalPrice: 900,
    totalDiscount: 100,
    weight: 1000,
    itemCount: 2,
    currency: 'INR',
    items: [
      {
        id: '1',
        title: 'Item 1',
        variantTitle: 'Variant 1',
        variantId: '1',
        image: 'https://example.com/image1.jpg',
        weight: 500,
        quantity: 1,
        discount: 50,
        initialPrice: 500,
        finalPrice: 450
      },
      {
        id: '2',
        title: 'Item 2',
        variantTitle: 'Variant 2',
        variantId: '2',
        image: 'https://example.com/image2.jpg',
        weight: 500,
        quantity: 1,
        discount: 50,
        initialPrice: 500,
        finalPrice: 450
      }
    ]
  },
  utmParams: {
    utm_source: 'google',
    utm_medium: 'cpc',
    utm_campaign: 'summer-sale'
  }
};

BlazeSDK.process(processPayload);

Note: This SDK is in alpha stage. Expect new features & breaking changes in upcoming versions.

Keywords

FAQs

Package last updated on 02 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc