BasicCardResponse.expiryMonth

Secure context

This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

Experimental

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The expiryMonth property of the BasicCardResponse dictionary contains the expiry month of the card used to make the payment.

Syntax

"expiryMonth" : "number"

Value

A DOMString representing the card expiry month as a two-digit number in the range 01 to 12.

Example

Let's look at a sample payment request:

var request = new PaymentRequest(supportedInstruments, details, options);

// Call show() to trigger the browser's payment flow.
request.show().then(function(instrumentResponse) {
  // Do something with the response from the UI.
  console.log(instrumentResponse.details);
})
.catch(function(err) {
  // Do something with the error from request.show().
});

Once the payment flow has been triggered using PaymentRequest.show() and the promise resolves successfully, the PaymentResponse object available inside the fulfilled promise (instrumentResponse above) will have a PaymentResponse.details property that will contain response details. This has to conform to the structure defined by the BasicCardResponse dictionary, and may look something like this:

{
  "cardNumber' : '9999999999999999",
  "cardholderName' : 'Mr. Dick Straw",
  "cardSecurityCode" : "999",
  "expiryMonth" : "07",
  "expiryYear" : "2021",
  "billingAddress" : {
    "country" : "GB",
    // etc. billing address is a PaymentAddress object
  }
}

Specifications

Specification Status Comment
Basic Card Payment
The definition of 'expiryMonth' in that specification.
Working Draft Initial definition.

Browser compatibility

BCD tables only load in the browser