Interface PSPDriver<PayMetaType>
checkStatus(paymeta: PayMetaType): Promise<PSPCheckResult>;
connect(): Promise<PSPSetup | { error: string }>;
precheckPayment(request: PSPPrecheckRequest): Promise<PSPPrecheckResult>;
processPush(
paymeta: PayMetaType,
req: PSPWebRequest,
): Promise<PSPPushResult>;
processReturn(
paymeta: PayMetaType,
req: PSPWebRequest,
): Promise<PSPCheckResult>;
startPayment(request: PSPRequest): Promise<PSPPayResult<PayMetaType>>;
}
Type Parameters
- PayMetaType = unknown
Data cached after sending a payment request to the API to be able to request the status later (eg a transaction id)
Methods
check Status
Check the current status of the payment
Parameters
- paymeta: PayMetaType
Returns Promise<PSPCheckResult>
connect
Connect with the API, verify the configuration as passed to the constructor
Returns Promise<PSPSetup | { error: string }>
Optional
precheck Payment
Precheck as much as we can before actually starting the payment. This is usally part of form validation before the actual payment starts
Parameters
- request: PSPPrecheckRequest
Returns Promise<PSPPrecheckResult>
Optional
process Push
Process a push/notification directly from the payment portal
Parameters
- paymeta: PayMetaType
- req: PSPWebRequest
Returns Promise<PSPPushResult>
Optional
process Return
Process the user returning from the payment portal. If not implemented we'll fall back to a checkStatus call.
Parameters
- paymeta: PayMetaType
Data cached after sending a payment request to the API to be able to request the status later (eg a transaction id)
- req: PSPWebRequest
Current request landing on the return page
Returns Promise<PSPCheckResult>
- paymeta: PayMetaType
start Payment
Starts the payment. If succesful we generally return a redirect to an external payment portal
Parameters
- request: PSPRequest
Returns Promise<PSPPayResult<PayMetaType>>
Metadata to store for later status checks
Interface to be implemented by a payment driver