Skip to content

pay and accept payments from anywhere in the world from any solana-vm based network! works in any country even in space!

License

Notifications You must be signed in to change notification settings

openSVM/svm-pay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SVM-Pay: Cross-Network Payment Solution

logo

Pay from anywhere from any solana-vm based network!

Overview

SVM-Pay is a payment solution for SVM networks (Solana, Sonic SVM, Eclipse, s00n) that enables developers to easily integrate payment functionality into their applications. Inspired by Solana Pay, SVM-Pay extends the concept to work across all SVM networks with a one-click integration approach for developers.

Features

  • Cross-Network Compatibility: Support for Solana, Sonic SVM, Eclipse, and s00n networks
  • Simple Integration: One-click integration for developers
  • Comprehensive SDK: JavaScript/TypeScript SDK with React, Vue, and Angular components
  • C++ SDK: Native C++ SDK for high-performance applications and system integration
  • Assembly-BPF SDK: Low-level BPF program development with Assembly and LLVM IR abstractions
  • Mobile Support: iOS and Android SDK for mobile applications
  • No Fees: SVM-Pay itself charges no fees (only standard network transaction fees apply)
  • Secure: Built with security best practices for blockchain payments
  • Flexible: Support for different payment scenarios (e-commerce, point-of-sale, subscriptions)

Quick Links

Installation

npm install svm-pay

Basic Usage

import { SVMPay } from 'svm-pay';

// Initialize the SDK
const svmPay = new SVMPay({
  defaultNetwork: 'solana', // 'solana', 'sonic', 'eclipse', or 'soon'
});

// Create a payment URL
const url = svmPay.createTransferUrl(
  'YOUR_WALLET_ADDRESS',
  '1.0', // Amount
  {
    label: 'Your Store',
    message: 'Payment for Order #123',
    references: ['order-123']
  }
);

console.log(url);
// Output: solana:YOUR_WALLET_ADDRESS?amount=1.0&label=Your%20Store&message=Payment%20for%20Order%20%23123&reference=order-123

// CLI Integration - access CLI functionality programmatically
// Check wallet balance (requires CLI setup)
svmPay.checkWalletBalance()
  .then(balance => console.log('Wallet balance:', balance))
  .catch(error => console.error('Balance check failed:', error));

CLI Tool

SVM-Pay includes a built-in CLI tool for managing payments:

# Install globally
npm install -g svm-pay

# Setup configuration
svm-pay setup -k <your-private-key> -a <your-api-key>

# Check wallet balance
svm-pay balance

# Check API usage
svm-pay usage

# Make a payment
svm-pay pay -a 0.1 -r "API usage payment"

# View payment history
svm-pay history

See CLI Integration for complete CLI documentation.

Assembly-BPF SDK

For advanced use cases requiring low-level BPF program development, SVM-Pay includes an Assembly-BPF SDK:

import { AssemblyBPFSDK, BPFTemplates, SVMNetwork } from 'svm-pay/assembly-bpf';

// Initialize SDK for low-level BPF development
const sdk = new AssemblyBPFSDK({ 
  network: SVMNetwork.SOLANA,
  debug: true 
});

// Create a payment processor using built-in template
const { metadata, instructions } = BPFTemplates.createPaymentProcessor({
  networks: [SVMNetwork.SOLANA, SVMNetwork.SONIC]
});

// Compile to BPF bytecode
const result = await sdk.compile(instructions, metadata);

console.log('βœ… BPF Program compiled successfully');
console.log(`πŸ“Š Instructions: ${instructions.length}`);
console.log(`πŸ’Ύ Bytecode size: ${result.bytecode?.length} bytes`);

The Assembly-BPF SDK provides:

  • BPF Assembly abstractions for instruction generation
  • Memory management utilities for stack/heap operations
  • Syscall helpers for SVM network interactions
  • Program templates (payment processor, cross-chain bridge, validator)
  • Multi-network support across all SVM chains
  • Compilation and deployment tools

See the Assembly-BPF Documentation for complete guides and examples.


## Framework Integration

### React

```jsx
import { SVMPayProvider, PaymentButton } from 'svm-pay/react';

function App() {
  return (
    <SVMPayProvider>
      <PaymentButton
        recipient="YOUR_WALLET_ADDRESS"
        amount="1.0"
        onComplete={(status, signature) => {
          console.log(`Payment ${status}`, signature);
        }}
      />
    </SVMPayProvider>
  );
}

Vue

<template>
  <svm-pay-button
    recipient="YOUR_WALLET_ADDRESS"
    amount="1.0"
    @complete="handleComplete"
  />
</template>

<script>
export default {
  methods: {
    handleComplete(status, signature) {
      console.log(`Payment ${status}`, signature);
    }
  }
}
</script>

Angular

@Component({
  selector: 'app-root',
  template: `
    <svm-pay-button
      recipient="YOUR_WALLET_ADDRESS"
      amount="1.0"
      (complete)="handleComplete($event)"
    ></svm-pay-button>
  `
})
export class AppComponent {
  handleComplete(event: {status: string, signature?: string}) {
    console.log(`Payment ${event.status}`, event.signature);
  }
}

C++ SDK

SVM-Pay includes a comprehensive C++ SDK for high-performance applications and system integration:

#include <svm-pay/svm_pay.hpp>

// Initialize SDK
svm_pay::initialize_sdk();

// Create client
svm_pay::Client client(svm_pay::SVMNetwork::SOLANA);

// Create payment URL
std::string url = client.create_transfer_url("recipient_address", "1.5", {
    {"label", "Coffee Shop"},
    {"message", "Payment for coffee"}
});

// Parse payment URL
auto request = client.parse_url(url);

// Generate reference ID
std::string ref = client.generate_reference();

Features:

  • Cross-platform support (Windows, Linux, macOS)
  • Asynchronous network operations
  • Secure reference generation with OpenSSL
  • Complete URL scheme support
  • CMake build system with package management
  • Comprehensive test suite and examples

See C++ SDK Documentation for detailed installation and usage instructions.

Demo Applications

SVM-Pay includes several demo applications to showcase its functionality:

Security

SVM-Pay is built with security in mind. For security recommendations and best practices, see the Security Recommendations document.

License

MIT

Contributing

Contributions are welcome! Please see the Contributing Guidelines for more information.

About

pay and accept payments from anywhere in the world from any solana-vm based network! works in any country even in space!

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •