Secure contextThis feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
The cardNumber
property of the BasicCardResponse
dictionary contains the cardholder name of the card used to make the payment.
Syntax
name = basicCardResponse.cardholderName;
Value
A DOMString
indicating the name of the cardholder.
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 PaymentThe definition of 'cardholderName' in that specification. | Working Draft | Initial definition. |
Browser Compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
cardholderName
|
Chrome
No support No |
Edge
No support ≤18 — 79 |
Firefox Full support 56 Full support 56 Notes' Available only in nightly builds.
Disabled' From version 56: this feature is behind the |
IE
No support No |
Opera
No support No |
Safari
? |
WebView Android
No support No |
Chrome Android
Full support 57 |
Firefox Android Full support 56 Full support 56 Notes' Available only in nightly builds.
Disabled' From version 56: this feature is behind the |
Opera Android
No support No |
Safari iOS
? |
Samsung Internet Android
Full support 7.0 |
Legend
- Full support
- Full support
- No support
- No support
- Compatibility unknown
- Compatibility unknown
- See implementation notes.'
- See implementation notes.
- User must explicitly enable this feature.'
- User must explicitly enable this feature.
BasicCardResponse.cardholderName by Mozilla Contributors is licensed under CC-BY-SA 2.5.