JavaScript client for BigPay
The "@bigcommerce/bigpay-client" npm package is a specialized node module designed for seamless integration with BigPay, BigCommerce's payment platform. This JavaScript client aids developers in crafting custom payment solutions that are secure, efficient, and scalable. One of the primary benefits of using the "@bigcommerce/bigpay-client" is its robust support for various payment methods, including credit cards, PayPal, and Apple Pay among others. This flexibility ensures that e-commerce platforms can cater to a broad audience, enhancing user experience and increasing conversion rates. Additionally, the package is engineered to handle complex payment interactions like processing payments, managing transactions, and securing payment data, which are crucial for maintaining the integrity and reliability of financial transactions in e-commerce operations.
When developers use the command "npm install @bigcommerce/bigpay-client", they are incorporating a powerful tool into their development environment that simplifies the integration of diverse payment systems into their applications. This installation process is straightforward, making it easy for developers to get up and running with minimal setup time. The package not only facilitates the execution of secure payment transactions but also streamlines the development process by handling most of the heavy lifting associated with payment gateways. This means developers can focus more on other aspects of their application while trusting the "@bigcommerce/bigpay-client" to reliably manage the payment infrastructure.
Moreover, the "@bigcommerce/bigpay-client" comes with comprehensive documentation and support which ensures developers can easily implement the package and troubleshoot any issues that arise during development. The client’s compatibility with modern JavaScript frameworks and its adherence to the latest security standards make it an indispensable asset for developers looking to enhance the payment systems of their e-commerce platforms. Whether you are building a small online store or a large commercial platform, the "@bigcommerce/bigpay-client" provides the necessary tools to facilitate a smooth and secure payment process.
Core dependencies of this npm package and its dev dependencies.
@bigcommerce/form-poster, babel-jest, deep-assign, object-assign, @babel/cli, @babel/core, @babel/preset-env, eslint, eslint-config-airbnb-base, eslint-plugin-import, gulp, gulp-bump, gulp-conventional-changelog, gulp-git, gulp-prompt, gulp-touch, jest, jest-environment-jsdom, lodash, semver, standard-version, xhr-mock
A README file for the @bigcommerce/bigpay-client code repository. View Code
bigpay-client.js is a client-side library for posting payment data to BigPay.
In checkout.js
import { createClient } from 'bigpay-client';
import { getPaymentData } from './payment';
const client = createClient({
host: 'https://payments.bigcommerce.com',
});
const data = getPaymentData();
client.submitPayment(data, (error, response) => {
if (error) {
throw error;
}
console.log(response);
});
In payment.js
export default function getPaymentData() {
return {
authToken: 'aaa.bbb.ccc',
billingAddress: {
addressLine1: '1-3 Smail St',
addressLine2: 'Ultimo',
city: 'Sydney',
company: 'BigCommerce',
country: 'Australia',
countryCode: 'AU',
firstName: 'Foo',
lastName: 'Bar',
phone: '98765432',
postCode: '2007',
provinceCode: 'NSW',
province: 'New South Wales',
},
cart: {
currency: 'AUD',
grandTotal: {
integerAmount: 12000,
},
handling: {
integerAmount: 0,
},
shipping: {
integerAmount: 1000,
},
subtotal: {
integerAmount: 10000,
},
taxTotal: {
integerAmount: 1000,
},
items: [
{
id: '123',
integerAmount: 10000,
integerAmountAfterDiscount: 10000,
integerDiscount: 0,
integerTax: 1000,
integerUnitPrice: 10000,
integerUnitPriceAfterDiscount: 10000,
name: 'Cheese',
quantity: 1,
sku: '123456789',
type: 'ItemPhysicalEntity',
},
],
},
customer: {
customerId: '123',
email: 'email@bigcommerce.com',
firstName: 'Foo',
lastName: 'Bar',
name: 'Foo Bar',
phoneNumber: '98765432',
},
order: {
currency: 'AUD',
grandTotal: {
integerAmount: 12000,
},
handling: {
integerAmount: 0,
},
orderId: '123',
shipping: {
integerAmount: 1000,
},
subtotal: {
integerAmount: 10000,
},
taxTotal: {
integerAmount: 1000,
},
token: 'abc123',
},
payment: {
ccCvv: '123',
ccExpiry: {
month: 1,
year: 2018,
},
ccName: 'Foo Bar',
ccNumber: '4007000000027',
ccCustomerCode: 'XYZ',
},
paymentMethod: {
id: 'paypalprous',
type: 'PAYMENT_TYPE_API',
},
quoteMeta: {
request: {
deviceSessionId: 'xyz123',
geoCountryCode: 'AU',
sessionHash: 'abc123',
},
},
shippingAddress: {
addressLine1: '685 Market St',
addressLine2: 'Third Floor',
city: 'San Francisco',
company: 'BigCommerce',
country: 'United States',
countryCode: 'US',
firstName: 'Joe',
lastName: 'Bar',
phone: '98765432',
postCode: '94105',
provinceCode: 'CA',
province: 'California',
},
source: 'bcapp-checkout-uco',
store: {
cartLink: '/cart',
checkoutLink: '/checkout',
countryCode: 'AU',
currencyCode: 'AUD',
orderConfirmationLink: '/order-confirmation',
shopPath: '/',
storeHash: 's123456789',
storeId: '100',
storeLanguage: 'en-AU',
storeName: 'Test Store',
},
};
}
npm install
Link with other projects:
Inside bigpay-client-js
npm link
npm build -- --watch
Other project(s):
npm link @bigcommerce/bigpay-client
npm run dev
To run unit tests:
npm test
To release a new version:
npm run release