LanguageValues and typesStandard typesMoney and banking
PaymentCardNumber
On this page
A payment card's full number, checked by its check digit.
Use it only for the moment you pass a number on to a payment provider. To keep something about a card, use MaskedCardNumber, which money.mask makes from this one.
Shape
One value, held as text in one set form, with no parts: 5555555555554444.
Example
PaymentCardNumber("4242424242424242")PaymentCardNumber(raw) checks the text, and text that isn't one breaks the format rule.
text.parse(raw, as: PaymentCardNumber) reads one from text that comes from outside. Text that isn't one at all fails malformed, such as 4242424242424241, 4242 4242 4242 4242 or 42424242424.
Good to know
text.formatshows only the last four digits:•••• 4242.- Write it with no spaces. Remove any a person types before you build one.
==tells you whether two are the same.<andlist.sort_bydon't take it.- A field that holds one counts as personal data (
financial), so you don't mark it yourself.
In JSON
A string, in a request, a response or json.write:
"4242424242424242""378282246310005""5555555555554444"
Details
Text form, storage, how it is shown, and operations
PaymentCardNumber is in the group Money and banking, and has been in Jadpo since 0.1.0.
Text form
text.from writes one standard text form, the same form text.parse reads back: 4242424242424242, 378282246310005 and 5555555555554444.
How it is stored
It is stored in one column named for the field, of type text. 378282246310005 is stored as '378282246310005'.
How it is shown to people
text.format(value, locale:) shows it to people in their locale.
With locale: Locale.en_gb:
| Value | Shown |
|---|---|
4242424242424242 |
•••• 4242 |
378282246310005 |
•••• 0005 |
5555555555554444 |
•••• 4444 |
Operations
money.mask(card: PaymentCardNumber) -> MaskedCardNumber: What may be kept ofcardonce its number is gone: its brand, told by its first digits from the ranges each scheme publishes (nonefor a range no listed scheme issues), and its last four digits.
It also takes text.parse, text.from, text.format, json.read, json.write and ==. How every standard type behaves says how they work.
Markdown for agents: /docs/types/type-payment-card-number.md.Built from Jadpo main at aee2e8f.