### Initializing Paystack and Making a Transaction in JavaScript Source: https://github.com/paystackoss/paystack-node/blob/main/README.md Example of importing the Paystack library, initializing it with a secret key, and making a transaction request using promises. ```javascript const { Paystack } = require('@paystack/paystack-sdk') const paystack = new Paystack("sk_test_xxxxxx") paystack.transaction.initialize({email: "test@example.com", amount: 20000}) .then(response => console.log(response)) .catch(error => console.log(error)) ``` -------------------------------- ### Installing Paystack Node Library via npm Source: https://github.com/paystackoss/paystack-node/blob/main/README.md Command to install the Paystack Node Library using npm package manager. ```bash npm install @paystack/paystack-sdk --save ``` -------------------------------- ### Using Paystack in TypeScript Source: https://github.com/paystackoss/paystack-node/blob/main/README.md Example of importing and using the Paystack library in a TypeScript environment, demonstrating type safety and async/await usage. ```typescript import { Paystack } from '@paystack/paystack-sdk'; const paystack = new Paystack("sk_test_xxxxxx"); const initialize = async(email, amount) => { const response = await paystack.transaction.initialize({ email, amount }); console.log(response); } const email = 'test@example.com'; const amount = 2000; initialize(email, amount); ``` -------------------------------- ### Using Paystack with ES Modules and Async/Await in JavaScript Source: https://github.com/paystackoss/paystack-node/blob/main/README.md Example of importing Paystack using ES modules, initializing it, and making a transaction request using async/await syntax. ```javascript import { Paystack } from '@paystack/paystack-sdk' const paystack = new Paystack("sk_test_xxxxxx") const initialize = async(email, amount) => { const response = await paystack.transaction.initialize({ email, amount }) console.log(response) } const email = 'test@example.com' const amount = 2000 initialize(email, amount) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.