0.0.75 • Published 9 months ago

@leatcom/portal-sessions v0.0.75

Weekly downloads
-
License
-
Repository
-
Last release
9 months ago

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-sessions
yarn add @leatcom/portal-sessions

Documentation

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

PropTypeRequiredDescription
apiKeystringYesAPI key used to authenticate.
shopUuidstringYesThe shop's uuid.
contactUuidstringNoOptional contact uuid. This opens the portal session for this contact specifically.
typePortalTypeNoOptional portal type, defaults to "PORTAL".
primaryIdentificationMethodstringNoStart the identification flow with either "email" or "identifier", defaults to "identifier".
enableEmailIdentificationbooleanNoOptional alternative route to identify a contact.
enableOnScreenKeyboardbooleanNoOptional on-screen keyboard.
allowMultipleGiftcardsbooleanNoAllow using multiple giftcards in one session. Applies to sessions with PortalType "REDEEM_GIFTCARD".
amountInCentsnumberNoA purchase amount in cents. Applies to sessions with PortalType "REDEEM_GIFTCARD" and "PAY_PREPAID".
onContactLink(contact: ContactResource) => voidNoOptional callback. Called when a contact is linked to the portal session.
onClaimReward(reward: RewardResource, transactionUuid?: string) => voidNoOptional callback. Called when a reward is claimed.
onRedeemVoucher(voucher: VoucherResource) => voidNoOptional callback. Called when a voucher is redeemed.
onUseGiftcard(giftcardTransaction: GiftcardTransactionResource) => voidNoOptional 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",
}
0.0.75

9 months ago

0.0.73

9 months ago

0.0.74

9 months ago

0.0.70-beta.1

9 months ago

0.0.75-beta.1

9 months ago

0.0.75-beta.2

9 months ago

0.0.70-beta.2

9 months ago

0.0.70-beta.3

9 months ago

0.0.75-beta.3

9 months ago

0.0.75-beta.4

9 months ago

0.0.70

9 months ago

0.0.75-beta.5

9 months ago

0.0.71

9 months ago

0.0.72

9 months ago

0.0.69

9 months ago

0.0.68

9 months ago

0.0.67

9 months ago

0.0.62

9 months ago

0.0.63

9 months ago

0.0.64

9 months ago

0.0.65

9 months ago

0.0.66

9 months ago

0.0.60

9 months ago

0.0.61

9 months ago

0.0.59

9 months ago

0.0.54

10 months ago

0.0.55

10 months ago

0.0.56

10 months ago

0.0.57

10 months ago

0.0.58

9 months ago

0.0.53

10 months ago

0.0.51

10 months ago

0.0.52

10 months ago

0.0.50

10 months ago

0.0.47

10 months ago

0.0.48

10 months ago

0.0.49

10 months ago

0.0.46

11 months ago

0.0.45

11 months ago

0.0.44

11 months ago

0.0.43

11 months ago

0.0.43-beta.4

11 months ago

0.0.43-beta.3

11 months ago

0.0.43-beta.2

11 months ago

0.0.43-beta.1

11 months ago

0.0.43-beta.0

11 months ago

0.0.42

12 months ago

0.0.41

12 months ago

0.0.40

12 months ago

0.0.39

12 months ago

0.0.38

12 months ago

0.0.37

12 months ago

0.0.36

12 months ago

0.0.35

12 months ago

0.0.34

12 months ago

0.0.33

12 months ago

0.0.32

1 year ago

0.0.31

1 year ago

0.0.30

1 year ago

0.0.29

1 year ago

0.0.28

1 year ago

0.0.26

1 year ago

0.0.25

1 year ago

0.0.24

1 year ago

0.0.23

1 year ago