UnionPay

UnionPay

This class represents a UnionPay component. Instances of this class have methods for fetching capabilities of UnionPay cards, enrolling a UnionPay card, and tokenizing a UnionPay card.

Constructor

new UnionPay(options)

Do not use this constructor directly. Use braintree-web.unionpay.create instead.

Parameters:
Name Type Description
options object

see unionpay.create

Source:

Methods

enroll(options, callback) → {void}

Enrolls a UnionPay card. Only call this method if the card needs to be enrolled. Use fetchCapabilities to determine if the user's card needs to be enrolled.

Parameters:
Name Type Description
options object

UnionPay enrollment options

Properties
Name Type Description
card object

The card to enroll

Properties
Name Type Description
number string

Card number

expirationMonth string

The card's expiration month

expirationYear string

The card's expiration year

mobileCountryCode string

Customer's mobile country code

mobileNumber string

Customer's mobile phone number. This is the mobile phone number UnionPay will send an SMS auth code to

callback errback

The second argument, data, is a enrollPayload

Source:

fetchCapabilities(options, errback) → {void}

Fetches the capabilities of a card, including whether or not the card needs to be enrolled before use. If the card needs to be enrolled, use enroll

Parameters:
Name Type Description
options object

UnionPay fetchCapabilities options

Properties
Name Type Description
cardNumber object

The card number to fetch capabilities for

errback errback

The second argument, data, is a fetchCapabilitiesPayload

Source:

tokenize(options, callback) → {void}

Tokenizes a UnionPay card, returning a nonce payload!

Parameters:
Name Type Description
options object

UnionPay tokenization options

Properties
Name Type Description
card object

The card to enroll

Properties
Name Type Description
number string

Card number

expirationMonth string

The card's expiration month

expirationYear string

The card's expiration year

cvv string

The card's security number

options object

Additional options

Properties
Name Type Description
id string

The enrollment id if UnionPay#enroll was required

smsCode string

The SMS code recieved from the user if UnionPay#enroll was required

callback errback

The second argument, data, is a tokenizePayload

Source:

Type Definitions

enrollPayload :object

Properties:
Name Type Description
unionPayEnrollmentId string

UnionPay enrollment ID

Source:

fetchCapabilitiesPayload :object

Properties:
Name Type Description
isUnionPay boolean

Determines if this card is a UnionPay card

isDebit boolean

Determines if this card is a debit card

unionPay object

UnionPay specific properties

Properties
Name Type Description
supportsTwoStepAuthAndCapture boolean

Determines if the card allows for an authorization, but settling the transaction later

isUnionPayEnrollmentRequired boolean

Notifies if enrollment should be completed

Source:

tokenizePayload :object

Properties:
Name Type Description
nonce string

The payment method nonce

type string

Always CreditCard

details object

Additional account details

Properties
Name Type Description
cardType string

Type of card, ex: Visa, MasterCard

lastTwo string

Last two digits of card number

description string

A human-readable description

Source: