Rent Energy on MeFree.NET
TRON Energy BotMeFree.NET
English
English
  • About Mefree.net
  • Getting Started
    • How to Purchase TRON Energy on Mefree.net
      • How to Purchase TRON Energy on Mefree.net Using TronLink Wallet
      • Getting Started with Mefree.NET REST API
      • Java Guide for Calling Mefree.NET API
      • Python Guide for Calling Mefree.NET API
      • Node.js Guide for Calling Mefree.NET API
      • PHP Guide for calling Mefree.NET API
      • Golang Guide for calling Mefree.NET API
    • Mefree.NET API Frequently Asked Questions (FAQ)
    • statement
  • API
    • Account Information
    • Create Order
    • Get Order Detail
    • Get Available Energy
    • Energy Required to Transfer USDT
Powered by GitBook
On this page
  1. API

Create Order

Create resource order

PreviousAccount InformationNextGet Order Detail

Last updated 6 months ago

Core API: Create Order (POST /order)

When creating an order through Mefree.net's API, it is crucial to track the following three return values:

  1. pay_hash (Payment Hash / Order ID):

    • This is a unique identifier for the order.

    • Use it to query the order details via the GET /order/{pay_hash} endpoint.

  2. status (Order Status):

    • Indicates the progress of the order.

    • When the status is DELEGATE_SUCCESS, it means the energy transaction has been successfully submitted to the TRON blockchain.

    • Note: A very small chance (~0.1%) exists where the transaction may not be added to the chain.

  3. confirm_status (On-chain Confirmation Status):

    • Confirms whether the energy has been successfully transferred on-chain.

    • When confirm_status is DELEGATION_CONFIRMED, it guarantees that the energy has been delivered to the target address.


Q: How to ensure that energy is sent to the address?

There are two ways to verify successful energy delivery:

  1. Query the energy balance of the address via the TRON API:

    • Use TRON's official API or a TRON wallet (e.g., TronLink) to check the target address's current energy balance.

    • Endpoint Example (TRON Grid API):

      curl --request POST \
           --url https://api.trongrid.io/wallet/getaccountresource \
           --header 'accept: application/json' \
           --header 'content-type: application/json' \
           --data '
      {
        "address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g",
        "visible": true
      }
      '

      Parse the response to check the energy_limit or energy_used field.

  2. Check the confirm_status of the order:

    • Use the GET /order/{pay_hash} endpoint to retrieve the order details.

    • If confirm_status is DELEGATION_CONFIRMED, the energy transaction has been confirmed on the blockchain, and the target address has received the energy.


Example Workflow

1. Create an Order

Request:

POST /order?quantity=65000&target_address=TRON_ADDRESS&period=1
Host: https://api.mefree.net
Headers: 
  Content-Type: application/json
  MF-ACCESS-KEY: {api_key}
  MF-ACCESS-SIGN: {signature}
  MF-ACCESS-TIMESTAMP: {timestamp}

Response:

{
  "pay_hash": "abcd1234",
  "status": "DELEGATE_SUCCESS",
  "confirm_status": "UNCONFIRMED"
}

2. Query Order Details

Request:

GET /order/abcd1234
Host: https://api.mefree.net
Headers: 
  Content-Type: application/json
  MF-ACCESS-KEY: {api_key}
  MF-ACCESS-SIGN: {signature}
  MF-ACCESS-TIMESTAMP: {timestamp}

Response:

{
  "pay_hash": "abcd1234",
  "status": "DELEGATE_SUCCESS",
  "confirm_status": "DELEGATION_CONFIRMED"
}

3. Verify Energy Delivery

  • If confirm_status = DELEGATION_CONFIRMED, the energy has been delivered.

  • Alternatively, check the energy balance of the receiver address via TRON’s blockchain API.


By combining order tracking (pay_hash and confirm_status) and on-chain verification, you can ensure that energy transactions are reliable and properly executed. If any issues arise, contact Mefree support() for assistance.

@mefreenet

Create order

post
Query parameters
quantityinteger · int32Optional

The energy number of the delegation, minimum 65000.One of quantity and count must have a value

countinteger · int32Optional

Regarding the required to transfer USDT, if the other party has USDT, pass 1, if the other party does not have USDT, pass 2, or a number greater than 2 can be passed.One of quantity and count must have a value.

target_addressstringRequired

The receiving energy address

periodinteger · int32Required

The delegation period, the value may be: 0, 1, 2, 3, 4...30. Among them, 0: fast charge; 1: one hour; 2: 1 day; 3: 3 days; 4: 4 days... up to 30 days

client_order_idstringOptional

Custom order id(length <= 64),For Idempotent verification, Keep uniqueness, passing in the previous client_order_id will not create a new order

Header parameters
MF-ACCESS-KEYstringRequired

Your API Access Key

MF-ACCESS-TIMESTAMPstringRequired

The UTC timestamp of your request .e.g : 2020-12-08T09:08:57.715Z

MF-ACCESS-SIGNstringRequired

The Base64-encoded signature (see Signing Messages subsection for details).

Responses
200
OK
*/*
post
POST /api/order HTTP/1.1
Host: api.mefree.net
MF-ACCESS-KEY: text
MF-ACCESS-TIMESTAMP: text
MF-ACCESS-SIGN: text
Accept: */*
200

OK

{
  "code": 1,
  "msg": "text",
  "sub_code": "text",
  "sub_msg": "text",
  "data": {
    "client_order_id": "text",
    "pay_hash": "text",
    "timestamp": 1,
    "pay_address": "text",
    "delegate_hash": "text",
    "amount_sun": 1,
    "energy_to_address": "text",
    "energy_quantity": 1,
    "energy_period": 1,
    "energy_expired_timestamp": 1,
    "status": "TRANSFER_SUCCESS",
    "confirm_status": "UNCONFIRMED",
    "activate_status": "DEACTIVATE",
    "balance": 1
  }
}