PotWallet RESTful API Services - Documentation
You can access your account and trade information through our RESTful API. Feel free to use the API to build potcoin services and apps.
Last Updated: 2015-07-02
Auth
API Key + Secret
Access your own account via the API
First, create your keys by visiting our developer gateway. Then, you are all ready to get started using our API.
Example
Request
GET /v1/balance HTTP/1.1
Accept: */*
User-Agent: My Awesome Application
ACCESS_PUBLIC: YOUR-PUBLIC-KEY
ACCESS_HASH: YOUR-COMPUTED-SIGNATURE
ACCESS_NONCE: YOUR-NONCE
Connection: close
Host: potwallet.com
Response
{
"success":"true",
"message":"2000.099"
}
The ACCESS_PUBLIC header is simply your Public API Key. The ACCESS_HASH header is a HMAC-SHA256 hash of the nonce concatentated with the full URL of the HTTP request, encoded using your Private API Key. The nonce is a string generated by you to ensure authenticity.
This scheme is generally known as "HMAC authentication". Here are some examples of code, making simple API calls:
PHP
$publicHash = 'YOUR PUBLIC KEY';
$privateHash = 'YOUR PRIVATE KEY';
$nonce = substr(md5(rand()), 0, 7); // Random string
$endpoint = 'https://api.potwallet.com/v1/balance';
$content = $endpoint.$nonce;
$hash = hash_hmac('sha256', $content, hash('sha1',$privateHash));
$headers = array(
'ACCESS-PUBLIC: '.$publicHash,
'ACCESS-HASH: '.$hash,
'ACCESS-NONCE: '.$nonce,
'Content-Type: application/json'
);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_HTTPHEADER => $headers,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $endpoint,
CURLOPT_USERAGENT => 'My Potcoin Application'
));
$resp = curl_exec($curl);
curl_close($curl);
print_r($resp);
API Endpoint
https://api.potwallet.com/v1/
All API requests should use the application/json
content type, and must be encrypted with SSL (https)
General API Endpoints
Authenticated resource that returns the current price of Potcoin on PotWallet.
HTTP Request
GET https://api.potwallet.com/v1/price
Response
{
"success":"true",
"message":
{
"price": "0.00142",
"currency": "USD"
}
}
This endpoint will take a currency parameter.
Example Request
GET https://api.potwallet.com/v1/price?CAD
Response
{
"success":"true",
"message":
{
"price": "0.00176341",
"currency": "CAD"
}
}
Authenticated resource that returns all support currencies.
HTTP Request
POST https://api.potwallet.com/v1/currencies
Response
{
"success":"true",
"message":
{
"Canada":
{
"name": "Canadian Dollar",
"code": "CAD"
},
"United States":
{
"name": "US Dollar",
"code": "USD"
}
}
}
Authenticated resource that returns current exchange rates for supported currencies.
HTTP Request
POST https://api.potwallet.com/v1/exchange_rates
Response
{
"success":"true",
"message":
{
"CAD":
{
"name": "Canadian Dollar",
"rate": "1.241836"
"pot_price": "0.00176341"
},
"USD":
{
"name": "US Dollar",
"rate": "1"
"pot_price": "0.00142000"
}
}
}
Wallet API Endpoints
Authenticated resource that returns the user’s active balance.
HTTP Request
GET https://api.potwallet.com/v1/balance
Response
{
"success":"true",
"message":"2002.002"
}
Authenticated resource that returns the user’s current Potcoin address.
HTTP Request
GET https://api.potwallet.com/v1/address
Response
{
"success":"true",
"message":"PJDjgjhFmKaWdx6y9cfi8aEvtXzJuSfYih"
}
Authenticated resource that returns the all of the user’s Potcoin addresses.
HTTP Request
GET https://api.potwallet.com/v1/addresses
Response
{
"success":"true",
"message":
[
"PEi4CUaAquMJyQ7X3J9P2C13X6dUgghs1N",
"PLLiy6Z7pWGPWpiMVHJ8iDx942TnzcfxM7",
"PJDjgjhFmKaWdx6y9cfi8aEvtXzJuSfYih"
]
}
Authenticated resource that returns a newly generated Potcoin address on the user’s account.
HTTP Request
GET https://api.potwallet.com/v1/address/new
Response
{
"success":"true",
"message":"PJDjgjhFmKaWdx6y9cfi8aEvtXzJuSfYih"
}
Authenticated resource that returns the user’s transactions on PotWallet.
HTTP Request
GET https://api.potwallet.com/v1/transactions
Response
{
"success":"true",
"message":
[
{
"date":"2015-06-03 10:23:53",
"amount":5000,
"category":"receive",
"address":"PEi4CUaAquMJyQ7X3J9P2C13X6dUgghs1N",
"blockhash":"a2fec8569b68a5c274d1a288ec257b30fcbecf3566f9b93032cc35b8c87b27eb",
"txid":"408b5949e53eed536bff3c1fb3d00ba165bc7f9d839fc4c2f0f9be4f5ba81cd9",
"label":null
},
{
"date":"2015-06-11 22:38:36",
"amount":1000,
"category":"receive",
"address":"PJDjgjhFmKaWdx6y9cfi8aEvtXzJuSfYih",
"blockhash":"5ab70721376aa7d0da13348157d63b1770cdaa8a508ae6f0d98da4a423ee4eff",
"txid":"e817e2c87c2e03611e4fe19ddd1dad140514d507a120803a77cfb8b3024f09e4",
"label":null
}
]
}
Authenticated resource that returns the user’s transactions sent from PotWallet.
HTTP Request
GET https://api.potwallet.com/v1/transactions/send
Response
{
"success":"true",
"message":
[
{
"date":"2015-06-03 10:23:53",
"amount":5000,
"category":"send",
"address":"PEi4CUaAquMJyQ7X3J9P2C13X6dUgghs1N",
"blockhash":"a2fec8569b68a5c274d1a288ec257b30fcbecf3566f9b93032cc35b8c87b27eb",
"txid":"408b5949e53eed536bff3c1fb3d00ba165bc7f9d839fc4c2f0f9be4f5ba81cd9",
"label":null
},
{
"date":"2015-06-11 22:38:36",
"amount":1000,
"category":"send",
"address":"PJDjgjhFmKaWdx6y9cfi8aEvtXzJuSfYih",
"blockhash":"5ab70721376aa7d0da13348157d63b1770cdaa8a508ae6f0d98da4a423ee4eff",
"txid":"e817e2c87c2e03611e4fe19ddd1dad140514d507a120803a77cfb8b3024f09e4",
"label":null
}
]
}
Authenticated resource that returns the user’s transactions received by PotWallet.
HTTP Request
GET https://api.potwallet.com/v1/transactions/receive
Response
{
"success":"true",
"message":
[
{
"date":"2015-06-03 10:23:53",
"amount":5000,
"category":"receive",
"address":"PEi4CUaAquMJyQ7X3J9P2C13X6dUgghs1N",
"blockhash":"a2fec8569b68a5c274d1a288ec257b30fcbecf3566f9b93032cc35b8c87b27eb",
"txid":"408b5949e53eed536bff3c1fb3d00ba165bc7f9d839fc4c2f0f9be4f5ba81cd9",
"label":null
},
{
"date":"2015-06-11 22:38:36",
"amount":1000,
"category":"receive",
"address":"PJDjgjhFmKaWdx6y9cfi8aEvtXzJuSfYih",
"blockhash":"5ab70721376aa7d0da13348157d63b1770cdaa8a508ae6f0d98da4a423ee4eff",
"txid":"e817e2c87c2e03611e4fe19ddd1dad140514d507a120803a77cfb8b3024f09e4",
"label":null
}
]
}
Authenticated resource that sends Potcoin from a user's account to a specified Potcoin address.
HTTP Request
POST https://api.potwallet.com/v1/send
Required Post Fields:
Address (string) - Valid Potcoin Address
Amount (float) - Positive number
Response
{
"success":"true",
"message":"5acd1b6cb760466a510f5d5a76bee3552b692083251e4a3733b677b476464720"
}
Trade API Endpoints
Authenticated resource that returns the user’s advertisements.
HTTP Request
GET https://api.potwallet.com/v1/advertisements
Response
{
"success":"true",
"message":
[
{
"id":294,
"type":"Buy",
"city":"",
"region":"",
"country":"United States",
"curreny":"USD",
"payment_method":"Chase Quickpay",
"bank_name":"",
"margin":2,
"minimum":1,
"maximum":100,
"information":"Enter additional information about your trade and terms.
\r\nExample:
\r\nContact hours: 10:00 AM - 5:00 PM EST.",
"status":"Hidden",
"fallback_price":0,
"auto_response":"",
"created_at":
{
"date":"2014-11-19 15:57:53.000000",
"timezone_type":3,
"timezone":"UTC"
}
}
]
}
Authenticated resource that returns the user’s trades.
HTTP Request
GET https://api.potwallet.com/v1/trades
Response
{
"success":"true",
"message":
[
{
"id":543,
"advertisement":295,
"type":"Sell",
"payment_method":"Western Union",
"seller":"crypto",
"buyer":"nojle",
"fiat":1,
"potcoin":458.2951,
"currency":"USD",
"fee":4.582952,
"status":"Canceled",
"canceled_by":"nojle",
"reference_id":"8B35D2EA4A0D",
"date_paid":null,
"created_at":
{
"date":"2014-11-19 16:15:10.000000",
"timezone_type":3,"
timezone":"UTC"
}
},
{
"id":545,
"advertisement":296,
"type":"Sell",
"payment_method":"Interac e-transfer",
"seller":"nojle",
"buyer":"davide",
"fiat":100,
"potcoin":32894.74,
"currency":"CAD",
"fee":328.9474,
"status":"Canceled",
"canceled_by":"nojle",
"reference_id":"8B71ECB747D4",
"date_paid":null,
"created_at":
{
"date":"2014-11-19 17:02:00.000000",
"timezone_type":3,
"timezone":"UTC"
}
}
]
}
Authenticated resource that returns the user’s buy trades only.
HTTP Request
GET https://api.potwallet.com/v1/trades/buy
Response
{
"success":"true",
"message":
[
{
"id":543,
"advertisement":295,
"type":"Buy",
"payment_method":"Western Union",
"seller":"crypto",
"buyer":"nojle",
"fiat":1,
"potcoin":458.2951,
"currency":"USD",
"fee":4.582952,
"status":"Canceled",
"canceled_by":"nojle",
"reference_id":"8B35D2EA4A0D",
"date_paid":null,
"created_at":
{
"date":"2014-11-19 16:15:10.000000",
"timezone_type":3,"
timezone":"UTC"
}
},
{
"id":545,
"advertisement":296,
"type":"Buy",
"payment_method":"Interac e-transfer",
"seller":"nojle",
"buyer":"davide",
"fiat":100,
"potcoin":32894.74,
"currency":"CAD",
"fee":328.9474,
"status":"Canceled",
"canceled_by":"nojle",
"reference_id":"8B71ECB747D4",
"date_paid":null,
"created_at":
{
"date":"2014-11-19 17:02:00.000000",
"timezone_type":3,
"timezone":"UTC"
}
}
]
}
Authenticated resource that returns the user’s sell trades only.
HTTP Request
GET https://api.potwallet.com/v1/trades/sell
Response
{
"success":"true",
"message":
[
{
"id":543,
"advertisement":295,
"type":"Sell",
"payment_method":"Western Union",
"seller":"crypto",
"buyer":"nojle",
"fiat":1,
"potcoin":458.2951,
"currency":"USD",
"fee":4.582952,
"status":"Canceled",
"canceled_by":"nojle",
"reference_id":"8B35D2EA4A0D",
"date_paid":null,
"created_at":
{
"date":"2014-11-19 16:15:10.000000",
"timezone_type":3,"
timezone":"UTC"
}
},
{
"id":545,
"advertisement":296,
"type":"Sell",
"payment_method":"Interac e-transfer",
"seller":"nojle",
"buyer":"davide",
"fiat":100,
"potcoin":32894.74,
"currency":"CAD",
"fee":328.9474,
"status":"Canceled",
"canceled_by":"nojle",
"reference_id":"8B71ECB747D4",
"date_paid":null,
"created_at":
{
"date":"2014-11-19 17:02:00.000000",
"timezone_type":3,
"timezone":"UTC"
}
}
]
}
Merchant API Endpoints
Authenticated resource that returns a unique payment address with a specified callback URL for merchant notification.
HTTP Request
GET https://api.potwallet.com/v1/merchant/receive
Response
{
"success":"true",
"message":"PJDjgjhFmKaWdx6y9cfi8aEvtXzJuSfYih"
}
Example Request (PHP)
$callback = 'http://www.myawesomestore.com/notify.php?secret=4321';
$note = 'Invoice #1234 Part #32331';
$parameters = 'method=create¬e='.urlencode($note).'&callback='.urlencode($callback);
$endpoint = 'https://api.potwallet.com/v1/merchant/receive?'.$parameters;
// You still need to authenticate -- SEE the Authentication section
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_HTTPHEADER => $headers,
CURLOPT_URL => $endpoint,
CURLOPT_USERAGENT => 'My awesome store'
));
$resp = curl_exec($curl);
curl_close($curl);
Example Callback Response (PHP)
- success - Either true or false
- amount - The amount received by the address
- address - The unique address receiving the payment
- txid - The network transaction ID for the incoming payment
- confirmations - The number of confirmations for the transaction
$secret = '1234';
$identifier = $_GET['secret'];
$amount = $_GET['amount'];
$address = $_GET['address'];
$txid = $_GET['txid'];
$confirmations - $_GET['confirmations'];
if($confirmations > 3 && $secret === $identifier)
{
// Check database for $txid and process payment as needed.
echo '*ok*'; // Required to stop notifications.
}
else
{
// Wait or invalidate the payment.
}