
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
@longswipe/longswipe-node
Advanced tools
Official Node.js SDK for Longswipe merchant integrations.
npm install @longswipe/longswipe-node
Or with yarn:
yarn add @longswipe/longswipe-node
import { LongswipeSDK } from '@longswipe/longswipe-node';
// Initialize the SDK
const longswipe = new LongswipeSDK({
environment:'production' // 'sandbox' for test environment
publicKey: 'your_public_key',
secretKey: 'your_secret_key' // Only required for authenticated endpoints
});
The SDK constructor accepts a configuration object with the following properties:
interface LongswipeConfig {
publicKey: string; // required for all endpoints
secretKey?: string; // required for authenticated endpoints
environment: 'sandbox' | 'production'; // required
}
These endpoints require both public and secret keys.
addNewCustomer(customer: { email: string; name: string }): Promise<ApiResponse>
updateCustomer(customer: { id: string; email: string; name: string }): Promise<ApiResponse>
deleteCustomer(customerID: string): Promise<ApiResponse>
fetchCustomerByEmail(email: string): Promise<CustomerResponse>
fetchCustomers(params?: { page?: number; limit?: number; search?: string }): Promise<CustomersResponse>
createInvoice(invoice: {
blockchainNetworkAbbreviation?: string;
currencyAbbreviation: string;
dueDate: string;
invoiceDate: string;
invoiceItems: Array<{
description: string;
quantity: number;
unitPrice: number;
}>;
merchantCode: string;
email: string;
fullName: string;
}): Promise<ApiResponse>
approveInvoice({ invoiceID, onChain }: { invoiceID: string; onChain: boolean }): Promise<ApiResponse>
getInvoices({ page, limit, filter }: { page?: number; limit?: number; filter?: 'Approved' | 'Pending' | 'Rejected' }): Promise<Invoices>
healthCheck(): Promise<ApiResponse>
verifyTransaction(referenceID: string): Promise<VerifyTransactionResponse>
These endpoints only require the public key.
fetchSupportedCryptoNetworks(): Promise<CryptoNetworksResponse>
fetchSupportedCurrencies(): Promise<CurrenciesResponse>
fetchVoucherRedemptionCharges(request: VoucherRedemptionRequest): Promise<VoucherRedemptionChargesResponse>
redeemVoucher(request: VoucherRedemptionRequest): Promise<ApiResponse>
verifyVoucher(request: { voucherCode: string }): Promise<VerifyVoucherResponse>
paymentRequest(request: {
amount: number;
currency: string;
user_identifier: string;
metadata: { [key: string]: string | number | boolean };
reference_id: string;
}): Promise<ApiResponse>
verifyUserPayment({ user: string }): Promise<VerifyUserPaymentResponse>
depositAddressRequest(request: {
amount: number;
currency_abbreviation: string;
blockchainNetworkId: string;
metadata: { [key: string]: string | number | boolean };
pay_with_currency_abbreviation: string;
reference_id: string;
}): Promise<DepositAddressPaymentResponse>
depositAddressChargesRequest(request: {
amount: number;
blockchainNetworkId: string;
currency_abbreviation: string;
pay_with_currency_abbreviation: string;
}): Promise<DepositAddressPaymentChargesResponse>
getApplication(): Promise<ApplicationResponse>
All API responses follow this structure:
interface ApiResponse<T = any> {
code: number;
message: string;
status: string;
data?: T;
}
Specific responses include additional data:
interface Customer {
id?: string;
email: string;
name: string;
merchantID?: string;
}
interface CustomerResponse extends ApiResponse {
customer?: Customer;
}
interface CustomersResponse extends ApiResponse {
data?: {
customer: Customer[];
page: number;
limit: number;
total: number;
};
}
interface InvoiceItem {
description: string;
quantity: number;
unitPrice: number;
}
interface Invoice {
blockchainNetworkAbbreviation?: string;
currencyAbbreviation: string;
dueDate: string;
invoiceDate: string;
invoiceItems: InvoiceItem[];
merchantCode: string;
email: string;
fullName: string;
}
interface Invoices extends ApiResponse {
data?: {
invoices: Array<{ /* ...invoice fields... */ }>;
total: number;
};
}
// Crypto network response
interface CryptoNetworksResponse extends ApiResponse {
data?: Array<{
blockExplorerUrl: string;
chainID: string;
cryptocurrencies: Array<{
currencyAddress: string;
currencyData: {
abbrev: string;
currencyType: string;
id: string;
image: string;
isActive: boolean;
name: string;
symbol: string;
};
currencyDecimals: string;
currencyName: string;
id: string;
longswipeContractAddress: string;
networkID: string;
status: boolean;
}>;
id: string;
networkName: string;
networkType: string;
rpcUrl: string;
}>;
}
// Currencies response
interface CurrenciesResponse extends ApiResponse {
data?: {
currencies: Array<{
abbreviation: string;
createdAt: string;
currency: string;
currencyType: string;
id: string;
image: string;
isActive: boolean;
symbol: string;
}>;
};
}
The SDK throws errors for:
Example error handling:
try {
await longswipe.addNewCustomer({
email: 'customer@example.com',
name: 'John Doe'
});
} catch (error) {
if (error.response) {
// The request was made and the server responded with a status code
// that falls out of the range of 2xx
console.error('Error response:', error.response.data);
} else if (error.request) {
// The request was made but no response was received
console.error('No response received:', error.request);
} else {
// Something happened in setting up the request that triggered an Error
console.error('Error:', error.message);
}
}
git clone https://github.com/longswipe/longswipe-node.git
cd longswipe-node
npm install
npm run build
npm run dev
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License - see the LICENSE file for details.
For support, email support@longswipe.com or visit https://longswipe.com/support
FAQs
Longswipe Node.js SDK for merchant integrations
We found that @longswipe/longswipe-node demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

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.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.