Search Overlay

updateOptions Function

The updateOptions function enables you to update all the Payment Request options provided during initalization, except for the environment parameter. The other option parameters are applied when the user clicks the payment button, which creates the Apple Pay session, and can be modified at any point up until this happens. If the options are updated after the Apple Pay session is created they are stored and applied to the next session created.

The function signature is as follows:


The function parameters are described below.

  Required Type Description
options true


The same parameters as used in the init function options, except for environment, which you cannot change.

{throws}     Throws an exception with the following errors: 9014, 9015, 9017, 9054, 9055, 9066, 9067, 9068, 9069, 9070, 9093.
{return} false undefined

Apple Pay Example

This example in the TEST environment updates the init options before calling showButtons. Note that the JS calling onTokenization is not shown.

<script type="text/javascript" src=""></script>
<div id="x-paysafe-apple-pay-button"></div>
var requestOptions = {
country: "US",
currency: "USD",
amount: 1234,
label: "My label"

paysafe.request.init("my API key", requestOptions);

paysafe.request.canMakePayment(function (methods, error) {
if (methods) {
if (methods.indexOf("APPLEPAY") < 0) {
// Apple pay not supported
} else {
requestOptions.amount = 1523;
requestOptions.label = "label updated";

paysafe.request.showButtons(function (displayedPaymentMethods, error) {
if (error) {
// handle error
} else {
// handle error
On this Page