NYYU Logo
APIWithdraw

Send Withdraw Confirmation Code

Request SMS 2FA verification code for admin withdrawal approval operations

Send Withdraw Confirmation Code

Request SMS 2FA verification code for secure admin withdrawal approvals

ADMIN Only

Overview

The sendWithdrawConfirmCode mutation enables administrators to request a 2FA SMS verification code required for approving or denying withdrawal requests. This adds an extra layer of security to the withdrawal approval process.

Admin-Only Operation

This mutation is accessible only to users with ADMIN privileges. The phone number is registered as a system property and does not need to be provided.

GraphQL Schema

📱
Mutation Schema
Request admin 2FA SMS code
sendWithdrawConfirmCode: Int

Parameters

📋No Parameters Required

This mutation does not require any input parameters. The admin's phone number is registered as a system property and is automatically used to send the SMS verification code.

Return Value

Integer Response
Success indicator
Return Type: Int

Returns an integer indicating whether the SMS verification code request was successful. A non-zero value typically indicates success.

Example Mutation

💻Request 2FA SMS Code
mutation {
  sendWithdrawConfirmCode
}
Expected Response
{
  "data": {
    "sendWithdrawConfirmCode": 1
  }
}

Use Cases

Approve Withdrawals

Request 2FA code before approving crypto or PayPal withdrawal requests

Deny Withdrawals

Secure denial operations with 2FA verification to prevent unauthorized actions

🏦
Bank Transfers

Verify identity before confirming manual bank transfer completion

🔐
Security Compliance

Ensure all withdrawal approvals meet 2FA security requirements

Implementation Example

Full Implementation Flow
// Admin withdrawal approval workflow
async function processWithdrawalApproval(withdrawalId: number) {
  try {
    // Step 1: Request 2FA SMS code
    const codeRequest = await client.request(gql`
      mutation {
        sendWithdrawConfirmCode
      }
    `);

    if (!codeRequest.sendWithdrawConfirmCode) {
      throw new Error('Failed to send verification code');
    }

    console.log('✅ SMS verification code sent to admin phone');

    // Step 2: Admin receives SMS and enters code
    const twoFactorCode = await promptForCode(); // UI prompt

    // Step 3: Approve withdrawal with 2FA code
    const approval = await client.request(gql`
      mutation ApproveWithdrawal($id: Int!, $code: String!) {
        confirmCryptoWithdraw(
          id: $id,
          status: 1,
          code: $code
        )
      }
    `, {
      id: withdrawalId,
      code: twoFactorCode
    });

    console.log('✅ Withdrawal approved successfully');

  } catch (error) {
    console.error('❌ Withdrawal approval failed:', error);
  }
}

Security Features

🔒Security Measures
📱
SMS 2FA Required

All withdrawal approval operations require valid 2FA SMS verification codes

🔑
Pre-Registered Phone

Admin phone number is pre-registered as system property, preventing unauthorized changes

⏱️
Time-Limited Codes

Verification codes expire after a short period for enhanced security

👨‍💼
Admin-Only Access

Only users with ADMIN role can request withdrawal confirmation codes

Best Practices

Request Code Just Before Approval

Request the 2FA code immediately before performing the approval/denial operation to minimize code expiration risk

Verify Phone Number Registration

Ensure admin phone number is correctly registered in system properties before using this mutation

Handle SMS Delivery Delays

Implement UI feedback to indicate code is being sent and may take a few moments to arrive

Log All Code Requests

Maintain audit logs of all 2FA code requests for security monitoring and compliance

🔐
Critical Security Operation
Always request fresh 2FA codes for each withdrawal approval to maintain highest security standards