IDRX Documentation
  • Introduction
    • IDRX Whitepaper
    • Supported Chain and Contract Address
  • IDRX Account
    • Create Account
    • Sign In
    • Forgot Password
    • Account Verification (KYC)
    • Business Account
  • Services
    • Mint IDRX
    • Redeem IDRX
    • Bridge IDRX
    • Get Other Tokens
    • Redeem Other Stablecoin
    • Fees
  • API
    • Getting Started
    • Generating a Signature
    • Onboarding API
      • POST /api/auth/onboarding
      • GET /api/auth/members
      • POST /api/auth/add-bank-account
      • GET /api/auth/get-bank-accounts
      • DELETE /api/auth/delete-bank-account/:bankId
    • Transaction API
      • POST /api/transaction/mint-request
      • POST /api/transaction/redeem-request
      • POST /api/transaction/bridge-request
      • GET /api/transaction/method
      • GET /api/transaction/user-transaction-history
      • GET /api/transaction/rates
      • GET /api/transaction/get-additional-fees
  • Smart Contract
    • Staking
      • Staking Type
      • Staking IDRX
      • Claim Staking Reward
      • Unbond Staked IDRX
      • Claim Unbonded IDRX
      • Claim Principal and Staking Rewards
      • Application Binary Interface
  • Integration
    • Overview
    • Onboarding a new user
    • Managing bank accounts
    • Processing mint requests
      • Getting other tokens
    • Processing redeem requests
      • Redeeming from other tokens
Powered by GitBook
On this page
  1. Integration

Processing mint requests

The typical flow to process mint requests from your user

Using a user account's API key, you can process mint requests for the specified user. To do so, you can use the POST /api/transaction/mint-request endpoint. Here is an example implementation.

Check this page to see the list of chains where IDRX is available

import { createSignature } from "./createSignature";
const axios = require('axios');

const apiKey = "{YOUR API KEY}";
const secret = "{YOUR SECRET}";

async function mintRequest() {
  const path = "https://idrx.co/api/transaction/mint-request";

  const req = {
    "toBeMinted"               : "51500",
    "destinationWalletAddress" : "0x8BD53F7fF88fD895D3686fe6369a07432822d30F",
    "expiryPeriod"             : 3600, // 1 hour
    "networkChainId"           : "137", // Polygon
    "requestType"              : "idrx", // 'idrx' or empty to receive IDRX, 'usdt' to receive USDT
  };
  const bufferReq = Buffer.from(JSON.stringify(req), 'base64').toString('utf8');
  const timestamp = Math.round((new Date()).getTime()).toString();
  const sig = createSignature('POST', path, bufferReq, timestamp, secret);

  const res = await axios.post(path, req, {
    headers: {
      'Content-Type': 'application/json',
      'idrx-api-key': apiKey,
      'idrx-api-sig': sig,
    },
  });

  console.log('res.data: ');
  console.log(res.data);
}

mintRequest();

After a successful request, you will get a response as follows:

{
  statusCode: 200,
  message: 'success',
  data: {
    merchantCode: 'D11808',
    reference: 'D11808T8GVTL81VV2U7HV',
    paymentUrl: 'https://app-prod.duitku.com/redirect_checkout?reference=D11808T8GVTL81VV2U7HV',
    amount: '54500.00',
    statusCode: '00',
    statusMessage: 'SUCCESS',
    merchantOrderId: '20231219101707'
  }
}

Note that the amount returned is the amount after fees. The user can then do the payment through the payment page in the paymentUrl. To check the status of the transaction, you can use the Transaction History API. Here is an example code to do so:

import { createSignature } from "./createSignature";
const axios = require('axios');

const apiKey = "{YOUR API KEY}";
const secret = "{YOUR SECRET}";

async function transactionHistory(txType) {
  const path = "https://idrx.co/api/transaction/user-transaction-history?transactionType="+txType+"&page=1&take=10";

  const bufferReq = Buffer.from('', 'base64').toString('utf8');
  const timestamp = Math.round((new Date()).getTime()).toString();
  const sig = createSignature('GET', path, bufferReq, timestamp, secret);

  const res = await axios.get(path, {
    headers: {
      'Content-Type': 'application/json',
      'idrx-api-key': apiKey,
      'idrx-api-sig': sig,
    },
  });

  console.log('res.data: ');
  console.log(res.data);
}

transactionHistory('MINT');

The response as follows:

{
  statusCode: 200,
  message: 'success',
  metadata: { page: 1, perPage: 10, pageCount: 1, totalCount: 1 },
  records: [
    {
      id: 311,
      paymentAmount: 54500,
      merchantOrderId: '20231219101707',
      productDetails: 'Minting IDRX',
      customerVaName: 'JOHN SMITH',
      email: 'john.smith@gmail.com;IDRX',
      minted: false,
      deleted: false,
      chainId: 137,
      destinationWalletAddress: '0x8BD53F7fF88fD895D3686fe6369a07432822d30F',
      toBeMinted: '51500',
      merchantUserInfo: 411,
      createdAt: '2023-12-19T10:17:07.903Z',
      updatedAt: '2023-12-19T10:17:07.903Z',
      paymentStatus: 'WAITING_FOR_PAYMENT',
      expiryTimestamp: '1703197027900',
      reference: 'D11808T8GVTL81VV2U7HV',
      txHash: null,
      qredoTxId: null,
      signedTx: null,
      adminMintStatus: 'REQUESTED',
      userMintStatus: 'NOT_AVAILABLE',
      isApproved: false,
      reportStatus: 'NONE',
      requestType: '',
      refundStatus: null
    }
  ]
}

After a successful payment, IDRX tokens will be minted to the specified wallet address.

Next, we will explore on processing redeem requests.

PreviousManaging bank accountsNextGetting other tokens

Last updated 27 days ago

Page cover image