Search Overlay

Show Function

The show function loads the Paysafe.js payment methods inside the selected HTML element containers (typically div elements) on your payment page. This function has no parameters.

The function should be invoked immediately after the setup function on the hosted fields instance, which is returned on setup.

The function signature is as follows:

instance.show()
.then((paymentMethods) => {
/** Continue with events handling */
if (paymentMethods.card && !paymentMethods.card.error) {
// Card payment method is successfully initialized
}
if (paymentMethods.applePay && !paymentMethods.applePay.error) {
// Apple Pay payment method is successfully initialized
}
})
.catch((error) => {/** Process any errors during the show */})

Or you can use Async-await:

async function showPaysafeJS() {
try {
const paymentMethods = await instance.show()
/** Continue with events handling */
if (paymentMethods.card && !paymentMethods.card.error) {
// Card payment method is successfully initialized
}
if (paymentMethods.applePay && !paymentMethods.applePay.error) {
// Apple Pay payment method is successfully initialized
}
} catch(error) {
/** Process any errors during the show */
}
}

Show functions return a Promise, which is then resolved in a payment methods object.

The paymentMethods object will contain a list of the provided payment methods on setup and the result from their initialization.

Parameter Optional Type Description
paymentMethods

card

true Object

An object that will contain an error only if such occurs during the initialization of the payment method.

When the initialization of the method is successful, an empty object will be returned.

applePay true Object

An object that will contain an error only if such occurs during the initialization of the payment method.

When the initialization of the method is successful, an empty object will be returned.

Show Error Object

The show() will throw an error only if none of the provided methods is successfully initialized.

The following table describes the contents of the error object:

Parameter Required Type Description
code true String Error Code
displayMessage true String Error message for display to customers.
detailedMessage true String A detailed description of the error (this information should not be displayed to customers).
correlationId true String Unique error ID to be provided to Paysafe Support during an investigation.

Expected Errors

Code Display Message Detailed Message Description

9028

There was an error (9028), please contact our support. Failed to initialize Paysafe.js iframes.

The iframes used for the sensitive payment fields failed to initialize within 5 seconds. This could occur if the server that generates the HTML for the iframe is not available.

9073 There was an error (9073), please contact our support. Account not configured correctly.

The error is a result of an improperly created merchant account configuration:

  • Merchant has no account or payment methods configured.
  • The account that is provided on setup is not configured for the merchant.
  • Merchant has more than one account for the same currency, and non is provided on setup option.accounts.default
  • Merchant is using isUsingSharedApiKey and no account is provided on setup option.accounts.default
9055 There was an error (9055), please contact our support. Invalid currency parameter. The currencyCode is not a valid ISO currency
9084 There was an error (9084), please contact our support. Failed to load available payment methods. There was a problem getting the merchant's payment methods.
ApplePay Specific Errors
9014 There was an error (9014), please contact our support. Unhandled error occurred. The error was unexpected but it was logged and correlationId was set to help problem investigation.
9066 There was an error (9066), please contact our support. Invalid label parameter. Invalid Payment Request label option parameter.
9071 There was an error (9071), please contact our support. Paysafe Request is already initialized. Trying to show the Apple Pay button more than once.
9063 There was an error (9063), please contact our support. Invalid buttonColor parameter. Used when the supplied color is not supported by Apple pay
9077 There was an error (9077), please contact our support. Requested currency: [XXX] but Supported: [AAA, ...] The merchant requested a currency via the init or update methods that is not enabled in its account (smart routing service).
9085 There was an error (9085), please contact our support. There are no available payment methods for this api key. The merchant does not have the APPLE PAY configured.
9086 There was an error (9086), please contact our support. The browser does not support the payment methods, the user has no active card in the wallet, or the merchant domain is not validated with Apple. The browser does not support the payment methods, the user has no active card in the wallet, or the merchant domain is not validated with Apple
9088 There was an error (9088), please contact our support. Unable to show buttons. Requested: [...] but Supported: [...] Supported and requested payment methods do not match and the Payment Button fails to display.
9091 There was an error (9091), please contact our support. Invalid buttonType parameter. The options button type argument is invalid.