2.5.5 • Published 11 days ago

@tap-payments/connect v2.5.5

Weekly downloads
-
License
ISC
Repository
-
Last release
11 days ago

Connect Package

Handling user onboarding and authentication for Tap Payments.

Installs

This is a React module available through the npm registry. Installation is done using the npm install command:

npm install @tap-payments/connect

---------------------------- OR -------------------------

yarn add @tap-payments/connect

Examples

Connect Library

ES6

import { TapConnect, Language } from '@tap-payments/connect'

const ConnectComponent = () => {
	return (
		<TapConnect
			// required (the public key of the merchant account provided by Tap Payments)
			publicKey={'pk_test_XXXXXXXXXXXXXXXXXXXXXXX'}
			// required (the domain of the merchant)
			domain={'https://example.com'}
			// required (Language flag to control the language of the connect element and only we support [en,ar])
			language={Language.EN}
			// required (the country ISO2 of the merchant)
			country={'SA'}
			// required (the scope of the merchant)
			scope={'merchant'}
			// merchant data array `ex: [operator]`
			data={[]}
			// optional (Lead Id can be passed in case of you already created a lead using our API )
			lead={'led_xxxxxxxxxxxxxxxxxxxxxx'}
			// required (Decide the mode of connect `normal` or `express`)
			mature={false}
			// optional (show/hide board screen after creating an account)
			board={true}
			// optional ( Decide the board maturity )
			boardMaturity={false}
			// optional ( Decide to show connect as a `popup` or `page` to our connect domain. Default value is `popup` )
			mode={'popup'}
			// required (boolean to open/close the connect element)
			open={true}
			// optional (The POST Method URL used to push te data from our server to the merchant server)
			postURL={'https://api.example.com/post'}
			// This redirect url after verify authentication go to merchant website
			redirectUrl={''}
			//optional (Callback function to handle the ready state of the TapConnect )
			onReady={() => console.log('onReady')}
			// optional (Callback function runs after creating an account)
			onCreated={(data) => console.log('onCreated', data)}
			// optional (Callback function runs when the user close TaConnect)
			onClose={() => console.log('onClose')}
			// optional (Callback function to handle the error)
			onError={(err) => console.log('onError', err)}
			// optional (Callback function runs after finishing all the flows)
			onBoardCompleted={() => console.log('onBoardCompleted')}
		/>
	)
}

Vanilla JS

<!DOCTYPE html>
<html lang="en">
 <head>
  <meta charset="utf-8" />
  <meta
   name="viewport"
   content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no,shrink-to-fit=no"
  />
  <title>Auth-JsConnect</title>
  <script src="https://tap-sdks.b-cdn.net/connect/build-1.0.0-beta/main.js"></script>
 </head>
 <body>
  <div id="root"></div>
  <script>
   // once our cdn script is loaded we can use the window.TapPayments object
   const { renderTapConnect, Language } = window.TapPayments
   let unmountConnect = null
   const startConnectAuth = () => {
    const { unmount } = renderTapConnect(
     {
      publicKey: 'pk_test_xxxxxxxxxxxxxxxxxxxxxxxx',
      language: Language.EN,
      domain: 'https://example.com',
      country: 'SA',
      scope: 'merchant',
      data: [],
      lead: 'led_xxxxxxxxxxxxxxxxxxxxxx',
      mature: false,
      board: true,
      boardMaturity: false,
   mode: "popup",
      open: true,
      postURL: 'https://api.example.com/post',
      redirectUrl: '',
      onReady: () => console.log('onReady'),
      onCreated: (data) => console.log('onCreated', data),
      onError: (err) => console.log('onError', err),
      onClose: () => console.log('onClose'),
      onBoardCompleted: () => console.log('onBoardCompleted'),

     },
     'root'
    )
    // save the unmount function to be able to unmount the component
    unmountConnect = unmount
   }

   const stopConnectAuth = () => {
    unmountConnect && unmountConnect()
   }
  </script>
  <button onclick="startConnectAuth()">Start</button>
  <button onclick="stopConnectAuth()">Stop</button>
 </body>
</html>

Properties

nametypedescription
publicKey requiredstringPublic key of the merchant account provided by Tap Payments
domain requiredstringDomain of the merchant
language requiredLanguageslanguage flag to control the language of the connect element and only accept ar,en
country requiredstringCountry ISO2 of the merchant
scope requiredstringthe scope of the merchant available values merchant, auth
data optionalArray<string>Merchant data array ex: [operator]
lead optionalstringLead Id can be passed in case of you already created a lead using our API
mode requiredstringDecide to show connect as a popup or page to our connect domain. Default value is popup
mature requiredbooleanDecide the mode of connect normal or express
board optionalstringShow/Hide board screens
open requiredbooleanOpen/Close the connect library
boardMaturity optionalbooleanDecide the board maturity
postURL optionalstringThe POST Method URL used to push te data from our server to the merchant server and
it's required only if mature is false
redirectUrl optionalstringThis redirect url after verify authentication go to merchant website
It is required if scope is auth and mode is page
onReady optionalfunctionCallback function to handle the ready state of the TapConnect
onCreated optionalfunctionCallback function to called the the account created successfully
it calls only if mature is false
onSuccess optionalfunctionCallback function to handle the success response, it will run after the user finish the flow
onError optionalfunctionCallback function to handle the error response, it will run if the user face any error
onClose optionalfunctionCallback function to called when TapConnect get close
onBoardCompleted optionalfunctionCallback function to called when you complete all flows
2.8.75-beta

11 days ago

2.8.75-sandbox

11 days ago

2.5.5

15 days ago

2.8.64-sandbox

15 days ago

2.8.64-beta

15 days ago

2.8.65-sandbox

15 days ago

2.8.65-beta

15 days ago

2.5.4

15 days ago

2.8.63-sandbox

16 days ago

2.5.3

16 days ago

2.8.63-beta

16 days ago

2.8.62-development

2 months ago

2.8.62-beta

2 months ago

2.5.2

2 months ago

2.5.1

2 months ago

2.8.62-sandbox

2 months ago

2.5.0

2 months ago

2.8.61-development

2 months ago

2.8.61-beta

2 months ago

2.8.61-sandbox

2 months ago

2.8.60-beta

2 months ago

2.8.60-sandbox

2 months ago

2.8.60-development

2 months ago

2.8.59-beta

2 months ago

2.4.29

2 months ago

2.8.59-sandbox

2 months ago

2.8.59-development

2 months ago

2.8.57-beta

3 months ago

2.8.56-development

3 months ago

2.8.56-sandbox

3 months ago

2.8.56-beta

3 months ago

2.8.55-sandbox

3 months ago

2.8.55-beta

3 months ago

2.8.55-development

3 months ago

2.8.52-sandbox

3 months ago

2.8.52-beta

3 months ago

2.8.52-development

3 months ago

2.8.51-sandbox

3 months ago

2.8.51-development

3 months ago

2.8.50-development

3 months ago

2.8.46-development

4 months ago

2.8.46-sandbox

4 months ago

2.8.45-development

4 months ago

2.8.45-sandbox

4 months ago

2.8.45-beta

4 months ago

2.8.42-test

4 months ago

2.4.26

4 months ago

2.4.25

5 months ago

2.4.23

5 months ago

2.8.32-test

5 months ago

2.4.21

5 months ago

2.4.22

5 months ago

2.8.24-test

5 months ago

2.8.23-test

5 months ago

2.4.18

6 months ago

2.4.19

6 months ago

2.6.75-test

8 months ago

2.6.78-test

8 months ago

2.6.72-test

8 months ago

2.4.0

9 months ago

2.4.3

9 months ago

2.4.5

9 months ago

2.4.4

9 months ago

2.6.68-test

8 months ago

2.6.62-test

8 months ago

2.6.3-test

10 months ago

2.7.7-test

7 months ago

2.6.40-test

9 months ago

2.6.59-test

8 months ago

2.6.60-test

8 months ago

2.6.5-test

9 months ago

2.8.2-test

6 months ago

2.6.71-test

8 months ago

2.6.69-test

8 months ago

2.4.14

7 months ago

2.6.74-test

8 months ago

2.4.13

7 months ago

2.4.16

6 months ago

2.4.15

7 months ago

2.4.10

8 months ago

2.4.12

7 months ago

2.4.11

7 months ago

2.6.58-test

8 months ago

2.6.73-test

8 months ago

2.6.57-test

8 months ago

2.4.7

8 months ago

2.4.6

9 months ago

2.4.9

8 months ago

2.4.8

8 months ago

2.6.4-test

9 months ago

1.0.0-beta

8 months ago

2.6.56-test

8 months ago

2.7.8-test

6 months ago

2.6.67-test

8 months ago

2.6.64-test

8 months ago

2.6.80-test

7 months ago

1.3.11

10 months ago

2.6.54-test

8 months ago

2.6.61-test

8 months ago

2.6.7-test

9 months ago

2.6.76-test

8 months ago

2.6.70-test

8 months ago

2.8.8-test

6 months ago

2.6.8-test

9 months ago

2.6.77-test

8 months ago

2.6.63-test

8 months ago

2.6.66-test

8 months ago

2.6.81-test

7 months ago

2.8.0-test

6 months ago

2.6.65-test

8 months ago

2.6.79-test

8 months ago

2.5.23-test

10 months ago

2.5.14-test

11 months ago

1.3.10

11 months ago

2.5.3-test

12 months ago

1.3.9

11 months ago

1.3.5

12 months ago

1.3.4

12 months ago

1.3.3

12 months ago

0.0.19-test

12 months ago

1.2.0

1 year ago

1.1.0

1 year ago

1.3.2

12 months ago

1.3.1

12 months ago

1.3.0

12 months ago

0.0.17-test

1 year ago

0.0.18-test

12 months ago

2.5.2-test

12 months ago

0.0.16-test

1 year ago

1.0.7

1 year ago

1.0.2

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.1

1 year ago

0.0.15-test

1 year ago

0.0.14-test

1 year ago

0.0.12-test

1 year ago

0.0.13-test

1 year ago

0.0.11-test

1 year ago

0.0.9-test

1 year ago

1.0.0

1 year ago

0.0.1-test

1 year ago

0.0.6-test

1 year ago

0.0.7-test

1 year ago

0.0.3-test

1 year ago

0.0.4-test

1 year ago

0.0.5-test

1 year ago

0.0.10-test

1 year ago

0.0.0-test

1 year ago

0.0.2-test

1 year ago

2.0.0

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago