VaultManager

VaultManager

This class allows you to manage a customer's payment methods on the client.

Constructor

new VaultManager(options)

You cannot use this constructor directly. Use braintree.vault-manager.create instead.

Parameters:
Name Type Description
options object

Options

Source:

Methods

deletePaymentMethod(paymentMethodNonce, callbackopt) → {Promise|void}

Deletes a payment method owned by the customer whose id was used to generate the client token used to create the client.

Parameters:
Name Type Attributes Description
paymentMethodNonce string

The payment method nonce that references a vaulted payment method.

callback callback <optional>

No data is returned if the operation is successful.

Source:
Example
vaultManagerInstance.deletePaymentMethod('nonce-to-delete', function (err) {
  // handle err if it exists
});

fetchPaymentMethods(optionsopt, callbackopt) → {Promise|void}

Fetches payment methods owned by the customer whose id was used to generate the client token used to create the client.

Parameters:
Name Type Attributes Description
options object <optional>

Options for fetching payment methods.

Properties
Name Type Attributes Default Description
defaultFirst boolean <optional>
false

If true, the payment methods will be returned with the default payment method for the customer first. Otherwise, order is not guaranteed.

callback callback <optional>

The second argument is a fetchPaymentMethodsPayload. This is also what is resolved by the promise if no callback is provided.

Source:
Example
vaultManagerInstance.fetchPaymentMethods(function (err, paymentMethods) {
  paymentMethods.forEach(function (paymentMethod) {
    // add payment method to UI
    // paymentMethod.nonce <- transactable nonce associated with payment method
    // paymentMethod.details <- object with additional information about payment method
    // paymentMethod.type <- a constant signifying the type
  });
});

teardown(callbackopt) → {Promise|void}

Cleanly tear down anything set up by create.

Parameters:
Name Type Attributes Description
callback callback <optional>

Called once teardown is complete. No data is returned if teardown completes successfully.

Source:
Examples
vaultManagerInstance.teardown();

With callback

vaultManagerInstance.teardown(function () {
  // teardown is complete
});

Type Definitions

fetchPaymentMethodsPayload :array

The customer's payment methods.

Properties:
Name Type Description
paymentMethod object

The payment method object.

Properties
Name Type Attributes Description
nonce string

A nonce that can be sent to your server to transact on the payment method.

default boolean

Whether or not this is the default payment method for the customer.

details object

Any additional details about the payment method. Varies depending on the type of payment method.

type string

A constant indicating the type of payment method.

description string <nullable>

Additional description about the payment method.

binData object <nullable>

Bin data about the payment method.

Source: