Reference
Props
fetchSessionToken
fetchSessionToken A function that is used to fetch session token that is generated from the API that is used to wrap the ratio /v1/clients/session (documentation here)
This is an async function.
The Ratio API uses client authentication which requires a client_id and client_secret. It is highly recommended to implement this call in a secure API backend. This will prevent the need of shipping the clientSecret with the client application.
const fetchSessionToken = async () => {
try {
let sessionTokenResponse = await fetch(
'https://your.api.com/clients/session',
{
method: 'POST',
body: JSON.stringify({
signingAddress: walletAddress,
depositAddress: walletAddress,
signingNetwork: walletNetwork,
}),
}
);
let data = await sessionTokenResponse.json();
return data.id;
} catch (e) {
console.error(e);
}
return null;
};
<RatioComponent
fetchSessionToken={async () => {
return await fetchSessionToken();
}}/>function
Yes
signingCallback
signingCallback Function that accepts a string which contains the challenge that is returned from the Ratio /v1/auth/cryptoWallet:start call (documentation here)
This is an async function that should return a promise. This will allow such asynchronous activities such as a biometrics check to happen during signing.
The return value from this function is of type RatioKitSigningResult. See the Models section below.
Example using Web3.js library
function
Yes
presetOrder
presetOrderSince v0.10.0
A property that takes a RatioPresetOrder object.
This is used to allow the order flow to have predetermined values rather than having the enter the Cryptocurrency, or Fiat Amount in the flow manually.
If you do not want to provide this value either omit it or pass in null.
See RatioPresetOrderfor more details
Make sure to provide a valid combination for currency and network valid combinations are as follows
Ethereum
ETH
Ethereum
USDC_ETHEREUM
Polygon
MATIC
Polygon
USDC_POLYGON
Polygon
AMKT_POLYGON
object or null
No
Example
onPress
onPressA function that is called when the child view is pressed. This function is called before the SDK starts the authentication flow. Suggested uses include setting an ActivityIndicator or loading spinner to be visible.
Example
function
No
onOpen
onOpenA function that is called once the SDK has completed its authentication flow and before the modal is displayed. Suggested uses include setting an ActivityIndicator or loading spinner to be hidden
Example
function
No
onTransactionComplete
onTransactionCompleteA function that is called whenever a transaction is completed even if there was a failure.
As part of the data in the RatioOrderStatus object, you will receive the userId for the user that completed the transaction and the ActivityItem detailing the transaction. The userId and activityItem will not be returned if there was an error in processing the order.
Example
function
No
onHelp
onHelpA function that is called whenever a help button is pressed from within the RatioComponent Modal WebView. This callback allows for custom handling for when the user needs help.
If not provided, the default behaviour is to open the default email client and draft an email to [email protected]
Example
function
No
onAccountRecovery
onAccountRecoveryA function that is called whenever the account recovery button is pressed from within the RatioComponent Modal WebView. This callback allows for custom handling for when the user needs help recovering their account.
If not provided, the default behaviour is to open the default email client and draft an email to [email protected]
Example
function
No
onError
onErrorA function that is called whenever an error occurs within the Ratio component's authorization flow.
If not provided, the default behaviour is to show an Alert dialog with an error message
Example
function
No
onClose
onCloseA function that is called after the Ratio Modal WebView. There is no default behaviour if not provided. As of writing this documentation this function will be called when the user presses "Return to wallet" in the application. It will then close the React Native modal and then call "onClose"
function
No
onLogin
onLoginA function that is called when the a user is fully authenticated. It is also called when the user's account has been created. The callback returns a RatioUser object that is described below.
Example
redirectUri
redirectUriiOS Only
A nullable string that points to a universal link. This is used for Plaid OAuth Authentication. For example http://ratio.me/plaid/oauth
This route should be set up as a Universal link as described above
NOTE: You must provide this URI to the Ratio team so that we can add it to our configuration
If your application is running on Android, pass in null as described in the code example
androidPackageName
androidPackageNameAndroid Only
A nullable string that contains your Android package name. This is used for Plaid OAuth Authentication. NOTE: You must provide this package to the Ratio team so that we can add it to our configuration
If your application is running on iOS, pass in null as described in the code example
Models
RatioKitSigningResult
RatioKitSigningResultRatioOrderStatus
RatioOrderStatusRatioPresetOrder
RatioPresetOrderCryptoCurrencySymbol
CryptoCurrencySymbolOrderError
OrderErrorActivityItem
ActivityItemActivityItemFiat
ActivityItemFiatActivityItemStatus
ActivityItemStatusFiatCurrency
FiatCurrencyDirection
DirectionFundingMethod
FundingMethodBankAccount
BankAccountLinkStatus
LinkStatusVerificationStatus
VerificationStatusActivityItemCrypto
ActivityItemCryptoWallet
WalletRatioUser
RatioUserTwoFactorMethod
BankAccount
BankAccountLinkStatus
LinkStatusVerificationStatus
VerificationStatusKyc
KycKycResult
KycResultLast updated
Was this helpful?