En | Ru

Api People Pay

					# Example of sending a request

# Request parameters
$params= [
  "cmd"=> "get_balance"
  "currencies"=> ["BTC", "ETH"],
  "key"=> public_key,
];

# Need to generate url encoded query string
$request= http_build_query($req); // currencies%5B0%5D=BTC¤cies%5B1%5D=ETH&cmd=get_balance&key=public_key

# Hexadecimal signature
$hmac= hash_hmac('sha512', $request, $secret_key); // f866485cf6ffd25b8c615bb198669af695bad46d5106b4287b8e559f88c7380d937cfff124dfbec73eb5fa2aae519c3030d065f7a719cbf8576bcb9f3f1ae324

curl -X POST --header "HMAC: $hmac" --data-binary $request "https://peoplepay.org/api"
					
				

To use People Pay API, API keys are required

Permanent API keys can be assigned to a range of IP addresses and can be canceled at any time without affecting your master data. In addition, our keys do not need to be updated.

To use API key authentication, you need create a store

Working use case in PHP Download
$api= new PeoplePayApi('api_key', 'api_secret');

You can also write your own Api implementation if for reason ours is not suitable for you
In order to use Api, you need to authenticate the request, for this you need to send the HMAC signature. This is necessary so that no one can fake your requests and funds are safe.

Errors

					
# Result example:
{
  "status":false,
  "code":401,
  "msg":"key_or_secret_invalid"
}
					
				

The submitted data was not authenticated

					
# Result example:
{
  "status": false,
  "code": 400,
  "msg": "Wallet not found"
}
					
				

Receiving data on non-existent currency

					
# Error:
{
  "status": false,
  "code": 402,
  "msg": "Request failed!"
}
					
				

The request was not completed successfully

Getting the balance for the store

					
# Receiving data for all currencies
$params= [
  "cmd"=> "get_balance"
  "currencies"=> null,
  "key"=> public_key
];

# Api PHP function
get_balance($currencies = null)
# Usage example
$api->get_balance(['BTC', 'ETH'])

# Result example:
{
  "status": true,
  "code": 200,
  "data": {
    "BTC": "0.01090325",
    "ETH": "0.00000000",
    "XRP": "0.00000000",
    "PAX": "0.07600000",
    "BCH": "0.00000000",
    "OMG": "0.00000000",
    "USDT": "2.00000000",
    "TUSD": "3.00000000",
    "LTC": "0.00000000",
    "BNB": "0.00000000",
    "LINK": "0.00000000",
    "TURAN": "0.00000000",
    "LRC": "0.00000000",
    "KNC": "0.00000000",
    "MANA": "0.00000000",
    "BAT": "0.00000000",
    "WBTC": "0.00000000",
    "DAI": "0.00000000",
    "MKR": "0.00000000"
  },
  "hash": "23bcd05c48bf00498eea55b2fc8a741064709a38587ae5cfaff572c18ca26824678f9bd3d264c9367f3beb6af66eb04639eaa85250dd1917aa56ca3d52c6d850"
}

# Getting data for a specific currency
$params= [
  "cmd"=> "get_balance"
  "currencies"=> "BTC",
  "key"=> public_key,
];

# Result example:
{
  "status": true,
  "code": 200,
  "data": {
    "BTC": "0.01090325"
  },
  "hash": "558b0d52348d54adcc4bf9641711345e86f797ebd0991f4cdbc020d25c5c13e7ccb9fdfcaae94497137c7bb6673dd39928636f3aae64d60fd85c54b0170de9ae"
}

# Receiving data for several currencies
$params= [
  "cmd"=> "get_balance"
  "currencies"=> ["BTC", "ETH"],
  "key"=> public_key,
];

# Result example:
{
  "status": true,
  "code": 200,
  "data": {
    "BTC": "0.01090325",
    "ETH": "9.94242132"
  },
  "hash": "f008250654a36df7fcf0047aa84ba43898889a23d01a75ec78fd23d24c5b58fe624934e04a34aad"
}
					
				

Request parameters

Field Type Description
currencies Array, String (optional) If you do not pass this parameter, all currencies will be requested.
cmd String Command to be executed
key String Your public_key

Validation address

					# Validation address
$params= [
  "cmd"=> "validate_address"
  "address"=> "1GhbFHimmVWRxubz15V9sUKAT7bygXHjHP",
  "currency"=> "btc",
  "key"=> public_key,
];

# Api PHP function
validate_address($address, $currency)
# Usage example
$api->validate_address('1GhbFHimmVWRxubz15V9sUKAT7bygXHjHP', 'btc')

# Result example:
{
  "status": true,
  "code": 200,
  "data": {
    "isvalid": true
  },
  "hash": "2964b7d66fb5938c52b90ac04582702607f344563291f4e5b34b087b45e319f8642d989c6cdce4aef202c6781f6c80f71d3982ba57bc8091c02c1822497f65ac"
}

# Result invalid address
{
  "status": true,
  "code": 200,
  "data": {
    "isvalid": false
  },
  "hash": "77f1f771ae308f178f27f6e8e4170c0ccc8f0762c20563d31e5d9b72f6b640c4b88cd75533f84fd6d360c559f543cda0f5c88d348434cbc1015eb85d8535983e"
}
					
				

Request parameters

Field Type Description
address String Address for validation
currencies String Any available currency that matches the address
cmd String Command to be executed
key String Your public_key

Withdraw funds

Creating a new transaction for withdrawal

					# Withdraw funds
$params= [
  "cmd"=> "create_withdrawal"
  "address"=> "0x17054b057663820a9ddb00ee20b742c45c4a9fa5",
  "label"=> "label",
  "amount"=> "1",
  "currency"=> "usdt",
  "fee"=> 1,
  "key"=> public_key,
];

# Api PHP function
create_withdrawal($address, $amount, $currency, $fee= 1, $label= null)
# Usage example
$api->create_withdrawal('0x17054b057663820a9ddb00ee20b742c45c4a9fa5', 1, 'usdt', 'label')

# Result example:
{
  "status": true,
  "code": 200,
  "data": {
    "info": {
      "ID": "irizuqetkCGU0GaLR94cZUnQG",
      "txid": "In line for sending ...",
      "amount": "1.00000000",
      "label": "label",
    }
  },
  "hash": "72ebf0a5ad3d64729b4283b78c65ddbe44a5b32253f34c616aa56ffc0ea48e2cbfffd6b1d84c30fb0fe517c4ff57e5b57baf94294e4e0d83e9e50ef15a2639dc"
}

# Result error address
{
  "status": false,
  "code": 400,
  "msg": "no valid address"
}

# Result error balance
{
  "status": false,
  "code": 400,
  "msg": "insufficient funds"
}
# Error Api output disabled
{
  "status": false,
  "code": 400,
  "msg": "Output disabled in API settings"
}
					
				

Request parameters

Field Type Description
address String Address to which funds will be sent
amount Numeric Amount to send
currency String Any available currency
fee Numeric Priority, the higher the value, the higher the commission for sending
label String (optional) label for a transaction
cmd String Command to be executed
key String Your public_key

Obtaining information on withdrawal

Checking Submission Status

					
$params= [
  "cmd"=> "withdrawal_info"
  "id"=> "irizuqetkCGU0GaLR94cZUnQG",
];

# Api PHP function
withdrawal_info($id)
# Usage example
$api->withdrawal_info('irizuqetkCGU0GaLR94cZUnQG')

# Result example:
{
  "status": true,
  "code": 200,
  "data": {
    "info": {
      "ID": "irizuqetkCGU0GaLR94cZUnQG",
      "time_created": 1605447820,
      "address": "0x17054b057663820a9ddb00ee20b742c45c4a9fa5",
      "txid": "In line for sending ...",
      "hex": null,
      "status": "pending",
      "commission": "0.50000000",
      "status_code": 1,
      "label": null,
    }
  },
  "hash": "6b5e7a7f7a9b08edf9639760b403d40c56f5567c6d21062e4c4eaf047c87edb840bd13056637ae1552352e57174b5bfb0677b993d2bf24792414723c41777f57"
}

# Result error id
{
  "status": false,
  "code": 400,
  "msg": "Transaction not found"
}
					
				

Request parameters

Field Type Description
id String ID received from create_withdrawal response
cmd String Command to be executed
key String Your public_key

Creation of a merchant

					

$params= [
  "cmd"=> "create_invoice"
  "amount"=> "1",
  "currency"=> "usdt",
  "key"=> public_key,
  "label"=> label,
];

# Api PHP function
create_invoice($amount, $currency, $label= null)
# Пример использования
$api->create_invoice(1, 'usdt', 'label')

# Result example:
{
  "status": true,
  "code": 200,
  "data": {
    "currency": "btc",
    "address": "1DjscrFJJ5JppwxHW1XARZVfcEVGVSAHwv",
    "id": "Lq3qH5mOrAsC4oNJwLo1cFmaJ",
    "label": "label",
    "url": "https://peoplepay.org/invoice/merchant/W8e0AM2t4kVDNvfZpuIrgWTZr/4hEyHPQDcO6wBy37M0YMukRBnWkY0M",
  },
  "hash": "f6dcf9d538128d44a689f18f1ecb68b9739a90aaf473202a22dfdc4314ad51f0072b96e5e440322b68584322eb9a6c2912bdba2ea997a06dea4b60d8079d4238"
}

# Result error amount
{
  "status": false,
  "code": 400,
  "msg": "The amount must be a number."
}
					
				

A merchant will be created for the specified amount, and you will be given an address that will await replenishment
The address is tied to the store for a day!

Request parameters

Field Type Description
amount String The amount for which the top-up is created
currency String Any available currency
label String (optional) label for a address
cmd String Command to be executed
key String Your public_key

Create an address

					
$params= [
  "cmd"=> "new_address"
  "currency"=> "btc",
  "key"=> public_key,
  "label"=> 'label',
];

# Api PHP function
new_address($currency, $label= null)
# Пример использования
$api->new_address('btc', 'label')

# Result example:
{
  "status": true,
  "code": 200,
  "data": {
    "currency": "btc",
    "address": "14nrVNMM1eofHZpH9uTF5VxQTFie5LdeYn",
    "id": "1CPBHaxXjoQiAQkYKqwV2uypC",
    "label": "label",
  },
  "hash": "a6b680e1c98dc46fe93387c1b1a98207b75edae892febc08ace1f15dbefe764e9b4fa3aed02d2cd4419429be5dd856d4acf9a7e91012e000e37830773478ed7b"
}
					
				

An address will be issued to await the replenishment
The address is tied to the store for a day!

Api PHP function new_address($currency)

Usage example
$api->new_address('btc')

Request parameters

Field Type Description
currency String Any available currency
label String (optional) label for a address
cmd String Command to be executed
key String Your public_key

Receipt transactions for address

					
$params= [
  "cmd"=> "get_reception_info"
  "api_id"=> "9SnSmoep65MLNOEUohXaXABuC",
  "currency"=> "ltc",
  "key"=> public_key,
];

# Result example:
{
  "status": true,
  "code": 200,
  "data": {
    "id": "9SnSmoep65MLNOEUohXaXABuC",
    "info": [
      {
        "category": "received",
        "received": "26.97300000",
        "commission": "0.00000000",
        "amount": "26.97300000",
        "txid": "bf6c7150417fb93015c5d33f2fe096de63ce36e5c9f53b91a56ecc5e7da68f4d",
        "hash": "bf6c7150417fb93015c5d33f2fe096de63ce36e5c9f53b91a56ecc5e7da68f4d",
        "confirm": 63139,
        "label": null,
      }
    ],
    "address": "MQFWtFAwbDV6hZAyWvtJMtpB7idouvQfhd"
  },
  "hash": "ca45bf91866ac240510eb05376be00dbf1099bb6635b2011060a4cd65a7905a6a28787af71ce452cf8c74d360b444d32ee298092f5c9aa9525678a8212fb7e06"
}

# Result not have reception:
{
  "status": true,
  "code": 200,
  "data": {
    "id": "Lq3qH5mOrAsC4oNJwLo1cFmaJ",
    "info": null,
    "address": "1DjscrFJJ5JppwxHW1XARZVfcEVGVSAHwv"
  },
  "hash": "23508a199fe4b392b451902ea16a38c583798857f792bb0fea6a4b33e6ea900b2cc77055980bd4b818d3230d8bb2bae986800bc49f7c634cd7be0bb62af950ca"
}
# Result error api_id:
{
  "status": false,
  "code": 400,
  "data": {
    "id": "1CPBHaxXjoQiA1CPBHaxXjoQiAQkYKqwV2uypCQkYKqwV2uypC",
    "info": null,
  },
  "msg": "Your wallet is missing this address"
}
					
				

Returns all incoming transactions at the given address

Api PHP function get_reception_info($api_id, $currency)

Usage example
$api->get_reception_info('9SnSmoep65MLNOEUohXaXABuC', 'ltc')

Request parameters

Field Type Description
api_id String id from new_address response | create_invoice
currency String Any available currency
cmd String Command to be executed
key String Your public_key

Receipt transactions for label

					
$params= [
  "cmd"=> "get_label_transactions"
  "label"=> "label",
  "currency"=> "ltc",
  "key"=> public_key,
];

# Result example:
{
  "status": true,
  "code": 200,
  "data": {
    "label": "label",
    "info": [
      {
        "category": "received",
        "received": "26.97300000",
        "commission": "0.00000000",
        "amount": "26.97300000",
        "txid": "bf6c7150417fb93015c5d33f2fe096de63ce36e5c9f53b91a56ecc5e7da68f4d",
        "hash": "bf6c7150417fb93015c5d33f2fe096de63ce36e5c9f53b91a56ecc5e7da68f4d",
        "confirm": 63139,
        "label": 'label',
      }
    ],
  },
  "hash": "ca45bf91866ac240510eb05376be00dbf1099bb6635b2011060a4cd65a7905a6a28787af71ce452cf8c74d360b444d32ee298092f5c9aa9525678a8212fb7e06"
}

# Result not have transactions:
{
  "status": true,
  "code": 200,
  "data": {
    "label": "label"
    "info": null,
  },
  "hash": "23508a199fe4b392b451902ea16a38c583798857f792bb0fea6a4b33e6ea900b2cc77055980bd4b818d3230d8bb2bae986800bc49f7c634cd7be0bb62af950ca"
}
					
				

Returns all incoming transactions at the given address

Api PHP function get_label_transactions($label, $currency)

Usage example
$api->get_label_transactions('label', 'ltc')

Request parameters

Field Type Description
label String Transaction label
currency String Any available currency
cmd String Command to be executed
key String Your public_key

WebHook

					# Header check example
$post_data = http_build_query($response, '', '&');
$hmac = hash_hmac('sha512',$post_data , $app->api_secret);

if(SERVER['HTTP_HMAC']== $hmac) Connection is secure
					
				
					
# Result example:
{
  "data": {
    "store": "MindPlays",
    "transactions": {
      "id": "1460",
      "status": "2",
      "address": "0xc88f7666330b4b511358b7742dc2a3234710e7b1",
      "txid": "0x724d905ea77fffc5998dd55d460bcc1839c3a9ae8aa18e15df00cddbc4b9e1b5",
      "opp_type": "2",
      "wallet_id": "2",
      "amount": "0.19948751",
      "course_usd": "504",
      "fee": "0",
      "full_name": "Ether",
      "currency": "eth",
      "label": null,
      "confirmations": "1",
      "created_at": "2020-04-29 20:14:05"
    }
  },
  "key": "public_key"
}
					
				

WebHook will arrive at the specified path in the Store after the transaction is successfully received / sent!

For safer usage it is recommended to check the header HTTP_HMAC

Description of the received data

Field Description
store name of shop
Transactions
id transaction id
status
  • 0 - in line for sending
  • 1 - broadcast
  • 2 - success
  • 3 - cancel
  • 4 -
opp_type
  • 1 - request
  • 2 - send
address
  • (request) - the address to which the funds were received
  • (send) - the address to which the funds were SENT
txid hash transactions
wallet_id currency identifier
amount amount received / sent
course_usd course usd at the time of the transaction
fee commission
label if specified label
confirmations number of confirmations
created_at date of creation
key store public_key