5.27.5 • Published 14 days ago

@bigcommerce/bigpay-client v5.27.5

Weekly downloads
769
License
MIT
Repository
github
Last release
14 days ago

bigpay-client.js

Build Status

bigpay-client.js is a client-side library for posting payment data to BigPay.

Usage

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',
        },
    };
}

Development

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
5.27.5

14 days ago

5.27.4

2 months ago

5.27.3

3 months ago

5.27.2

3 months ago

5.27.1

4 months ago

5.27.0

4 months ago

5.26.2

4 months ago

5.26.1

5 months ago

5.25.1

10 months ago

5.25.0

10 months ago

5.26.0

9 months ago

5.24.4

10 months ago

5.24.3

11 months ago

5.24.2

11 months ago

5.24.1

11 months ago

5.24.0

11 months ago

5.23.0

1 year ago

5.22.2

1 year ago

5.21.0

1 year ago

5.22.1

1 year ago

5.20.3

1 year ago

5.22.0

1 year ago

5.20.2

1 year ago

5.20.1

1 year ago

5.20.0

2 years ago

5.19.0

2 years ago

5.18.0

2 years ago

5.17.0

2 years ago

5.16.0

2 years ago

5.15.0

2 years ago

5.15.1

2 years ago

5.14.0

3 years ago

5.13.2

3 years ago

5.13.1

3 years ago

5.13.0

4 years ago

5.12.1

4 years ago

5.12.0

4 years ago

5.11.0

4 years ago

5.10.0

4 years ago

5.9.0

4 years ago

5.8.0

4 years ago

5.7.0

4 years ago

5.6.0

4 years ago

5.5.1

4 years ago

5.5.0

4 years ago

5.4.1

4 years ago

5.4.0

4 years ago

5.3.0

4 years ago

5.2.0

4 years ago

5.1.0

4 years ago

5.0.1

4 years ago

5.0.0

5 years ago

4.6.0

5 years ago

4.5.0

5 years ago

4.3.0

5 years ago

4.2.0

5 years ago

4.1.0

5 years ago

4.0.1

5 years ago

4.0.0

5 years ago

3.2.4

5 years ago

3.2.3

6 years ago

3.2.2

6 years ago

3.2.1

6 years ago

3.2.0

6 years ago

3.1.0

6 years ago

3.0.0

6 years ago

2.12.0

6 years ago