Our API Docs just got a new look!

All-in-one

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

SDK Constructor

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

new SDK(publicKey, options)

Parameters

Parameter
Type
Description
Required
Possible values

publicKey

string

Your unique public key provided by D24.

true

options

object[]

An object containing configuration options.

true

options.environment

string

Specifies the operating environment.

true

stg, prod

options.locale

string

Sets the language for the UI components.

true

en, es, pt

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.

<CreditCardForm /> Component

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

Properties

Property
Type
Description
Required

authToken

string

The unique checkout_token returned by your call to the Deposit Creation Endpoint.

true

country

string

The two-letter ISO 3166-1 alpha-2 country code.

true

onSuccess

function

Callback function executed when the payment is successful.

true

onError

function

Callback function executed when an error occurs during the payment.

true

onBack

function

Callback function executed when the user clicks the "Go Back" button.

true

onTokenGenerationError

function

Callback function executed when an internal error occurs while generating the payment token.

true

messages

object[]

An object for defining custom text on the payment completion screens.

false

messages Object Structure

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

Property
Type
Description

messages.paymentComplete.success.title

string

The title displayed on the success screen.

messages.paymentComplete.success.description

string

The description text displayed on the success screen.

messages.paymentComplete.error.title

string

The title displayed on the error screen.

messages.paymentComplete.error.description

string

The description text displayed on the error screen.

Callbacks

onTokenGenerationError

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

function handleTokenErrorCallback(error: string) {
	console.log(error);
}

onBack

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

function handleGoBackCallback() {
	console.log('Go back');
}

Last updated

Was this helpful?