@livechat/text-payments
v0.0.2-beta.4
Published
Text Payments goal is to be a collection of tools, with which you can easily integrate payment flows for Text, and Text-related products (subscriptions, apps, in-app purchases). The package is currently in the prototype stage, so please be mindful of that
Downloads
20
Maintainers
Keywords
Readme
Text Payments
Text Payments goal is to be a collection of tools, with which you can easily integrate payment flows for Text, and Text-related products (subscriptions, apps, in-app purchases). The package is currently in the prototype stage, so please be mindful of that.
Usage
Installation
NPM
npm install @livechat/text-payments
or to get the tarball:
npm pack @livechat/text-payments
CC Form usage
init(config)
Use the init method to create and embed form in a host element. Init takes a single argument, config object with properties:
token
(required) - Auth bearer token, required for Billing API callsproduct
(required) - one of the supported products (currently:'livechat' | 'alphabot'
)rootId
- id of the host element (default:'root'
)env
- set this to'test' | 'labs'
for API labs envonSuccess(data: eventParams)
- callback invoked when CC is saved successfullyonError(data: eventParams)
- callback invoked when error occurs during CC saveonCancel()
- callback invoked whenCancel
button is clickedcustomStyles
- Emotion-compatible object, applied on the root div container; target.cc-form-container
class to access the direct form wrapper styles
Example usage in index.html
, UMD:
<div id="embed-root">
<script src="/package/dist/text-payments.umd.cjs"></script>
<script defer>
TextPayments.init({
token: <auth_token>,
product: <'livechat' | 'alphabot'>,
rootId: 'embed-root',
env: 'labs'
})
</script>