You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@cafebazaar/payment-sdk

Package Overview
Dependencies
Maintainers
6
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@cafebazaar/payment-sdk

Cafebazaar Payment SDK for Javascript

latest
npmnpm
Version
2.1.0
Version published
Maintainers
6
Created
Source

Bazaar Payment SDK

Bazaar Payment SDK is a Javascript Library to Deal with Bazaar Payment Process in Client.

Install

npm i @cafebazaar/payment-sdk
# or
yarn add @cafebazaar/payment-sdk

ESM, CommonJS

script.js

// ESM
import { startPaymentProcess } from '@cafebazaar/payment-sdk';

// CommonJS
const { startPaymentProcess } = require('@cafebazaar/payment-sdk');

IIFE

index.html

<script src="https://unpkg.com/@cafebazaar/payment-sdk@x.x.x"></script>
<script>
  const { startPaymentProcess } = window.cafeBazaarPaymentSdk;
</script>

Usage

  • startPaymentProcess()

Start Payment Process

Start Payment Process. Based on Current Javascript Runtime, It May Shows a Popup to User and Redirect Current Window to 'callbackUrl' When Popup is Closed Or Redirect the Whole Document To Payment Page and Come Back to 'callbackUrl' After The Job is Done.

type CheckoutToken = string | number;

interface CallbackUrl {
  url?: string; // default to current window location
  method?: 'post' | 'get'; // default to 'get'
  data?: {
    [propName: string]: string;
  }; // default to empty object {}
}

function startPaymentProcess(checkoutToken: CheckoutToken, callbackUrl?: CallbackUrl): Promise<void>

Examples

startPaymentProcess(12345678, {
  url: 'https://divar.ir/payment/12345678/callback',
  method: 'post',
  data: {
    felan: 'bahman',
  },
}); // will update current document location to via post request to 'https://divar.ir/payment/callback' with 'felan=bahman' body.
startPaymentProcess(87654321, {
  url: 'https://divar.ir/payment/87654321/callback',
  method: 'get',
  data: {
    felan: 'bahman',
  },
}); // will update current document location to via get request to 'https://divar.ir/payment/callback?felan=bahman'.

FAQs

Package last updated on 18 Apr 2023

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