🖥

For Developers

Fina Card API (BETA)

Fina Card has public API endpoints so you can integrate Fina Card in your dApp or Wallet UI, or use our API to analyse your spendings://api

Generating Signature

For each API method, you need to include a ADR-36 signature. The message required in each API method is different. Here is an Javascript example of using Keplr to generate the signature.
if (window.keplr) {
await window.keplr.enable("secret-4");
const account = await window.keplr.getKey("secret-4");
const signed = await window.keplr.signArbitrary(
"secret-4",
account.bech32Address,
"Fina Card: Sign In"
);
// Parameters required to make a request
const signature = signed.signature
const address = account.bech32Address
const pubKey = signed.pub_key.value
const chainId = "secret-4"
}

Encryption Key

As Fina needs to query the details of the Top Up transaction, which is encrypted on Secret Network, we need to know the encryption key used in the transaction so we can decrypt the message. Here is an example code to generate the encryption key.
import { fromBase64, toBase64 } from "secretjs";
const getTxEncryptionKey = async (txHash: string, chainId: string) => {
if (window.keplr) {
const encryptionUtils = window.keplr.getEnigmaUtils(chainId);
const txResult = await fetch(
`${SECRET_LCD_URL}/cosmos/tx/v1beta1/txs/${txHash}`
).then((r) => r.json());
const msg = txResult?.tx?.body?.messages[0].msg
if (!msg) {
return "";
}
const nonce = fromBase64(msg).slice(0, 32)
const encryptionKey = toBase64(
await encryptionUtils.getTxEncryptionKey(nonce)
);
return encryptionKey;
}
return "";
};

API Methods

Get Account

Get user's Fina Card information and transactions
post
https
://api.card.fina.cash/getAccount

Get Sensitive Information

Get user's encrypted sensitive card information like full card number, CVV, 3DS password
post
https
://api.card.fina.cash/getSensitiveInfo

Get Top Up Information

Get top up information like the price, fee, min and max top up amount, etc
post
https
://api.card.fina.cash/getTopupInfo

Change 3D Secure Settings

Change 3D Secure settings like mobile number and password
post
https
://api.card.fina.cash/change3DS

Toggle Block Card

Block or Unblock card transactions
post
https
://api.card.fina.cash/toggleBlockCard

Top Up

Top up card by sending token to the topupAddress returned from /getTopupInfo and call this API with the TX hash to increase card balance.
post
https
://api.card.fina.cash/topup

Create New Card

Create a new card for new user
post
https
://api.card.fina.cash/createCard