DevCraftor API

Partner Integration v2.0

API Overview

Welcome to the DevCraftor Partner API documentation. This document provides a comprehensive guide to integrating with our platform, including user management, wallet operations, and our seamless Payment Gateway.

Partner API Authentication

All Partner API v2 endpoints require authentication using custom HTTP headers. You must include both X-API-Key and X-API-Secret headers in every request.

Important: Your API Secret is shown only once during partner creation. Store it securely as it cannot be retrieved later.

Base URL & Headers

Partner API Base URL

https://connect.devcraftor.in/api

Required Headers (Partner API)

Content-Typeapplication/json
X-API-KeyYour Partner API Key
X-API-SecretYour Partner API Secret

📜 API Changelog

Version 2.0 - July 2025

🚀 ADDED

  • All Partner API endpoints are now versioned under the `/v2` path.
  • This changelog section to keep you informed of updates.

🔄 CHANGED

  • The root URL for all Partner API endpoints has been updated to https://connect.devcraftor.in/api.
  • All endpoint paths now follow the new structure: `/v2/partner/...`.

❌ REMOVED

  • All `/v1` endpoints are now deprecated and will be discontinued. Please migrate to the new `/v2` endpoints as soon as possible.

Payment Gateway Integration

Our Payment Gateway API allows you to programmatically create and verify transactions. To get started, you need to obtain your unique API Token from your partner console.

Obtaining Your API Token

Your API Token is essential for authenticating your requests to the payment gateway endpoints. Follow these steps to find your token:

  1. Log in to your Partner Console.
  2. Navigate to the Payment Gateway section from the sidebar.
  3. Complete the application process if you haven't already.
  4. Once your gateway is active, your unique API Key (Token) will be displayed in the "API Credentials" card.
  5. Copy this token and include it in the payload of your API requests as the `token` field.

Using the Node.js SDK

To simplify your integration, we provide an official Node.js SDK that handles authentication and API requests. We highly recommend using the SDK for a faster and more reliable integration.

Installation

npm install @devcraftor/sdk

Initialization

import DevCraftorSDK from '@devcraftor/sdk';

const sdk = new DevCraftorSDK();
const payment = sdk.initPayment({ key: 'YOUR_API_TOKEN_HERE' });

SDK Usage Examples

Creating a Payment

try {
    const paymentResult = await payment.createPayment({
        orderId: 'YOUR_UNIQUE_ORDER_ID_123',
        txnAmount: 100.00,
        txnNote: 'Purchase of premium subscription',
        cust_Mobile: '9876543210',
        cust_Email: 'customer@example.com'
    });
    console.log('Payment URL:', paymentResult.paymentUrl);
} catch (error) {
    console.error('Payment creation failed:', error.response?.data || error.message);
}

Checking Payment Status

try {
    const status = await payment.checkPaymentStatus('YOUR_UNIQUE_ORDER_ID_123');
    console.log('Payment Status:', status.txnStatus);
} catch (error) {
    console.error('Status check failed:', error.response?.data || error.message);
}

Create Payment

POST

Initiates a transaction and generates a payment link.

Endpoint

POST /v2/partner/payment_links

Required Headers

X-API-Key Your Partner API Key
X-API-Secret Your Partner API Secret
Content-Type application/json

Request Body

{
    "token": "c8a6ed-83697e-434e18-7k33e0-6d5251",
    "orderId": "YOUR_UNIQUE_ORDER_ID",
    "txnAmount": "1.00",
    "txnNote": "Testing from Postman",
    "cust_Mobile": "9876543210",
    "cust_Email": "test@example.com"
}
200

Success Response

{
    "success": true,
    "message": "Payment link generated successfully.",
    "data": {
        "paymentUrl": "https://api.devcraftor.in/order/CreateOrder.php?txn_id=hDCToTQy4y1751512983",
        "orderId": "POSTMANTEST0ffbb1554",
        "txn_ref_id": "hDCToTQy4y1751512983"
    }
}

Check Payment Status

GET

Retrieves the status of a specific transaction.

Endpoint

GET /v2/partner/order/status

Required Headers

X-API-Key Your Partner API Key
X-API-Secret Your Partner API Secret
Content-Type application/json

Request Body

{
    "token": "c8a6ed-83697e-434e18-7k33e0-6d5251",
    "orderId": "POSTMANTEST008"
}
200

Success Response

{
    "success": true,
    "message": "Transaction status fetched successfully.",
    "data": {
        "orderId": "POSTMANTEST008",
        "txnStatus": "SUCCESS",
        "txnAmount": "1.00",
        "utr": "418381111111",
        "paymentMode": "UPI",
        "timestamp": "2024-07-03 10:30:00"
    }
}

Register User

POST

Register a new user under your partner account

Endpoint

POST /v2/partner/user/register

Required Headers

X-API-Key Your Partner API Key
X-API-Secret Your Partner API Secret
Content-Type application/json

Request Body

{
    "name": "New User Name",
    "email": "newuser@example.com",
    "mobile": "1234567890"
}
201

Success Response

{
    "success": true,
    "message": "User registered successfully!",
    "data": {
        "id": 101,
        "name": "New User Name",
        "email": "newuser@example.com",
        "mobile": "1234567890",
        "registered_by_partner": "Example Partner Ltd."
    }
}
401

Unauthorized

Invalid API Key or Secret
403

Forbidden

API Key inactive or expired
409

Conflict

{
    "success": false,
    "message": "This mobile number is already registered with this partner Example parner name Ltd."
}
500

Server Error

{
    "message": "An unexpected server error occurred.",
}

Generate Game Auth URL

POST

Generate one-time authentication URL for direct game access

Endpoint

POST /v2/partner/auth/generate-url

Required Headers

X-API-Key Your Partner API Key
X-API-Secret Your Partner API Secret
X-Game-Type Game identifier: mine, aviator, balloon,goal,keno,hotline
Content-Type application/json

Request Body

{
  "mboile": "user_mobile"
}
200

Success Response

{
    "success": true,
    "message": "Authentication URL generated successfully.",
    "authUrl": "https://play.DevCraftor.in/auth/token/generated_one_time_token",
    "redirectTo": "/v3/game/mine"
}
400

Bad Request

{
 "success": false,
 "message": "Missing X-Game-Type header or invalid game type"
 }
                                        
401

Unauthorized

{
    "success": false,
    "message": "Invalid user credentials or API credentials"
}
403

Forbidden

{
    "success": false,
    "message": "Partner not permitted for this game or user does not belong to this partner"
}

Get User Balance

GET

Retrieve current wallet balance for a user

Endpoint

GET /v2/partner/balance/{mobile}

Required Headers

X-API-Key Your Partner API Key
X-API-Secret Your Partner API Secret

URL Parameters

{mobile} The mobile number of the user (e.g., 1234567890)
200

Success Response

{
    "success": true,
    "data": {
        "mobile": "1234567890",
        "balance": 150.75
    }
}
401

Unauthorized

{
    "success": false,
    "message": "Invalid API Key or Secret"
}
403

Forbidden

{
    "success": false,
    "message": "User does not belong to this partner"
}
404

Not Found

{
    "success": false,
    "message": "User with specified mobile number not found"
}

Deposit to User Wallet

POST

Credit funds to a user's wallet with transaction tracking

Endpoint

POST /v2/partner/wallet/deposit

Required Headers

X-API-Key Your Partner API Key
X-API-Secret Your Partner API Secret
Content-Type application/json

Important: The transaction_id must be unique from your system to prevent duplicate deposits. Once used, it cannot be reused.

Request Body

{
    "mobile": "1234567890",
    "amount": 100.50,
    "transaction_id": "PARTNER_UNIQUE_DEPOSIT_ID_123"
}
200

Success Response

{
    "success": true,
    "message": "Deposit successful.",
    "data": {
        "mobile": "1234567890",
        "new_balance": 251.25,
        "transaction_id": "PARTNER_UNIQUE_DEPOSIT_ID_123",
        "deposited_amount": 100.50,
        "timestamp": "2024-01-15T10:30:00.000000Z"
    }
}
401

Unauthorized

{
    "success": false,
    "message": "Invalid API Key or Secret"
}
403

Forbidden

{
    "success": false,
    "message": "User does not belong to this partner"
}
422

Validation Error

{
    "message": "The given data was invalid.",
    "errors": {
        "amount": ["Amount must be greater than 0"],
        "transaction_id": ["Transaction ID already exists"],
        "mobile": ["Mobile number is required"]
    }
}
500

Server Error

{
    "success": false,
    "message": "Database transaction failed. Please try again."
}

Withdraw from User Wallet

POST

Debit funds from a user's wallet with transaction tracking

Endpoint

POST /v2/partner/wallet/withdraw

Required Headers

X-API-Key Your Partner API Key
X-API-Secret Your Partner API Secret
Content-Type application/json

Important: Withdrawal will fail if the user has insufficient balance. The transaction_id must be unique to prevent duplicate withdrawals.

Request Body

{
    "mobile": "1234567890",
    "amount": 50.00,
    "transaction_id": "PARTNER_UNIQUE_WITHDRAW_ID_456"
}
200

Success Response

{
    "success": true,
    "message": "Withdrawal successful.",
    "data": {
        "mobile": "1234567890",
        "new_balance": 201.25,
        "transaction_id": "PARTNER_UNIQUE_WITHDRAW_ID_456",
        "withdrawn_amount": 50.00,
        "timestamp": "2024-01-15T10:30:00.000000Z"
    }
}
400

Insufficient Funds

{
    "success": false,
    "message": "Insufficient funds for withdrawal",
    "data": {
        "current_balance": 25.50,
        "requested_amount": 50.00
    }
}
401

Unauthorized

{
    "success": false,
    "message": "Invalid API Key or Secret"
}
403

Forbidden

{
    "success": false,
    "message": "User does not belong to this partner"
}
422

Validation Error

{
    "message": "The given data was invalid.",
    "errors": {
        "amount": ["Amount must be greater than 0"],
        "transaction_id": ["Transaction ID already exists"],
        "mobile": ["Mobile number is required"]
    }
}
500

Server Error

{
    "success": false,
    "message": "Database transaction failed. Please try again."
}