Important: You can add only one set of Hosted Fields to a webpage.
<div class="card-container payroc-form"><label for="card-holder-name">Cardholder Name</label><div class="card-holder-name"></div><div class="card-holder-name-error error-message"></div><label for="card-number">Card Number</label><div class="card-number"></div><div class="card-number-error error-message"></div><div class="cols-2"><div class="col"><label for="card-expiry">Expires (MM/YY)</label><div class="card-expiry"></div><div class="card-expiry-error error-message"></div></div><div class="card-cvv-wrapper"><div class="col"><label for="card-cvv">CVV</label><div class="card-cvv"></div><div class="card-cvv-error error-message"></div></div></div></div><div class="card-submit submit-button"></div></div>
col
and col-2
custom CSS attributes to create the structure for the example form.payment
- You want to run a sale or to run a sale and tokenize the payment details within the same transaction.tokenization
- You want to save the customer's payment details to run a sale later, or you want to update payment details that the customer previously saved.Parameter | Value |
---|---|
src | https://cdn.uat.payroc.com/js/hosted-fields/hosted-fields-1.2.0-beta.135020.js |
integrity | sha384-Ni4VysNB8m8E1MfkB9IRrXOUFNdSvpwJC3LeyuYCgP3uV1CVrLOSHyemXjUczSSU |
cardForm.on("submissionSuccess", ({ token, expiresAt }) => {});
Field | Description |
---|---|
token | Single-use token that represents the customer's payment details. |
expiresAt | Expiry date and time of the single-use token. |
{"token": "c96cb928e39c34bd05022cd821d2cbba2349f047ce0cef4f77cd2b5762be7608fb7c23e673bf014d58c64672928eb8256e38aa26911a22853143d22dd48ac9aa","expiresAt": "2024-05-18T23:17:34.844Z"}
cardForm.on("error", ({ type, field, message }) => {});