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;
};
<RatioButton
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
text
textAn optional string that allows you to change the text that is displayed on the RatioButton
Default value: "Buy Crypto"
string
No
loadingText
loadingTextAn option string that allows you to change the text that is displayed when the RatioButton is loading during log in
Default value: "Connecting..."
string
No
Models
RatioUser
RatioUserOrderStatus
OrderStatusOrderError
OrderErrorActivityItem
ActivityItemActivityItemFiat
ActivityItemFiatActivityItemStatus
ActivityItemStatusFiatCurrency
FiatCurrencyDirection
DirectionFundingMethod
FundingMethodBankAccount
BankAccountLinkStatus
LinkStatusVerificationStatus
VerificationStatusActivityItemCrypto
ActivityItemCryptoWallet
WalletLast updated
Was this helpful?