// Card entry templates

JS fields

Separate card number, expiry and CVC inputs placed anywhere in your own form, styled to match it.

Preview mode -- nothing you type is stored, verified or charged. Try 4242 4242 4242 4242 (approve), 4000 0000 0000 0002 (decline) or 4000 0000 0000 0069 (card not accepted), with any future expiry and any CVC.

JS fields put three separate Card Vault inputs -- card number, expiry and CVC -- wherever you want them in your own form. Everything else on this page is the shop's own markup: fonts, colours, layout, the contact and shipping fields, the loyalty and gift-note fields and the Pay button. Switch the theme to see the card inputs follow the design.

Theme
Roastery Fictional demo shop

Contact

Shipping

Payment

Card number
Expiry
CVC

Extras (custom fields)

Loading the card fields...

Messages your page sees

    Field messages carry the field name and state, never what was typed. On your own page, keep results out of logs, analytics and session-replay tools.

    Style the card fields

    cv-fields.js has a style option and instance.setStyle(style). The values are an allow-list -- anything else is dropped -- and the card field re-checks every value before applying it:

    HTML + JSJS FIELDS
    <script src="https://cdn.cardvault.com/fields/1.0.0/cv-fields.js"
            integrity="sha384-Gr9ligBK5csUw/LxtPtaKnhJ4VkV0blw9qJDR+OYNSb01KZSQ0sSdt74HymZlQc5"
            crossorigin="anonymous"></script>
    <script>
      var fields = CV.fields.create({
        publicKey:   "<the interface's Public Key>",
        fieldUrl:    "https://cce.cardvault.com/<your-interface>/JSFI",
        collectUrl:  "https://cce.cardvault.com/<your-interface>/JSFIP",
        fieldHeight: "44px",
        style: {
          fontFamily: "Georgia, serif",   fontSize: "15px",
          color: "#3B2A1E", placeholderColor: "#A08C7A", background: "#FFFFFF",
          borderColor: "#D9C7B3", borderRadius: "10px", paddingX: "12px",
          focusColor: "#9A4F1C", focusRingColor: "rgba(154,79,28,0.18)"
        },
        onReady:   function () { /* enable your Pay button */ },
        onSuccess: function (r) { /* send r.Token to YOUR server */ },
        onDecline: function (d) { /* d.code, d.message */ },
        onError:   function (d) { /* d.code, d.message */ }
      });
      fields.mount({ pan: "#card-number", expiry: "#card-expiry", cvv: "#card-cvc" });
    
      // on your Pay button -- your own fields travel in profile:
      fields.submit({ ref: "ORDER-1001", profile: {
        fullName: "Alex Example", email: "alex@example.com",
        street: "12 Wharf Street", city: "Halifax", region: "NS", postal: "B3J 1A1",
        customFields: [{ key: "Loyalty", value: "HLR-0042" }]
      } });
    </script>

    Mounting, callbacks, Card Policy and the security rules for the page are in JS fields.