11.0.3 • Published 2 years ago

@alliedpayment/tabapayjs v11.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
2 years ago

@alliedpayment/tabapayjs

Client library to access Allied's SSO with tabapay

Setup

  • Install

    npm install --save @alliedpayment/tabapayjs
  • Load JS

    <script src="node_modules/@alliedpayment/tabapayjs/tabapayjs.js"></script>

Usage

  • TabaPay SSO Options
interface ITabaPayConfig{
  // Allied's client shardkey **required** throws  Error("domain is required but is missing")
  domain: string;

  // production is used if options or sandbox are "falsy"
  sandbox?: boolean;

  // provide a logo url to provide a logo header ( displayed only with modal; not visible in inline)
  logo?: string;

  // provide an API root for card validation (e.g. Allied's API url for Dev, QA, Demo, or Production)
  // Allied's Production API is used if options or sandbox are "falsy"
  api?: string;

  // additional options
  options?: IGetTokenOptions;
}

interface IGetTokenOptions {
  // defaults true; reject promise on error? 
  rejectOnError?: boolean;
  
  // defaults false; hide success button? ( best used with inline form )
  hideSuccessButton?: boolean;
  
  // defaults false; stay open when cancel is clicked? ( best used with inline form )
  stayOpenOnCancel?: boolean;
}

Open TabaPay SSO

// ES2015
const tabapay = new TabaPay({ domain: 'myDomain' });
tabapay.modal(); // open modal

// get card token using async/await
try{
  const token = await tabapay.getToken(); 
  // use token card token to authorize transactions with TabaPay
  console.log({ token });
}catch(error){
  console.error(error);
}

// OR

// get token using then/catch
tabapay
  .getToken()
  .then(token => { 
    // use token card token to authorize transactions with TabaPay
    console.log({ token });
  })
  .catch(error => {
    console.error(error);
  });

tabapay without logo

Open TabaPay SSO using options

// ES2015
const options = {
  domain: 'myDomain',
  sandbox: true,
  logo: 'LOGO_URL',
  api: 'ENDPOINT_URL'
};

const tabapay = new TabaPay(options);
tabapay.modal(); // open modal

// get card token using async/await
try{
  const token = await tabapay.getToken(); 
  // use token card token to authorize transactions with TabaPay
  console.log({ token });
}catch(error){
  console.error(error);
}

// OR

// get token using then/catch
tabapay
  .getToken()
  .then(token => { 
    // use token card token to authorize transactions with TabaPay
    console.log({ token });
  })
  .catch(error => {
    console.error(error);
  });

tabapay with logo

Open TabaPay SSO with inline form

// index.html
<div id="tabapay-container-id"></div>

// ES2015
const options = {
  domain: 'myDomain',
  sandbox: true,
  logo: 'LOGO_URL',
  api: 'ENDPOINT_URL'
};

const tabapay = new TabaPay(options);
tabapay.inline('tabapay-container-id'); // append inline form as child of element who's ID is provided

try{
  const token = await tabapay.getToken({
    rejectOnError: false,
    hideSuccessButton: true,
    stayOpenOnCancel: true,
    });
  // use token card token to authorize transactions with TabaPay
  console.log({ token });
}catch(error){
  console.error(error);
}

// OR 

// open tabapay using then/catch
tabapay.getToken({
    rejectOnError: false,
    hideSuccessButton: true,
    stayOpenOnCancel: true,
  })
  .then(token => {
    // use token card token to authorize transactions with TabaPay
    console.log({ token });
  })
  .catch(error => {
    console.error(error);
  });

inline

10.0.0

2 years ago

10.2.0

2 years ago

10.2.1

2 years ago

10.4.0

2 years ago

11.0.2

2 years ago

11.0.3

2 years ago

11.0.0

2 years ago

11.0.1

2 years ago

10.1.0

2 years ago

10.3.0

2 years ago

10.3.1

2 years ago

9.1.1

2 years ago

9.1.0

2 years ago

5.1.0

2 years ago

6.1.0

2 years ago

6.1.1

2 years ago

8.0.5

2 years ago

7.3.0

2 years ago

7.1.2

2 years ago

7.1.0

2 years ago

4.2.0

2 years ago

5.0.5

2 years ago

5.2.2

2 years ago

5.0.4

2 years ago

5.2.1

2 years ago

5.0.3

2 years ago

5.2.0

2 years ago

5.0.2

2 years ago

5.0.1

2 years ago

5.0.0

2 years ago

6.0.0

2 years ago

7.0.0

2 years ago

7.2.0

2 years ago

8.0.1

2 years ago

8.0.0

2 years ago

9.0.1

2 years ago

9.0.0

2 years ago

4.1.26

4 years ago

4.1.25

4 years ago

4.1.24

5 years ago

4.1.23

5 years ago

4.1.22

5 years ago

4.1.21

5 years ago

4.1.20

5 years ago

4.1.19

5 years ago

4.1.18

5 years ago

4.1.17

5 years ago

4.1.16

5 years ago

4.1.15

5 years ago

4.1.14

5 years ago

4.1.13

5 years ago

4.1.12

5 years ago

4.1.11

5 years ago

4.1.10

5 years ago

4.1.9

5 years ago

4.1.8

5 years ago

4.1.7

5 years ago

4.1.6

5 years ago

4.1.5

5 years ago

4.1.4

5 years ago

4.1.3

5 years ago

4.1.2

5 years ago

4.1.1

5 years ago

4.1.0

5 years ago

4.0.4

5 years ago

4.0.3

5 years ago

4.0.2

5 years ago

4.0.1

5 years ago

3.0.22

5 years ago

3.0.21

5 years ago

3.0.20

5 years ago

3.0.19

5 years ago

3.0.18

5 years ago

3.0.8

5 years ago

3.0.7

5 years ago

3.0.1

5 years ago

3.0.0

5 years ago

2.1.0

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.1.0

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago