New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

tradly

Package Overview
Dependencies
Maintainers
4
Versions
211
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tradly

Tradly JS SDK

latest
Source
npmnpm
Version
1.2.5
Version published
Weekly downloads
41
215.38%
Maintainers
4
Weekly downloads
 
Created
Source

Tradly Platform JS SDK

Launch Platforms apps superfast. Headless. API First

The flexible and modular infrastructure to launch marketplace, community and commerce apps.

See demo videos


Tradly helps developers / non technical founders with low-code/no-code solution to launch marketplaces, Ecosystem for SaaS and commerce apps.

Features

  • 100+ API Endpoints - Comprehensive coverage of all Tradly platform features
  • Automatic Key Management - Integrates with @tradly/auth for automatic key injection
  • Multi-Environment Support - Production, Development, Sandbox
  • Domain-Based Configuration - Support for multiple domains
  • Error Handling - Consistent error-first callback pattern
  • TypeScript Ready - Works with TypeScript projects

Installation

npm install tradly

Optional: Install with Auth Package

For automatic key management, also install @tradly/auth:

npm install tradly @tradly/auth

Quick Start

Simplest approach - just initialize auth, then use tradly sdk directly:

import { initializeAuth, emailLogin } from "@tradly/auth";
import TradlySDK from "tradly";

// Step 1: Initialize auth (once at app start)
initializeAuth("beauty.tradly.co", "production");

// Step 2: Login via auth (keys automatically stored)
await emailLogin("user@example.com", "password");

// Step 3: Use tradly APIs directly (keys auto-injected!)
const [error, response] = await TradlySDK.app.getListings({
	bodyParam: {},
	// authKey automatically from auth package!
});

Benefits:

  • ✅ No need to call init_v2.config()
  • ✅ Keys automatically injected
  • ✅ Environment and base URL synced from auth
  • ✅ Simplest usage

Option 2: Standalone (Without Auth Package)

import TradlySDK from "tradly";

// Initialize tradly
await TradlySDK.init_v2.config({
	domain: "beauty.tradly.co",
	env: "production",
});

// Use APIs with manual authKey
const [error, response] = await TradlySDK.app.getListings({
	authKey: "your-auth-key",
	bodyParam: {},
});

Option 3: With Both (Explicit Control)

import { initializeAuth, emailLogin } from "@tradly/auth";
import TradlySDK from "tradly";

// Initialize auth
initializeAuth("beauty.tradly.co", "production");
await emailLogin("user@example.com", "password");

// Initialize tradly (uses auth's PK key automatically)
await TradlySDK.init_v2.config({
	domain: "beauty.tradly.co",
	env: "production",
});

// Use APIs (keys auto-injected)
const [error, response] = await TradlySDK.app.getListings({
	bodyParam: {},
});

Initialization

import TradlySDK from "tradly";

await TradlySDK.init_v2.config({
	domain: "beauty.tradly.co", // Required
	env: "production", // Required: "production" | "development" | "sandbox"
	custom_header: {}, // Optional: Custom headers
	is_skip_pk_by_domain: false, // Optional: Skip PK key fetch
});

Note: If @tradly/auth is initialized, init_v2.config() will automatically use auth's cached PK key (no duplicate API call).

Using Legacy Init (Deprecated)

import TradlySDK from "tradly";

await TradlySDK.init.config({
	token: "your-pk-key", // PK key
	environment: "production", // Environment
	custom_header: {}, // Optional
});

Integration with @tradly/auth

tradly automatically integrates with @tradly/auth when available:

Automatic Features

  • PK Key Auto-Injection:

    • If APPCONSTANT.TOKEN is empty, gets PK key from auth's cache
    • Caches it for future use
  • Auth Key Auto-Injection:

    • If authKey not provided in method params, gets from auth package
    • Adds to x-auth-key header automatically
  • Environment Sync:

    • Syncs environment from auth config if APPCONSTANT.ENVIRONMENT is empty
  • Base URL Sync:

    • Uses auth's baseUrl if available (preferred over tradly's Environment function)

Backward Compatibility

  • ✅ Works without @tradly/auth package
  • ✅ Manual authKey passing still works
  • ✅ No breaking changes

API Methods

All methods return [error, response] format (error-first callback pattern).

Response Format

const [error, response] = await TradlySDK.app.getListings({});

if (error) {
	// Handle error
	console.error("Error:", error);
} else {
	// Use response
	console.log("Data:", response.data);
}

API Reference

Configuration & Setup

MethodDescriptionParameters
init_v2.config()Initialize SDK (new way){ domain, env, custom_header?, is_skip_pk_by_domain? }
init.config()Initialize SDK (legacy){ token, environment, custom_header? }
init.refreshAPI()Refresh auth token{ refreshKey }

User Management

MethodDescriptionParameters
app.getUserDetail()Get user by ID{ authKey, id }
app.getUserProfile()Get current user profile{ authKey, id? }
app.getUsersList()Get users list{ authKey, bodyParam? }
app.updateUserInfo()Update user info{ authKey, id, data }
app.deleteUser()Delete user{ authKey, id }
app.getUserAttributes()Get user attributes{ authKey, id, recaptcha_token }
app.userFollow()Follow a user{ authKey, data }
app.getUserFollowings()Get user followings{ authKey, bodyParam? }
app.getUserFollowers()Get user followers{ authKey, bodyParam? }

Listings

MethodDescriptionParameters
app.getListings()Get listings{ authKey?, bodyParam? }
app.getListingDetail()Get listing detail{ authKey?, id, slug? }
app.postListing()Create/Update listing{ authKey?, id?, data }
app.deleteListing()Delete listing{ authKey?, id }
app.likeListing()Like/Unlike listing{ authKey?, id, isLiked }
app.unlikeListing()Unlike listing{ authKey?, id, isUnLiked }
app.bulkLikeListings()Bulk like listings{ authKey?, data }
app.getMyListingsLikes()Get my liked listings{ authKey?, bodyParam? }
app.reportListing()Report listing{ authKey?, id, data }
app.getListingsLocations()Get listings locations{ authKey?, bodyParam? }
app.FollowingAccountsListings()Get following accounts listings{ authKey?, bodyParam? }

Note: authKey is optional if @tradly/auth is initialized - it will be auto-injected.

Listings - Pricing Rules

MethodDescriptionParameters
app.postPricingRules()Create/Update pricing rule{ authKey?, listing_id, rule_id?, data }
app.getListingsPricingRules()Get pricing rules{ authKey?, listing_id, bodyParam? }
app.getListingSinglePricingRule()Get single pricing rule{ authKey?, listing_id, rule_id, bodyParam? }
app.deleteListingPricingRule()Delete pricing rule{ authKey?, listing_id, rule_id }

Listings - Negotiations

MethodDescriptionParameters
app.addNegotiation()Add negotiation{ authKey?, id, data }
app.updateNegotiation()Update negotiation{ authKey?, id, negotiation_id, data }
app.getNegotiationList()Get negotiations list{ authKey?, id, bodyParam? }

Listings - Schedules

MethodDescriptionParameters
app.createSchedule()Create schedule{ authKey?, id, data }
app.getSchedule()Get schedule{ authKey?, id, bodyParam? }

Variants

MethodDescriptionParameters
app.getVariants()Get variants{ authKey? }
app.getListingVariants()Get listing variants{ authKey?, listingId }
app.getListingVariantDetails()Get variant details{ authKey?, listingId, variant_id }
app.addEditVariants()Create/Update variant{ authKey?, listingId, id?, data }
app.deleteVariant()Delete variant{ authKey?, listingId, id }

Variant Types

MethodDescriptionParameters
app.getVariantTypes()Get variant types{ authKey? }
app.addEditVariantsTypes()Create/Update variant type{ authKey?, id?, data }
app.deleteVariantType()Delete variant type{ authKey?, id }
app.getVariantTypeValues()Get variant type values{ authKey?, id }
app.getVariantTypeValuesDetail()Get variant type value detail{ authKey?, id, valueID }
app.addEditVariantTypeValues()Create/Update variant type value{ authKey?, id, valueID?, data }
app.deleteVariantTypeValues()Delete variant type value{ authKey?, id, valueID }

Categories

MethodDescriptionParameters
app.getCategory()Get categories{ authKey?, bodyParam? }
app.getSingleCategoryByID()Get category by ID{ authKey?, categoryID, bodyParam? }
app.getSingleCategoryBySlug()Get category by slug{ authKey?, slug, bodyParam? }
app.addEditCategory()Create/Update category{ authKey?, id?, data }
app.deleteCategory()Delete category{ authKey?, id }

Attributes

MethodDescriptionParameters
app.getAttribute()Get attributes{ authKey?, bodyParam? }
app.getAttributesGrouped()Get grouped attributes{ authKey?, bodyParam? }
app.getUserAttributeValues()Get user attribute values{ authKey?, id, bodyParam? }
app.addEditAttribute()Create/Update attribute{ authKey?, id?, data }
app.deleteAttribute()Delete attribute{ authKey?, id }
app.getAttributeValues()Get attribute values{ authKey?, id }
app.getAttributeValuesDetail()Get attribute value detail{ authKey?, id, valueID }
app.addEditAttributeValues()Create/Update attribute value{ authKey?, id, valueID?, data }
app.deleteAttributeValues()Delete attribute value{ authKey?, id, valueID }

Accounts

MethodDescriptionParameters
app.getAccounts()Get accounts{ authKey?, bodyParam? }
app.getAccountDetail()Get account detail{ authKey?, id, slug? }
app.postAccounts()Create/Update account{ authKey?, id?, data }
app.activeInactiveAccounts()Activate/Deactivate account{ authKey?, id, data }
app.followUnfollowAccounts()Follow/Unfollow account{ authKey?, id, isFollowing }
app.blockAccount()Block/Unblock account{ authKey?, id, isBlocked }
app.reportAccount()Report account{ authKey?, id, data }
app.getBlockAccounts()Get blocked accounts{ authKey?, bodyParam? }
app.getFollowingAccounts()Get following accounts{ authKey?, bodyParam? }
app.getAccountsLocations()Get accounts locations{ authKey?, bodyParam? }

Cart & Checkout

MethodDescriptionParameters
app.getCarts()Get cart{ authKey?, bodyParam?, currency? }
app.addToCart()Add to cart{ authKey?, data }
app.deleteFromCart()Remove from cart{ authKey?, data }
app.deleteAllCartDetail()Clear cart{ authKey?, bodyParam? }
app.checkout()Checkout from cart{ authKey?, data, currency? }
app.listingDirectCheckout()Direct checkout{ authKey?, id, data, currency? }
app.applyCoupon()Apply coupon{ authKey?, data }
app.removeCoupon()Remove coupon{ authKey?, data }

Orders

MethodDescriptionParameters
app.getOrders()Get orders{ authKey?, bodyParam? }
app.getOrderDetail()Get order detail{ authKey?, id, bodyParam? }
app.updateOrderStatus()Update order status{ authKey?, id, data, bodyParam? }
app.updateOrderDetail()Update order details{ authKey?, id, data, bodyParam? }
app.updateOrderShipment()Update order shipment{ authKey?, order_id, shipment_id, data, bodyParam? }
app.updateShipmentStatus()Update shipment status{ authKey?, id, shipment_id, data, bodyParam? }
app.verifyOrderDetails()Verify order details{ authKey?, data, bodyParam? }
app.confirmOrderByUser()Confirm order{ authKey?, order_ref, access_key?, data, bodyParam? }
app.getOrderInvoice()Get order invoice{ authKey?, order_id, bodyParam? }
app.getDonationsList()Get donations list{ authKey?, listing_id, bodyParam? }

Shipments

MethodDescriptionParameters
app.getSendCloudShipmentsMethods()Get SendCloud shipping methods{ authKey?, bodyParam? }
app.getSendCloudShipmentLabel()Get SendCloud shipping label{ authKey?, bodyParam? }
app.getExternalShipmentMethods()Get external shipping methods{ authKey?, shipping_method_id, bodyParam? }
app.getExternalShipmentLabel()Get external shipping label{ authKey?, order_id, shipment_id }

Reviews

MethodDescriptionParameters
app.getReviewList()Get reviews{ authKey?, bodyParam? }
app.addReview()Add review{ authKey?, data }
app.likeReview()Like review{ authKey?, id, data }

Payments

MethodDescriptionParameters
app.getPaymentMethods()Get payment methods{ authKey? }
app.getEphemeralKey()Get Stripe ephemeral key{ authKey?, id, data }
app.getPaymentIntentKey()Get Stripe payment intent{ authKey?, id, data }

MangoPay

MethodDescriptionParameters
app.getKycDetails()Get KYC details{ authKey?, id }
app.savePerSonalDetails()Save personal details{ authKey?, data }
app.cardRegistration()Register card{ authKey?, data }
app.confirmCardRegistration()Confirm card registration{ authKey?, data }
app.PayINMangoPayCalc()Calculate pay-in{ authKey?, data }
app.PayINMangoPayByCards()Pay-in by cards{ authKey?, data }
app.PayINMangoPayPayPal()Pay-in by PayPal{ authKey?, data }
app.PayINMangoPayByBank()Pay-in by bank{ authKey?, data }
app.mangoPayWithdrawCalc()Calculate withdrawal{ authKey?, data }
app.mangoPayWithdrawInit()Initiate withdrawal{ authKey?, data }
app.mangoPayWithdrawConfirm()Confirm withdrawal{ authKey?, data }
app.getMangopayWalletTransactions()Get wallet transactions{ authKey?, bodyParam? }
app.getMangoPayWalletBalance()Get wallet balance{ authKey?, bodyParam? }

Stripe Connect

MethodDescriptionParameters
app.getStripeConnectAccount()Get Stripe Connect account{ authKey?, id }
app.createAccountLink()Create account link{ authKey?, data }
app.createExpressLoginLink()Create express login link{ authKey?, data }

Saved Cards

MethodDescriptionParameters
app.getSavedCards()Get saved cards{ authKey? }
app.deleteSavedCard()Delete saved card{ authKey?, card_id }

Addresses

MethodDescriptionParameters
app.getAddress()Get addresses{ authKey?, bodyParam? }
app.addEditAddress()Create/Update address{ authKey?, id?, data }
app.deleteAddress()Delete address{ authKey?, id }
app.searchAddress()Search address{ authKey?, searchKey }
app.reverseGeoCodingAddress()Reverse geocoding{ authKey?, lat, long }
app.getPlacesAddress()Get places address{ authKey?, bodyParam? }
app.getPlacesAddressDetails()Get place address details{ authKey?, bodyParam? }
app.getStates()Get states{ authKey?, bodyParam? }

Shipping Methods

MethodDescriptionParameters
app.getShippingMethods()Get shipping methods{ authKey?, type?, account_id? }

Currency

MethodDescriptionParameters
app.getCurrency()Get currencies{ authKey? }
app.addEditCurrency()Create/Update currency{ authKey?, id?, data }
app.deleteCurrency()Delete currency{ authKey?, id }

Collections

MethodDescriptionParameters
app.getCollection()Get collections{ authKey? }
app.getCollectionDetail()Get collection detail{ authKey?, id }
app.addEditCollection()Create/Update collection{ authKey?, id?, data }
app.deleteCollections()Delete collection{ authKey?, id }
app.getCollectionData()Get collection data{ authKey?, bodyParam? }

Promo Banners

MethodDescriptionParameters
app.getPromoBanner()Get promo banners{ authKey?, bodyParam? }
app.addPromoBanner()Create/Update promo banner{ authKey?, id?, data }
app.deletePromoBanner()Delete promo banner{ authKey?, id }

Transactions & Earnings

MethodDescriptionParameters
app.getTransactions()Get transactions{ authKey?, bodyParam? }
app.getEarning()Get earnings{ authKey?, bodyParam? }

Commissions

MethodDescriptionParameters
app.getCommissions()Get commissions{ authKey?, bodyParam? }
app.getCommissionDetail()Get commission detail{ authKey?, id }

Subscriptions

MethodDescriptionParameters
app.subscribe()Get subscriptions{ authKey?, bodyParam? }
app.productSubscription()Get product subscriptions{ authKey?, bodyParam? }
app.subscriptionConfirm()Confirm subscription{ authKey?, data }
app.manageSubscriptionLink()Manage subscription link{ authKey?, data }
app.getSubscriptionList()Get subscription listings{ authKey?, bodyParam? }
app.getSubscriptionDetails()Get subscription details{ authKey?, listing_id }
app.subscribeByMangopay()Subscribe via MangoPay{ authKey?, listing_id, data, currency? }

Layers

MethodDescriptionParameters
app.getLayer()Get layers{ authKey?, bodyParam? }
app.getLayerDetail()Get layer detail{ authKey?, id }
app.getLayerDetailBySlug()Get layer by slug{ authKey?, id }
app.addEditLayer()Create/Update layer{ authKey?, id?, data }
app.deleteLayer()Delete layer{ authKey?, id }

Taxes

MethodDescriptionParameters
app.getListingTaxes()Get listing taxes{ authKey?, bodyParam? }
app.addEditListingTax()Create/Update tax{ authKey?, id?, data }
app.deleteListingTax()Delete tax{ authKey?, id }

Translations

MethodDescriptionParameters
app.getTranslations()Get translations{ authKey?, bodyParam? }
app.translateData()Translate data{ authKey?, id, data }
app.getClientTranslationsGroups()Get client translation groups{ authKey?, paramBody? }
app.getClientTranslationsValues()Get client translation values{ authKey?, bodyParam? }
app.clientTranslationsValuesByGroup()Get translations by group{ authKey?, bodyParam? }

Feedback & Comments

MethodDescriptionParameters
app.getFeedbackCategories()Get feedback categories{ authKey?, bodyParam? }
app.createFeedback()Create feedback{ authKey?, data }
app.getComments()Get comments{ authKey?, bodyParam? }
app.addEditComments()Create/Update comment{ authKey?, id?, data }
app.likeUnlikeComments()Like/Unlike comment{ authKey?, id, isLike, isDowngrade }

Activities

MethodDescriptionParameters
app.getActivities()Get activities{ authKey?, bodyParam? }

Languages & Countries

MethodDescriptionParameters
app.getLanguages()Get languages{ authKey? }
app.getTenantLanguages()Get tenant languages{ authKey? }
app.getCountries()Get countries{}
app.getTenantCountries()Get tenant countries{ authKey? }

Configuration

MethodDescriptionParameters
app.getConfigList()Get config list{ authKey?, paramBody, domain_id? }
app.getGroupedConfigList()Get grouped config list{ authKey?, paramBody, domain_id? }
app.getGroupedSecureConfigList()Get grouped secure config{ authKey?, paramBody, domain_id?, access_key? }
app.home()Get home data{ authKey? }

S3 & Media

MethodDescriptionParameters
app.generateS3ImageURL()Generate S3 signed URL{ authKey?, data }
app.uploadS3Image()Upload image to S3{ signedUrl, mime, blob_body }
app.getS3SignedURL()Get S3 signed URL{ authKey?, data }

Digital Content

MethodDescriptionParameters
app.getDigitalContents()Get digital contents{ authKey?, listing_id, bodyParam? }
app.postAndEditDigitalContent()Create/Update digital content{ authKey?, listing_id, content_id?, data }
app.deleteDigitalContent()Delete digital content{ authKey?, listing_id, content_id }

SSO

MethodDescriptionParameters
app.postSsoReturn()SSO return{ authKey?, data, currency? }
app.postSsoEnabled()Check SSO enabled{ authKey?, data, currency? }

Wallet

MethodDescriptionParameters
app.getWalletBalance()Get wallet balance{ authKey? }
app.getWalletTransactions()Get wallet transactions{ authKey?, bodyParam? }

OPP Merchant

MethodDescriptionParameters
app.getMerchantDetails()Get merchant details{ authKey?, bodyParam? }
app.createNewMerchant()Create merchant{ authKey?, data }

Time Slots

MethodDescriptionParameters
app.getTimeSlots()Get time slots{ authKey?, bodyParam? }

AI Services

MethodDescriptionParameters
app.getAiPromptResponse()Get AI prompt response{ authKey?, data, currency? }

Device Management

MethodDescriptionParameters
app.updateDeviceInfo()Update device info{ authKey?, data }

Usage Examples

Example 1: Get Listings

import TradlySDK from "tradly";

// With auth package (keys auto-injected)
const [error, response] = await TradlySDK.app.getListings({
	bodyParam: {
		page: 1,
		per_page: 20,
		type: "listings",
	},
});

if (error) {
	console.error("Error:", error);
} else {
	console.log("Listings:", response.data);
}

Example 2: Create Listing

const [error, response] = await TradlySDK.app.postListing({
	data: {
		title: "My Product",
		description: "Product description",
		price: 99.99,
		// ... other fields
	},
});

if (!error) {
	console.log("Listing created:", response.data);
}

Example 3: Add to Cart

const [error, response] = await TradlySDK.app.addToCart({
	data: {
		listing_id: 123,
		quantity: 2,
		// ... other fields
	},
});

Example 4: Checkout

const [error, response] = await TradlySDK.app.checkout({
	data: {
		// Checkout data
	},
	currency: "USD",
});

Example 5: Get Orders

const [error, response] = await TradlySDK.app.getOrders({
	bodyParam: {
		page: 1,
		per_page: 10,
		status: "pending",
	},
});

Parameters

Common Parameters

Most methods accept these optional parameters:

  • authKey - User authentication key (auto-injected if @tradly/auth is used)
  • currency - Currency code (e.g., "USD", "EUR")
  • language - Language code (e.g., "en", "fr")
  • bodyParam - Query parameters object (converted to URL query string)

bodyParam Example

const [error, response] = await TradlySDK.app.getListings({
	bodyParam: {
		page: 1,
		per_page: 20,
		search: "laptop",
		category_id: 5,
	},
});
// Converts to: ?page=1&per_page=20&search=laptop&category_id=5

Error Handling

All methods return error-first callback pattern:

const [error, response] = await TradlySDK.app.getListings({});

if (error) {
	// Handle error
	console.error("Error Code:", error.code);
	console.error("Error Message:", error.message);
	console.error("Full Error:", error);
} else {
	// Use response
	console.log("Status:", response.status);
	console.log("Data:", response.data);
}

Integration with @tradly/auth

Automatic Key Injection

When @tradly/auth is installed and initialized:

  • PK Key: Automatically injected from auth's cache
  • Auth Key: Automatically injected from auth's storage
  • Environment: Synced from auth config
  • Base URL: Uses auth's baseUrl

Manual Override

You can still manually provide authKey to override auto-injection:

// Manual authKey overrides auto-injected key
const [error, response] = await TradlySDK.app.getListings({
	authKey: "custom-key", // Overrides auto-injected
	bodyParam: {},
});

Environment Variables

Tradly sdk supports these environments:

Best Practices

  • Initialize Once: Initialize auth or tradly once at app startup
  • Use Auth Package: For automatic key management, use @tradly/auth
  • Error Handling: Always check for errors before using response
  • TypeScript: Use TypeScript for better type safety
  • Async/Await: Use async/await for cleaner code

TypeScript Support

While tradly is written in JavaScript, it works with TypeScript:

import TradlySDK from "tradly";

const [error, response]: [any, any] = await TradlySDK.app.getListings({
	bodyParam: {},
});

Community Support

For general help using Tradly:

License

ISC

Repository

https://github.com/TRADLY-PLATFORM

Note: This SDK automatically integrates with @tradly/auth when available. For authentication, we recommend using @tradly/auth package which provides automatic key management, storage, and better developer experience.

Keywords

tradly

FAQs

Package last updated on 09 Feb 2026

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