> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pandablue.com/llms.txt
> Use this file to discover all available pages before exploring further.

# All-in-one

This document provides a detailed technical reference for all components, methods, and properties available in the Credit Card SDK.

> [!NOTE]
>
> The SDK is published as `@d24/sdk` / `@d24/sdk-minimal` and exposes `window.D24`. This is expected: use it as shown with your Pandablue credentials.

## SDK Constructor

The SDK is instantiated using a constructor that takes a public key and an options object.

```javascript theme={null}
new SDK(publicKey, options)
```

### Parameters

<table><thead><tr><th>Parameter</th><th>Type</th><th>Description</th><th>Required</th><th>Possible values</th></tr></thead><tbody><tr><td>`publicKey`</td><td>`string`</td><td>Your unique public key provided by Pandablue.</td><td>**true**</td><td>\
</td></tr><tr><td>`options`</td><td>`object[]`</td><td>An object containing configuration options.</td><td>**true**</td><td>\
</td></tr><tr><td>`options.environment`</td><td>`string`</td><td>Specifies the operating environment.</td><td>**true**</td><td>`stg`, `prod`</td></tr><tr><td>`options.locale`</td><td>`string`</td><td>Sets the language for the UI components.</td><td>**true**</td><td>`en`, `es`, `pt`</td></tr></tbody></table>

#### Instantiation Errors

Attempting to instantiate or use the SDK incorrectly will result in one of the following errors:

| Error | Explanation |
| - | - |
| SDK was already instantiated. | You are trying to call `new SDK(...)` more than once. |
| The environment \[config.environment] is not supported. | The value for `options.environment` is not `'stg'` or `'prod'`. |
| You must instantiate D24CreditCardSDK before using SDK methods | You attempted to use a component or method like `CreditCardForm` before the SDK was successfully instantiated. |

## &#x20;`<CreditCardForm />` Component

This is the primary UI component for collecting and processing credit card information.

### Properties

<table><thead><tr><th>Property</th><th>Type</th><th>Description</th><th>Required</th></tr></thead><tbody><tr><td>`authToken`</td><td>`string`</td><td>The unique `checkout_token` returned by your call to the Deposit Creation Endpoint.</td><td>**true**</td></tr><tr><td>`country`</td><td>`string`</td><td>The two-letter ISO 3166-1 alpha-2 country code.</td><td>**true**</td></tr><tr><td>`onSuccess`</td><td>`function`</td><td>Callback function executed when the payment is successful.</td><td>**true**</td></tr><tr><td>`onError`</td><td>`function`</td><td>Callback function executed when an error occurs during the payment.</td><td>**true**</td></tr><tr><td>`onBack`</td><td>`function`</td><td>Callback function executed when the user clicks the "Go Back" button.</td><td>**true**</td></tr><tr><td>`onTokenGenerationError`</td><td>`function`</td><td>Callback function executed when an internal error occurs while generating the payment token.</td><td>**true**</td></tr><tr><td>`messages`</td><td>`object[]`</td><td>An object for defining custom text on the payment completion screens.</td><td>**false**</td></tr></tbody></table>

#### `messages` Object Structure

You can override the default text for the success and error screens by providing a `messages` object.

<table><thead><tr><th>Property</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>`messages.paymentComplete.success.title`</td><td>`string`</td><td>The title displayed on the success screen.</td></tr><tr><td>`messages.paymentComplete.success.description`</td><td>`string`</td><td>The description text displayed on the success screen.</td></tr><tr><td>`messages.paymentComplete.error.title`</td><td>`string`</td><td>The title displayed on the error screen.</td></tr><tr><td>`messages.paymentComplete.error.description`</td><td>`string`</td><td>The description text displayed on the error screen.</td></tr></tbody></table>

### Callbacks

**`onTokenGenerationError`**

This callback function will be executed when an error occurs generating token.

```javascript theme={null}
function handleTokenErrorCallback(error: string) {
	console.log(error);
}
```

**`onBack`**

This callback function will be executed when the user clicks on the Go Back button.

```javascript theme={null}
function handleGoBackCallback() {
	console.log('Go back');
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.