Skip to main content

Usage

const bearerToken = await getBearerToken(); // Your auth implementation

const sku = await browserClient.getSkuTransactionById({
  id: "your-transaction-id",
  bearerToken: bearerToken,
});

Parameters

  • id (string): ID of the created transaction
  • bearerToken (string): Bearer token for authentication

Example Implementation

import { ChipiBrowserSDK } from "@chipi-stack/backend";

const browserClient = new ChipiBrowserSDK({
  apiPublicKey: process.env.VITE_CHIPI_PUBLIC_KEY, // or your framework's env var
});

async function getSkuTransactionById() {
  try {
    const bearerToken = await getBearerToken(); // Your auth implementation
    

    const sku = await browserClient.getSkuTransactionById({
      id: "SKU-1234543",
      bearerToken: bearerToken,
    });

    return sku;
    
  } catch (error) {
    if (error.message.includes('not found')) {
      return null;
    }
    console.error('Error retrieving SKU transaction:', error);
    throw error;
  }
}