AmericanExpress

AmericanExpress

This class allows you use a nonce to interact with American Express Checkout. To accept American Express cards, use Hosted Fields.

Constructor

new AmericanExpress(options)

You cannot use this constructor directly. Use braintree.american-express.create instead.

Parameters:
Name Type Description
options object

Options

Source:

Methods

getExpressCheckoutProfile(options, callbackopt) → {Promise|void}

Gets the Express Checkout nonce profile given a nonce from American Express.

Parameters:
Name Type Attributes Description
options object

Request options

Properties
Name Type Description
nonce string

An existing nonce from American Express (note that this is not a nonce from Braintree).

callback callback <optional>

The second argument, data, is the returned server data. If no callback is provided, getExpressCheckoutProfile returns a promise that resolves with the server data.

Source:
Example
var americanExpress = require('braintree-web/american-express');

americanExpress.create({client: clientInstance}, function (createErr, americanExpressInstance) {
  var options = {nonce: existingAmericanExpressNonce};
  americanExpressInstance.getExpressCheckoutProfile(options, function (getErr, payload) {
    if (getErr) {
      // Handle error
      return;
    }

    console.log('Number of cards: ' + payload.amexExpressCheckoutCards.length);
  });
});

getRewardsBalance(options, callbackopt) → {Promise|void}

Gets the rewards balance associated with a Braintree nonce.

Parameters:
Name Type Attributes Description
options object

Request options

Properties
Name Type Description
nonce string

An existing Braintree nonce.

callback callback <optional>

The second argument, data, is the returned server data. If no callback is provided, getRewardsBalance returns a promise that resolves with the server data.

Source:
Example
var americanExpress = require('braintree-web/american-express');

americanExpress.create({client: clientInstance}, function (createErr, americanExpressInstance) {
  var options = {nonce: existingBraintreeNonce};
  americanExpressInstance.getRewardsBalance(options, function (getErr, payload) {
    if (getErr || payload.error) {
      // Handle error
      return;
    }

    console.log('Rewards amount: ' + payload.rewardsAmount);
  });
});

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
americanExpressInstance.teardown();

With callback

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