Setup Function

The setup function creates and initializes the Paysafe Checkout in an overlay. It has the following parameters:

  • The Public API key provided in the Business Portal. Note that this key can only be used to generate payment handle tokens for use with payments, and has no other API access rights, such as those required for taking payments. Consequently, this key can be exposed publicly in the user's browser.
  • An options object contains the environment to use (Test or Live), the payment amount, currency, and several parameters to show additional features in the payment form.
  • A resultCallback function receives the Paysafe checkout instance, handle successful payment handle (by sending the payment handle to your merchant server), or respond to any errors caused by a failed payment handle creation.
  • An optional closeCallback function you handles the customer closing the payment overlay.
  • An optional riskCallback function to receive the amount and payment method which Customer has selected and run your risk checks before payment handle is created. Depending on the riskCallback response, Payment handle will be created and returned in resultCallback (Applicable to only Cards, PaySafe Cash, VIPP and Sightline).

The function signature is as follows:

paysafe.checkout.setup (apiKey, options, resultCallback, closeCallback, riskCallback)

Setup Function and Objects

Parameter Type Required Validations Description
apiKey string Yes This is your Public API key, available in the Business Portal.
options object Yes This is your configuration for rendering the Checkout.
resultCallback function Yes This is the function to be invoked when the payment handle needs to be passed to the merchant, who then uses it to make the payment.
closeCallback function No The function to be invoked when the user closes the Checkout without making a payment.
riskCallback function No The function to be invoked when the merchant wants to run its own risk rule using amount and payment method. Depending on the callback response, Payment handle will be created and returned in resultCallback (Applicable to only Cards, PaySafe Cash, VIPP and Sightline).
Parameter Type Required Validations Description
apiKey string Yes This is your Public API key, available in the BusinThis is the Paysafe Payments Checkout instance.ess Portal.
Did you find this page useful?