SDKs
Express middleware
Next.js handler
Consumer client
Typed errors, retries, logging
TypeScript/JavaScript SDK:
Installation:
npm install @qwerydotxyz/qwery-sdkUsage:
import { QweryPayment } from '@qwerydotxyz/qwery-sdk';
// Initialize
const qwery = new QweryPayment({
facilitatorUrl: 'https://facilitator.qwery.xyz',
network: 'solana'
});
// Create payment
const payment = await qwery.createPayment({
amount: 0.01,
token: 'SOL',
recipient: 'merchant_wallet'
});
// Sign and settle (handles wallet interaction)
const result = await qwery.signAndSettle(payment, window.solana);
if (result.success) {
console.log('Payment successful!', result.tx_signature);
}Browser + React Example:
import { useWallet } from '@solana/wallet-adapter-react';
import { QweryPayment } from '@qwerydotxyz/qwery-sdk';
function PaymentButton() {
const wallet = useWallet();
const qwery = new QweryPayment({
facilitatorUrl: 'https://facilitator.qwery.xyz',
network: 'solana'
});
const handlePayment = async () => {
const payment = await qwery.createPayment({
amount: 0.01,
token: 'SOL',
recipient: 'merchant_wallet'
});
const result = await qwery.signAndSettle(payment, wallet);
if (result.success) {
alert('Payment successful!');
}
};
return <button onClick={handlePayment}>Pay 0.01 SOL</button>;
}Python (qwery-payments)
FastAPI middleware
Flask decorators
Consumer client
Python SDK:
Installation:
pip install qwery-sdkUsage:
from qwery import QweryClient
# Initialize
client = QweryClient(
facilitator_url='https://facilitator.qwery.xyz',
network='solana'
)
# Create payment
payment = client.create_payment(
amount=0.01,
token='SOL',
recipient='merchant_wallet'
)
# Settle (after user signs)
result = client.settle(
payment_id=payment['payment_id'],
signed_transaction=signed_tx
)
if result['success']:
print(f"Payment successful: {result['tx_signature']}")Flask Example:
from flask import Flask, request, jsonify
from qwery import QweryClient
app = Flask(__name__)
client = QweryClient(
facilitator_url='https://facilitator.qwery.xyz',
network='solana'
)
@app.route('/api/create-payment', methods=['POST'])
def create_payment():
data = request.json
payment = client.create_payment(
amount=data['amount'],
token=data['token'],
recipient='merchant_wallet'
)
return jsonify(payment)
@app.route('/api/settle-payment', methods=['POST'])
def settle_payment():
data = request.json
result = client.settle(
payment_id=data['payment_id'],
signed_transaction=data['signed_tx']
)
return jsonify(result)Rust SDK:
Installation:
[dependencies]
qwery-sdk = "0.1.0"Usage:
use qwery_sdk::{QweryClient, Network};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Initialize
let client = QweryClient::new(
"https://facilitator.qwery.xyz",
Network::Solana
);
// Create payment
let payment = client.create_payment(
0.01,
"SOL",
"merchant_wallet"
).await?;
println!("Payment ID: {}", payment.payment_id);
// Settle (after user signs)
let result = client.settle(
&payment.payment_id,
&signed_transaction
).await?;
if result.success {
println!("Payment successful: {}", result.tx_signature);
}
Ok(())
}Last updated