@leatcom/portal-sessions v0.0.75
Portal Sessions by Leat | Piggy
This is the Javascript SDK for integrating with Leat | Piggy using Portal Sessions. Sign up for a free Leat | Piggy account here.
More information on Portal Sessions and their specific API calls can be found on the API Documentation.
Installation
Install using
npm install @leatcom/portal-sessionsyarn add @leatcom/portal-sessionsDocumentation
Usage
Portal Sessions come in different types, each with their own use. To initiate a Portal Sessions, an API key is required, which can be created in your account's Dashboard. A Portal Session is also always created for a specific Shop, so the shopUuid is also required. You can find a Shop's UUID in your Dashboard or by API.
Currently, there are five Portal Session types:
- PORTAL: This is the 'default' session type, which doesn't have a predefined aim, but rather allows for flexible use. See this as a way for customers to login to their own portal.
- REDEEM_GIFTCARD: A session to use and redeem gift card(s). Best used as payment option.
- TOP_UP_GIFTCARD: A session to sell and/or top up existing gift cards.
- PAY_PREPAID: A session to handle prepaid transactions.
- TOP_UP_PREPAID: A session to top up prepaid balance.
- POINTS_TRANSACTION: A session to handle an order and a subsequent credit reception.
- VOUCHER: A session to redeem vouchers.
Initiate a new Portal Session as follows:
<PortalSession
    apiKey={apiKey}
    shopUuid={shopUuid}
    type="PORTAL"
    onRedeemVoucher={(voucher) => handleVoucherLogic(voucher)}
/>Portal Session Props
| Prop | Type | Required | Description | 
|---|---|---|---|
| apiKey | string | Yes | API key used to authenticate. | 
| shopUuid | string | Yes | The shop's uuid. | 
| contactUuid | string | No | Optional contact uuid. This opens the portal session for this contact specifically. | 
| type | PortalType | No | Optional portal type, defaults to "PORTAL". | 
| primaryIdentificationMethod | string | No | Start the identification flow with either "email"or"identifier", defaults to"identifier". | 
| enableEmailIdentification | boolean | No | Optional alternative route to identify a contact. | 
| enableOnScreenKeyboard | boolean | No | Optional on-screen keyboard. | 
| allowMultipleGiftcards | boolean | No | Allow using multiple giftcards in one session. Applies to sessions with PortalType"REDEEM_GIFTCARD". | 
| amountInCents | number | No | A purchase amount in cents. Applies to sessions with PortalType"REDEEM_GIFTCARD"and"PAY_PREPAID". | 
| onContactLink | (contact: ContactResource) => void | No | Optional callback. Called when a contact is linked to the portal session. | 
| onClaimReward | (reward: RewardResource, transactionUuid?: string) => void | No | Optional callback. Called when a reward is claimed. | 
| onRedeemVoucher | (voucher: VoucherResource) => void | No | Optional callback. Called when a voucher is redeemed. | 
| onUseGiftcard | (giftcardTransaction: GiftcardTransactionResource) => void | No | Optional callback. Called when a giftcard payment is made. | 
Types
PortalType
export enum PortalType {
    REDEEM_GIFTCARD = "REDEEM_GIFTCARD",
    TOP_UP_GIFTCARD = "TOP_UP_GIFTCARD",
    PORTAL = "PORTAL",
    PAY_PREPAID = "PAY_PREPAID",
    TOP_UP_PREPAID = "TOP_UP_PREPAID",
    POINTS_TRANSACTION = "POINTS_TRANSACTION",
    VOUCHER = "VOUCHER",
}12 months ago
1 year ago
1 year ago
1 year ago
12 months ago
12 months ago
1 year ago
1 year ago
12 months ago
12 months ago
1 year ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago