APIs and SDKs
APIs and SDKs: Empowering Developers, Driving Innovation
// Include the nbtc JavaScript SDK
import nbtcSDK from 'nbtc-sdk';
// Initialize the SDK with your API key
const nbtc = new nbtcSDK('YOUR_API_KEY');
// Create a payment request
const paymentRequest = {
amount: 100, // Amount in cryptocurrency (e.g., 0.001 BTC)
currency: 'BTC', // Cryptocurrency symbol
recipientAddress: 'RECIPIENT_CRYPTO_ADDRESS',
callbackURL: 'YOUR_CALLBACK_URL',
// Additional metadata or custom fields can be included here
};
// Request a payment from the user
nbtc.requestPayment(paymentRequest)
.then((payment) => {
// Handle the payment response
console.log('Payment successful:', payment);
})
.catch((error) => {
// Handle errors or user cancellation
console.error('Payment failed:', error);
});Last updated