Partner Integration v2.0
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.
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.
https://connect.devcraftor.in/api
https://connect.devcraftor.in/api.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.
Your API Token is essential for authenticating your requests to the payment gateway endpoints. Follow these steps to find your token:
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.
npm install @devcraftor/sdkimport DevCraftorSDK from '@devcraftor/sdk';
const sdk = new DevCraftorSDK();
const payment = sdk.initPayment({ key: 'YOUR_API_TOKEN_HERE' });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);
}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);
}Initiates a transaction and generates a payment link.
POST /v2/partner/payment_links{
"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"
}{
"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"
}
}Retrieves the status of a specific transaction.
GET /v2/partner/order/status
{
"token": "c8a6ed-83697e-434e18-7k33e0-6d5251",
"orderId": "POSTMANTEST008"
}
{
"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 a new user under your partner account
POST /v2/partner/user/register
{
"name": "New User Name",
"email": "newuser@example.com",
"mobile": "1234567890"
}
{
"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."
}
}
Invalid API Key or Secret
API Key inactive or expired
{
"success": false,
"message": "This mobile number is already registered with this partner Example parner name Ltd."
}
{
"message": "An unexpected server error occurred.",
}
Generate one-time authentication URL for direct game access
POST /v2/partner/auth/generate-url
mine, aviator, balloon,goal,keno,hotline
{
"mboile": "user_mobile"
}
{
"success": true,
"message": "Authentication URL generated successfully.",
"authUrl": "https://play.DevCraftor.in/auth/token/generated_one_time_token",
"redirectTo": "/v3/game/mine"
}
{
"success": false,
"message": "Missing X-Game-Type header or invalid game type"
}
{
"success": false,
"message": "Invalid user credentials or API credentials"
}
{
"success": false,
"message": "Partner not permitted for this game or user does not belong to this partner"
}
Retrieve current wallet balance for a user
GET /v2/partner/balance/{mobile}
{
"success": true,
"data": {
"mobile": "1234567890",
"balance": 150.75
}
}
{
"success": false,
"message": "Invalid API Key or Secret"
}
{
"success": false,
"message": "User does not belong to this partner"
}
{
"success": false,
"message": "User with specified mobile number not found"
}
Credit funds to a user's wallet with transaction tracking
POST /v2/partner/wallet/deposit
Important: The transaction_id must be unique from your system to prevent duplicate deposits. Once used, it cannot be reused.
{
"mobile": "1234567890",
"amount": 100.50,
"transaction_id": "PARTNER_UNIQUE_DEPOSIT_ID_123"
}
{
"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"
}
}
{
"success": false,
"message": "Invalid API Key or Secret"
}
{
"success": false,
"message": "User does not belong to this partner"
}
{
"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"]
}
}
{
"success": false,
"message": "Database transaction failed. Please try again."
}
Debit funds from a user's wallet with transaction tracking
POST /v2/partner/wallet/withdraw
Important: Withdrawal will fail if the user has insufficient balance. The transaction_id must be unique to prevent duplicate withdrawals.
{
"mobile": "1234567890",
"amount": 50.00,
"transaction_id": "PARTNER_UNIQUE_WITHDRAW_ID_456"
}
{
"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"
}
}
{
"success": false,
"message": "Insufficient funds for withdrawal",
"data": {
"current_balance": 25.50,
"requested_amount": 50.00
}
}
{
"success": false,
"message": "Invalid API Key or Secret"
}
{
"success": false,
"message": "User does not belong to this partner"
}
{
"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"]
}
}
{
"success": false,
"message": "Database transaction failed. Please try again."
}