old_Loopcrypto.xyz
  • Introduction
  • Supported networks and tokens
  • Loop + Frames
  • Learn
    • How Loop works
    • Core components
      • Collecting authorization
        • Enabling payment on multiple networks
        • Accepting ETH and MATIC
      • Sending payment requests
      • Checking a customer's balance & allowance
      • Receipts and reminders
      • Customer portal
    • Loop + your financial stack
      • Linking on-chain transactions with invoices in your ERP system
      • Connecting with accounting software
      • Crypto off-ramp
    • Case studies
  • Dashboard functionality
    • Subscriptions
      • Free trials, discounts and more
      • Auto-invoicing
      • Auto-cancelations
    • One-time payments
    • Scheduling outbound payments
      • Internal notes
    • Editing an upcoming payment
    • Payments for platforms
  • Integrations
    • Stripe + Loop
      • Getting setup
      • Stripe Connect setup
      • Subscriptions
        • Free trials
        • Upgrading a customer or editing a subscription's products
      • Invoicing
      • One-time payments
      • Coupon codes
      • Stripe Connect - Subscriptions
      • FAQs about Stripe integration
    • Chargebee + Loop
      • Getting setup
      • Subscriptions
      • One-time payments
      • Coupon codes
    • Quickbooks + Loop
      • Invoicing
    • Xero + Loop
      • Invoicing
    • Ghost.org + Loop
    • Zapier + Loop
    • Manually add integrations
  • Technical Docs
    • APIs
      • Entity
        • Adding child entities
        • Adding user to child entity
        • Get child entities
      • Items
        • Adding items
          • Item types
          • Categories
        • Retrieving an item
        • Updating an item
        • Deactivating an item
      • Agreements
      • Transfer requests
        • Signing transfer requests
        • Loop CLI
        • Canceling transfer requests
        • Transfer request status
        • Handling unfulfilled transfer requests
        • Validations
      • Webhooks
        • Checking webhook signatures
        • Demo App
        • Slack, Airtable, Discord, Telegram
    • Archeticture
      • Smart contract
        • Deploying your smart contract
          • Modifying smart contract properties
      • Collecting authorization
        • Checkout page
          • Additional functionality
          • Add "pay with crypto" button
        • Checkout widget
          • NPM package readme
        • Checkout parameter examples
      • Providing on-chain payment based access
        • Subscription gated communities
    • Loop SDK
      • Verify Webhook
      • Transfers
      • Error Handling
      • Generating API keys
    • Sample guide: Collect a subscription or one-time payment
    • Integrating the Loop Protocol into your dApp
      • Payroll applications
      • Loan platforms (credit cards, BNPL)
    • Security
      • API Authentication
      • Securing with signatures
      • API Trust assumptions
      • Audits
  • FAQs
  • Company Dashboard
  • Loop Portal
Powered by GitBook
On this page
  • Info
  • Install
  • Setup
  • Import Loop SDK in your project
  1. Technical Docs

Loop SDK

NPM module to help your application perform basic interactions with Loop.

PreviousSubscription gated communitiesNextVerify Webhook

Last updated 1 year ago

Info

Install

In your project folder, do:

npm i @loop-crypto/loop-sdk -save

Setup

Copy .env.example and rename it to .env in your project folder; or if you already have an .env file in your project, add the following environment variables into the existing .env file, and fill out the values:

LOOP_SIGNER_KEY=<YOUR SIGNER WALLET PRIVATE KEY>
LOOP_CONTRACT_ADDRESS=<YOUR LOOP PAYMENT CONTRACT ADDRESS>
LOOP_CONTRACT_NETWORK_ID=<YOUR LOOP CONTRACT NETWORK ID>
LOOP_API_URL=<LOOP INSTANCE URL>
LOOP_API_ID=<LOOP ENTITY ID FOR THE API KEY>
LOOP_API_KEY=<YOUR LOOP API KEY>
LOOP_WEBHOOK_SECRET=<YOUR LOOP WEBHOOK SECRET>

For security purposes, DO NOT commit your.env file into your github repo so that your keys are not exposed.

Import Loop SDK in your project

  • CJS:

const { loop } = require("@loop-crypto/loop-sdk");
const result = await loop.getTransfers({
    networkId: 5,
});
  • ESM:

import { loop } from "@loop-crypto/loop-sdk";
const result = await loop.getTransfers({
    networkId: 5,
});
npm: @loop-crypto/loop-sdknpm
GitHub - LoopCrypto/loop-sdkGitHub
Logo
Logo