Intent
@littleapp/little-pay-api / Exports / Intent
Class: Intent
Table of contents
Constructors
Properties
Methods
Constructors
constructor
• new Intent(params
): Intent
Parameters
Name | Type |
---|---|
params | CreateIntentParams |
Returns
Properties
checkoutUrl
• Private
Optional
checkoutUrl: string
creationParams
• Private
creationParams: CreateIntentParams
paToken
• Private
Optional
paToken: PaToken
reference
• Private
Optional
reference: string
Methods
create
▸ create(clientId
, clientSecret
, tokenId
): Promise
\<{ checkoutUrl
: string
; message
: string
; reference
: string
}>
Parameters
Name | Type |
---|---|
clientId | string |
clientSecret | string |
tokenId | string |
Returns
Promise
\<{ checkoutUrl
: string
; message
: string
; reference
: string
}>
createPaToken
▸ createPaToken(params
): Promise
\<PaToken
>
Parameters
Name | Type |
---|---|
params | ProcessorPayload \<"CARDS" > |
Returns
Promise
\<PaToken
>
getCheckoutUrl
▸ getCheckoutUrl(): string
Get the checkout URL.
Returns
string
- The checkout URL
Throws
LittlePayError Will throw an error if the checkout URL is not available.
getPaToken
▸ getPaToken(): undefined
| PaToken
Get the PaToken.
Returns
undefined
| PaToken
- The PaToken
getReference
▸ getReference(): string
Get the intent reference.
Returns
string
- The intent reference
Throws
LittlePayError If the reference is not available.
redirectToCheckout
▸ redirectToCheckout(): void
Redirects the user to the checkout page. If you set a return URL when creating the intent, the user will be redirected to that URL after the payment is completed.
Returns
void
Throws
LittlePayError If the checkout URL is not available.