The result callback is invoked when the payment handle is successfully created and is in the PAYABLE state or when there is an error in the checkout. It also passes an instance of the Checkout object. Using the functions provided in the instance object, the merchant can control the checkout experience.

The resultCallback contains the following elements.

Parameter Type Required Description
instance object Yes This is the Paysafe Payments Checkout instance.
error object No This object contains error information and is present if payment handle creation fails.
result object Yes This is the result that contains the payment token.
{return} undefined false


Parameter Type Required Description
isOpen function Yes Checks if the overlay is still open.
close function Yes Closes the overlay without displaying result from payment.
showSuccessScreen function Yes Changes Checkout layout to success screen.
showFailureScreen function Yes Changes Checkout layout to failure screen.


Parameter Type Required Description
message string Yes Provides an error that can be displayed to users.
detailedMessage string Yes Provides a detailed error message that can be logged.
correlationId string Yes This is a unique ID that can be provided to the Paysafe Support team as a reference for investigation.


Parameter Type Required Description
paymentHandleToken string Yes This is the Payment Handle token to be included in the Payments API call.
paymentMethod string Yes This is the payment method used by the customer.
customerOperation string Yes

This is the customer operation for the card. Possible values are:

  • ADD
  • EDIT
amount number Yes This is the amount used to create the Payment Handle. This is required because the user might change the amount in the Checkout.

An example is shown below:

function(instance, error, result) {        
if (result.token) {

	// Successfully tokenized card, use result.token to process a payment

	// add AJAX code to send token to your merchant server

	instance.showSuccessScreen("Your goods are now purchased. Expect them to be delivered in next 5 business days.");         
} else {

	// tokenization failed

	instance.showFailureScreen("The payment was declined. Please, try again with the same or another payment method.");          



The close callback This notifies the merchant script when the Checkout gets closed. The following actions invoke the closeCallback:

  • When the customer closes the Checkout.
  • When Merchant closes the Checkout using instance.close() method in the result callback after payments call.

The closeCallback contains the following elements.

Parameter Type Required Description
stage string Yes


  • PAYMENT_HANDLE_NOT_CREATED: Checkout did not initiate a session with Paysafe or PSP.
  • PAYMENT_HANDLE_CREATED: Checkout initiated a session with Paysafe/PSP and obtained the details required to initiate a payment.
  • PAYMENT_HANDLE_REDIRECT: Checkout successfully redirected the customer to the PSP hosted page and is waiting for the callback from the hosted page. This is applicable only for flows where the customer is redirected to a different page. Indicates the payment is in progress in the redirected page. PAYMENT_HANDLE_PAYABLE: The customer completed the payment, and either customer closes the Checkout after seeing the success/failure screen (This can be initiated by merchant script in result callback using instance.showSuccessScreen()/instance.showFailureScreen() methods) or merchant script closes the Checkout after payments call from result callback by calling instance.close() method.
expired boolean Yes This indicates whether the close event was triggered after the Checkout expired.
{return} undefined false
Did you find this page useful?