Read the Official API that this library is based off of.
import {
CreditCard,
Options,
Payer,
Payment,
TransactionRequest,
TransparentDbEngine,
} from "qgw/transparent-db";
// Quantum Gateway Dummy Data
const myQuantumGatewayLogin = "gwlogin";
// Customer Dummy Data
const paymentAmount = 19.95;
const ccNumber = "4111111111111111";
const ccExpMonth = "12";
const ccExpYear = "28";
const cvv = "999";
const street = "123 street";
const zip = "90210";
const email = "jane@email.com";
const name = "Jane Doe";
/**
* Library Usage Starts Here
**/
// Create an Engine Object to talk with the Quantum Gateway servers hosting the Transparent Database Engine
const engine = new TransparentDbEngine(myQuantumGatewayLogin);
// Create a Credit Card
const creditCard = new CreditCard(ccNumber, ccExpMonth, ccExpYear, cvv);
// Create a Payment object that specifies an amount to pay and a payment type object, in this case, a credit card.
const payment = new Payment(paymentAmount, creditCard);
const payer = new Payer(street, zip, email, name);
// Additional Options that the Quantum Gateway Transparent Database Engine accepts per transaction.
const options = new Options({
emailCustomerReceipt: false,
sendTransactionEmail: false,
});
const transactionRequest = new TransactionRequest(payment, payer, options);
// A transaction to Quantum Gateway's Engine is initiated once the engine object calls the send method.
engine.send(transactionRequest);