Hosted Tokenization Form
The Tokenization Form securely captures the customer's credit or debit card information and converts sensitive data into a token. The token can then be used to process transactions without storing card information directly on the merchant's systems.
The Tokenization Form securely captures customer card details and generates a token for safe payment processing. By using this form, non-PCI compliant merchants can accept payments without directly handling sensitive credit card data, reducing risk and simplifying compliance requirements.
If you're searching for documentation on older version of the Tokenization Form, please contact your Technical Account Manager.
Tokenization Workflow
The following diagram illustrates the complete tokenization flow using the hosted form:
- Customer clicks the payment button.
- Merchant's website invokes the tokenization form from Bamboo.
- Bamboo returns the hosted form to the browser.
- The form is rendered on the page.
- Customer enters card data.
- Card data is securely sent to Bamboo.
- Bamboo generates the token.
- Token is returned to the merchant’s browser.
- The merchant creates the purchase using the token.
- Bamboo processes the payment and sends confirmation.
- Customer receives confirmation.
Integrating the Hosted Tokenization Form
To integrate the Tokenization Form into your checkout flow, simply embed it in your web or mobile application. Once implemented, the form will handle all sensitive card data securely and return a token that you can use for payments through the Bamboo API.
Importing the JavaScript Library
To integrate the Tokenization Form into your website, it's necessary to include a script that points to the form's URL. This allows access to the BambooForm object containing the methods needed to render Bamboo forms.
Staging_
//STAGE - Test Environment:
<script src="https://capture.stage.bamboopayment.com/"
integrity="sha256-X8C6kzz5r0uxNzqtXB8q2tAkorRayzErzeIUm1f0xm4= sha384-Vt+ySpe3/DHlyv34xym7TY55eJ49WxXv6d2cHasu/GG/7h22MGUESq+3kQeHOaLC sha512-B132Bu3DX6JkgamkFER/g2rcsfdTzrwNWOY5O2Wsfe8lm/H7TD1uGdnEuPvudq4ZRdCQDrWk6PwCVkgP1o2Szg=="
crossorigin="anonymous">
</script>Production
//PRODUCTION:
<script src="https://capture.bamboopayment.com"
integrity="sha256-E4GdhdwL0BVk9Xq/21s9qxvjh+anbzbgDVtfH6iCu7E= sha384-vbOT5y4OCop26UzV2VOfg0IAK+ToPU+mR09IcQChnn5kfD5W7b3YQNWXkJob3WWs sha512-j9jTPXduda6zgSUmoTvy9xEOlJOnYS2fKO0dEMiSK5VSB4bGfmKWfSHFLe7pjsFj3lu0K426c9F+7lXf/810Kg=="
crossorigin="anonymous">
</script>Render the Hosted Form
Once the Script pointing to Bamboo forms is imported, you'll have access to the renderTokenizationForm method that renders the Tokenization Form in your application, allowing your users to securely enter their cards.
BambooForm.renderTokenizationForm(configuration);
Request Example
<script>
BambooForm.renderTokenizationForm({
containerId: 'MERCHANT_PAGE_CONTAINER_ID',
metadata: {
publicKey: 'MERCHANT_PUBLIC_KEY',
targetCountryISO: 'UY',
customer: {
email: '[email protected]',
cardHolderName: 'Juan Pérez'
},
locale: 'es',
logoUrl: '<https://mieshop.com/logo.png>'
},
hooks: {
onOperationSuccess: (token) => {
console.log('Token received:', token);
},
onOperationError: (error) => {
console.error('Error:', error);
}
}
});
</script>Customize the Form
| Parameter | Type | Mandatory? | Description |
|---|---|---|---|
containerId | string | No | HTML container ID where the form will be displayed. If sent, the form is embedded in that container. If omitted, the form opens as a full-screen modal with a close button. |
metadata | object | Yes | Configures information related to the customer and transaction. |
styles | object | No | Colors of the form. See Customize the look | styles object below. |
hooks | object | Yes | Callback functions to handle form events. |
Customize your Tokenization Form | metadata object
You can customize the tokenization form with your logo and preferred language, besides pre-fill data already provided by your customer, or restrict the tokenization to specific cards.
| Parameter | Type | Mandatory? | Description |
|---|---|---|---|
metadata → publicKey | string | Yes | Merchant's public key, necessary for secure tokenization. |
metadata → amount | number | No | Transaction amount. When sent, the form shows the amount formatted in the currency defined in currencyIsoCode. |
metadata → currencyIsoCode | string | No | Transaction currency. When amount is sent, the form shows the amount formatted in this currency. |
metadata → targetCountryISO | string | Yes | ISO code of the country where the transaction will be processed. |
metadata → customer | object | Yes | Customer information. Must always be sent, even as an empty object. Its fields (uniqueId, email, cardHolderName) are optional. |
metadata → locale | string | No | Form language, using ISO code Spanish: 'es' (default) English: 'en' |
metadata → logoUrl | string | No | URL of the logo that will appear on the form. If not defined, it's shown without a logo in the header |
metadata → filters | object | No | Allows restricting the card entered by the user to a specific issuing bank or card type |
Customer Information
| Parameter | Type | Mandatory? | Description |
|---|---|---|---|
metadata → customer → uniqueId | string | No | Unique customer identifier. Indicates if a single-use or recurring Token is generated Token Types. Customer's SessionId. |
metadata → customer → email | string | No | Customer's email. It's pre-loaded in the form and allows editing if there are syntax errors that prevent token generation |
metadata → customer → cardHolderName | string | No | Cardholder's name. It's pre-loaded in the form without editing option. |
Tokenization restricted to specific Cards
| Parameter | Type | Mandatory? | Description |
|---|---|---|---|
metadata → filters → paymentMediaType | number | No | Identifier of the payment method type (credit card, debit card, etc.). (See payment media ids) |
metadata → filters → brand | number | No | Issuing brandId identifier. (See brands) |
Example
metadata: {
filters: {
paymentMediaType: 1, // only credit cards
brand: 1
}
}Customize the look | styles object
You can change the colors of the form with the optional styles object. It is sent at the top level of the configuration, next to containerId, metadata and hooks. The same object, with the same properties and default values, is available in the Tokenization Form and in the CVV Form.
All properties are optional strings.
| Property | Description | Default |
|---|---|---|
backgroundColor | Background color of the form window | #FFFFFF |
buttonColor | Background color of the action button | #26282B |
buttonHoverColor | Background color of the action button on hover | #454649 |
buttonTextColor | Text color of the action button | #FFFFFF |
buttonTextHoverColor | Text color of the action button on hover | #FFFFFF |
inputBackgroundColor | Background color of the text fields | #FFFFFF |
inputTextColor | Text color of the text fields | #26282B |
inputErrorColor | Border color of a text field with an error | #DC3545 |
inputAddonBackgroundColor | Background color of the text fields' icons | #EEEEEE |
labelColor | Text color of labels and the title | #26282B |
- Colors are hexadecimal RGB values, with or without the leading
#. - Only these colors can be changed. Fonts, sizes, borders, texts and custom CSS are not supported.
Example
BambooForm.renderTokenizationForm({
containerId: 'MERCHANT_PAGE_CONTAINER_ID',
metadata: {
publicKey: 'MERCHANT_PUBLIC_KEY',
targetCountryISO: 'UY'
},
styles: {
backgroundColor: '#FFFFFF',
buttonColor: '#0057FF',
buttonHoverColor: '#0046CC',
buttonTextColor: '#FFFFFF',
labelColor: '#26282B'
},
hooks: {
onOperationSuccess: (token) => { console.log('Token received:', token); }
}
});Handle customer interactions | hooks object
| Parameter | Type | Mandatory? | Description |
|---|---|---|---|
hooks → onOperationSuccess | function | Yes | Callback executed upon successful tokenization. Receives the token as a parameter. |
hooks → onOperationFinalize | function | No | Optional callback executed when the operation is finalized. |
hooks → onOperationError | function | No | Optional callback that handles errors during tokenization. |
hooks → onApplicationLoaded | function | No | Callback executed when the form has been loaded correctly. |
hooks → onExitForm | function | No | Callback executed when the form is closed. Receives the close reason as a string. When the customer closes the modal, the reason is onUserRequestExitModal. |

Successful tokenization | Token object
The token object is returned in the onOperationSuccess hook executed upon successful tokenization and contains the following parameters.
| Property | Type | Description |
|---|---|---|
TokenId | string | Token identifier. |
Created | timestamp | Token creation date and time. |
Brand | string | Card brand or payment method used. |
IssuerBank | string | Card Issuing Bank. |
Owner | string | Cardholder's name. |
Bin | numeric[6-9] | Card identifier. |
Last4 | numeric[4] | Last four digits of the card. |
CardType | string | Payment method or card type, possible values: CreditCard, DebitCard, PrePaid |
CardExpMonth | numeric[2] | Card expiration month. |
CardExpYear | numeric[2] | Card expiration year. |
Response Example
{
"TokenId": "OT__Vzt3fxGvyyTgbUbsPrMN__em6gAAHYAAA",
"CardType": "CreditCard",
"Created": "2025-10-21T14:35:54.971",
"Brand": "VISA",
"Owner": "John Doe",
"Last4": "0001",
"Bin": "424242",
"CardExpMonth": 12,
"CardExpYear": 29,
"IssuerBank": "Itaú"
}Unsuccessful tokenization | Error object
When tokenization cannot be completed, the onOperationError hook is triggered.
This callback receives an error object with information about the failure. You can either:
- render the value returned in Message directly to the customer, optionally including Error.ErrorCode, or
- interpret the error response and display a custom message based on the merchant’s own UX rules.
This allows you to decide whether to show Bamboo's returned message or replace it with a friendlier message adapted to your checkout experience.
Error object structure
| Property | Type | Description |
|---|---|---|
| Error.ErrorCode | string | Bamboo error identifier. |
| Error.Message | string | Main error message. Recommended field to render to the customer. |
Response Example
{
"raw": {
"ErrorCode": "TK014",
"Message": "The payment method is disabled"
}
}Merchant rendering recommendations
The recommended approach is to display the value of Error.Message in the UI to inform the customer about the error.
Example implementation
onOperationError: (errorResponse) => {
const message = errorResponse?.Error?.Message || 'Tokenization failed';
const errorContainer = document.getElementById('error-message');
if (errorContainer) {
errorContainer.innerText = message;
errorContainer.style.display = 'block';
}
console.error('Tokenization error:', errorResponse);
}Example HTML container
<div id="error-message" style="display:none; color:red; margin-top:10px;"></div>Best practice
It is recommended to display a user-friendly message and allow the customer to retry the tokenization process.
CVV Form
The CVV Form is specifically designed to capture the Card Verification Value (CVV) found on the back of the physical card. This form is used when it's necessary to validate a transaction with the CVV, generally in recurring payments or purchases where the card information has already been previously tokenized.
Typical use: When a customer has previously stored their credit card through the tokenization process but is asked to enter their CVV to validate or complete a transaction, providing an additional layer of security.
Method renderCVVForm
Once you've imported the script that points to the Bamboo forms, you'll have access to the renderCVVForm method, which renders a form dedicated exclusively to capturing the customer's CVV.
BambooForm.renderCVVForm(url, configurationCVV);
Configuration Parameters
| Parameter | Type | Mandatory? | Description |
|---|---|---|---|
url | string | Yes | The URL containing the session data and the customer's payment profile information. Includes key, session_id, paymentProfileId, brand, and the last four digits of the card. This URL is received as a response when attempting to execute a purchase if CVV verification is required. |
containerId | string | No | ID of the HTML container where the form will be displayed. If sent, the form is embedded in that container. If omitted, the form opens as a full-screen modal with a close button. |
metadata | object | Yes | Configures information related to the session and the transaction. |
metadata → logoUrl | string | No | URL of the logo that will appear on the form. |
metadata → locale | string | No | Language of the form, using an ISO locale code. Spanish: 'es' (default), English: 'en'. |
styles | object | No | Colors of the form. Same object, properties and default values as in the Tokenization Form. |
hooks | object | Yes | Callback functions to handle form events. |
hooks → onOperationSuccess | function | Yes | Callback executed upon successful CVV validation. Receives a confirmation string as a parameter (for example OperationSuccess: true), not a token. |
hooks → onOperationFinalize | function | No | Optional callback executed when the operation is finalized. |
hooks → onOperationError | function | No | Optional callback that handles errors during CVV validation. |
hooks → onApplicationLoaded | function | No | Callback executed when the form has been loaded correctly. |
hooks → onExitForm | function | No | Callback executed when the form is closed. Receives the close reason as a string. When the customer closes the modal, the reason is onUserRequestExitModal. |
To change the colors of the CVV Form, send the styles object described in Customize the look | styles object. It accepts the same properties and uses the same default values as in the Tokenization Form.
Usage Example
<script>
BambooForm.renderCVVForm(
'<https://api.stage.bamboopayment.com/v1/Capture/?key=FEdJ84hzdIKBY0gyC7-NDG_I56ONV7HQ&session_id=CA_51864eaf-1603-4fe8-8720-ae8c569ea702&paymentProfileId=375108&brand=MasterCard&lastFour=4008>',
{
metadata: {
locale: 'es',
logoUrl: '<http://www.example.com/>'
},
hooks: {
onOperationSuccess: () => {
console.log('Operation successful');
},
onOperationError: (error) => {
console.error('Error in CVV validation:', error);
}
}
}
);
</script>Payment Media Types
| Payment Media Type Id | Name |
|---|---|
1 | CreditCard |
2 | DebitCard |
4 | PrePaid |
Brands
| Brand Id | Name |
|---|---|
1 | VISA |
2 | Mastercard |
3 | OCA |
4 | Diners |
5 | American Express |
6 | Discover |
9 | Creditel |
10 | Creditos Directos |
11 | PassCard |
12 | Líder |
13 | Club del Este |
14 | Cabal |
103 | Anda |
Next Steps
After you obtain the token, you can pass it into Bamboo’s Purchase API instead of handling card details directly. This allows you to authorize, capture, or cancel transactions.
Updated 35 minutes ago

