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.

The function signature is as follows:

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

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.

Did you find this page useful?