Skip to main content

3DS React Native SDK Methods

Create Session

This method collects information for the device from a WebView on the background and sends it to the Basis Theory API, which then returns a newly created 3DS section.

Usage

import { BasisTheory3dsProvider, useBasisTheory3ds } from "@basis-theory/3ds-react-native";

const App = () => {
return (
<BasisTheory3dsProvider apiKey={"<API_KEY>"}>
<MyApp />
</BasisTheory3dsProvider>
);
}

const MyApp = () => {
const { createSession, startChallenge } = useBasisTheory3ds();

//... rest of your component

const session = await createSession({ tokenId: "<TOKEN_ID>" });
}

Parameters

The createSession method takes an object as parameter w/ the following attributes:

AttributeRequiredTypeDescription
tokenIdfalsestringThe Basis Theory token id for the card token to be used
tokenIntentIdfalsestringThe Basis Theory token id for the card token intent to be used
panfalsestring
DEPRECATED
The Basis Theory token id for the card token to be used

Either tokenId or tokenIntentId is required.

Return

The method returns an object with the following attributes:

AttributeTypeDescription
idstringThe created session id
cardBrandstringThe brand for the used card (i.e. Visa)

Start Challenge

This method initiates the 3DS challenge process, if it was deemed necessary during the 3DS authentication. The challenge window will be displayed to the user in a WebView.

Usage

import { BasisTheory3dsProvider, useBasisTheory3ds } from "@basis-theory/3ds-react-native";

const App = () => {
return (
<BasisTheory3dsProvider apiKey={"<API_KEY>"}>
<MyApp />
</BasisTheory3dsProvider>
);
}

const MyApp = () => {
const { createSession, startChallenge } = useBasisTheory3ds();

//... rest of your component

const challengeCompletion = await startChallenge({
acsChallengeUrl: "https://some-challenge-url.com",
acsTransactionId: "5236966c-62be-417b-8f66-dbec6d87911d",
sessionId: "9289231e-2c0b-4f38-92fa-dec3c586d58b",
threeDSVersion: "2.2.0",
});
}

Parameters

The startChallenge method takes in an object with the following attributes:

AttributeRequiredTypeDescription
acsChallengeUrltruestringThe URL for the challenge window. Available from the Authenticate endpoint response
acsTransactionIdtruestringThe ACS transaction id. Available from the Authenticate endpoint response
sessionIdtruestringThe created 3DS session id
threeDSVersiontruestringThe 3DS message version. Available from the Authenticate endpoint response
windowSizefalsestringThe code for the pre-configured window size. See Challenge Window Sizes
timeoutfalsenumberThe time in miliseconds to wait for challenge completion before considering it timed out. Defaults to 60000ms (1 minute)

Return

The method returns a boolean, with it being true if the challenge was able to completed, or false if an error or timeout occurred.

Challenge Window Sizes

WindowSize IDSize
01250px x 400px
02390px x 400px
03500px x 600px
04600px x 400px
05100% x 100%