Wallet Checkout
Introduction
The Wallet checkout module exposes features for making wallet checkout operations.
Wallet Checkout Service
The WalletCheckoutService can be used for managing wallet checkout related operations.
Get session
Retrieves a specific user Session by ID.
import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';
import { WalletCheckoutGetSession } from '@paysafe/paysafe-wallet-saas-web/wallet-checkout';
const sessionId = '01KKVREY6PAWC2BNGCTSY91QG8';
const secureCode = '226a9c74e13d166d16e6ff843a3eb75f43ded3c0b9239b8ce0082a8315f3ca46';
const parameters: WalletCheckoutGetSession = { secureCode };
Wallet.getInstance().getWalletCheckoutService().getSession(sessionId, parameters)
.then(response => console.log('Session info', response))
.catch(error => console.error('Error getting session', error));
Preview payment
Create payment for wallet checkout session in PREVIEW status. Returns Payment details.
import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';
import { WalletCheckoutPaymentPreview } from '@paysafe/paysafe-wallet-saas-web/wallet-checkout';
const sessionId = '01KKVREY6PAWC2BNGCTSY91QG8';
const secureCode = '226a9c74e13d166d16e6ff843a3eb75f43ded3c0b9239b8ce0082a8315f3ca46';
const request: WalletCheckoutPaymentPreview = {
sessionId,
secureCode
};
Wallet.getInstance().getWalletCheckoutService().previewPayment(request)
.then(response => console.log('Preview payment', response))
.catch(error => console.error('Error previewing payment', error));
Create payment
Updates the status of an existing payment within a checkout session to PENDING. Returns Payment details.
import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';
import { WalletCheckoutPaymentCreate } from '@paysafe/paysafe-wallet-saas-web/wallet-checkout';
const sessionId = '01KKVREY6PAWC2BNGCTSY91QG8';
const secureCode = '226a9c74e13d166d16e6ff843a3eb75f43ded3c0b9239b8ce0082a8315f3ca46';
const paymentCreate: WalletCheckoutPaymentCreate = {
sessionId,
secureCode
};
Wallet.getInstance().getWalletCheckoutService().createPayment(paymentCreate)
.then(response => console.log('Create payment', response))
.catch(error => console.error('Error creating payment', error));
Confirm payment
Updates the status of an existing payment within a checkout session to PROCESSING. Supports optional SCA (Strong Customer Authentication) details for regulatory compliance. Returns Payment details.
import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';
import { WalletCheckoutPaymentConfirm } from '@paysafe/paysafe-wallet-saas-web/wallet-checkout';
import { ScaAuthenticationEventRequest } from '@paysafe/paysafe-wallet-saas-web/common';
const sessionId = '01KKVREY6PAWC2BNGCTSY91QG8';
const secureCode = '226a9c74e13d166d16e6ff843a3eb75f43ded3c0b9239b8ce0082a8315f3ca46';
const scaDetails: ScaAuthenticationEventRequest = {
eventId: '06bdc2c0-cce-4b36-97ec-281c8f5d743c',
walletOperationId: 'a5865fd6-18c2-45a8-9953-1c00eac36c36'
}
const paymentConfirm: WalletCheckoutPaymentConfirm = {
sessionId: sessionId,
secureCode: secureCode,
scaDetails: scaDetails
};
Wallet.getInstance().getWalletCheckoutService().confirmPayment(paymentConfirm)
.then(response => console.log('Confirm payment', response))
.catch(error => console.error('Error confirming payment', error));
Cancel payment
Updates the status of an existing payment within a checkout session to CANCELLED. Returns Payment details.
import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';
import { WalletCheckoutPaymentCancel } from '@paysafe/paysafe-wallet-saas-web/wallet-checkout';
const sessionId = '01KKVREY6PAWC2BNGCTSY91QG8';
const secureCode = '226a9c74e13d166d16e6ff843a3eb75f43ded3c0b9239b8ce0082a8315f3ca46';
const paymentCancel: WalletCheckoutPaymentCancel = {
sessionId: sessionId,
secureCode: secureCode
};
Wallet.getInstance().getWalletCheckoutService().cancelPayment(paymentCancel)
.then(response => console.log('Cancel payment', response))
.catch(error => console.error('Error cancelling payment', error));