Download OpenAPI specification:Download
The Paymium API allows developers to extend the capabilities of the Paymium platform, from reading the latest ticker to automating trades with bots.
It is possible to, among other things:
* Authenticating users is only available to developers that have a fully verified and approved Paymium account. On the other hand, public data is available to everyone.
The official changelog is currently on GitHub. You can be notified of the latest changes by watching our official documentation repository.
The API will only answer with JSON or empty responses. It expects parameters to be passed in JSON with the correct Content-Type: application/json
being set.
The relevant results and error messages will be localized to the language associated to the user, currently English and French are supported.
Datetime values will be returned as regular JSON format and Unix timestamps, the timestamps are suffixed with _int
.
Whenever an error is encountered, the answer to a JSON API call will have:
errors
attribute of the response body {
"errors": [
"Operations account operations amount is greater than your available balance (1781.96 EUR)"
"Amount can't be greater than your limit (1781.96 EUR)"
]
}
authorizationCode
https://paymium.com/api/oauth/authorize
https://paymium.com/api/oauth/token
basic
- Read account number, language, and balances (default)
activity
- Read trade orders, deposits, withdrawals, and other operations
trade
- Create and cancel trade orders
withdraw
- Request EUR and BTC withdrawals (requires email confirmation from users upon withdrawing)
payment_request
- Used to requesting money by e-mail
deposit
- List bitcoin deposit addresses and create a new one if needed
merchant
- Create and manage an account's invoices
If the API call was successful, the platform will answer with:
API calls are rate-limited by IP to 86400 calls per day (one per second on average). Information about the status of the limit can be found in the X-RateLimit-Limit
and X-RateLimit-Remaining
HTTP headers.
Example response with rate-limit headers
HTTP/1.1 200
Content-Type: application/json; charset=utf-8
X-Ratelimit-Limit: 5000
X-Ratelimit-Remaining: 4982
Date: Wed, 30 Jan 2013 12:08:58 GMT
Examples in the documentation are using the ccxt
library, which supports Paymium's API and is available for Python, JavaScript and PHP.
Installation instructions can be found on GitHub.
'use strict'; const ccxt = require ('ccxt'); (async function () { let paymium = new ccxt.paymium({ apiKey: 'YOUR_PUBLIC_API_KEY', secret: 'YOUR_SECRET_PRIVATE_KEY', }) console.log(paymium.id, await paymium.publicGetCountries()) })();
[- {
- "iso_alpha2": "FR",
- "iso_alpha3": "FRA",
- "accepted": true,
- "card_partner_accepted": true,
- "name_fr": "France",
- "name_en": "France",
- "name_es": "Francia",
- "name_de": "Frankreich",
- "name_it": "Francia",
- "telephone_code": 33
}
]
'use strict'; const ccxt = require ('ccxt'); (async function () { let paymium = new ccxt.paymium({ apiKey: 'YOUR_PUBLIC_API_KEY', secret: 'YOUR_PRIVATE_API_KEY', }) console.log(paymium.id, await paymium.publicGetCurrencies()) })();
[- {
- "symbol": "ETH",
- "code": "ETH",
- "precision": "8",
- "name": false,
- "type": "crypto",
- "deposit": false,
- "withdraw": true,
- "withdraw_limit_min": "null",
- "withdraw_limit_max": "null",
- "charge_plan_limit_min": "0.00000001",
- "charge_plan_limit_max": "100.0",
- "email_transfer": true,
- "internal_transfer": false,
- "payment_request": false,
- "display_balance": true,
- "trading": [
- "string"
], - "swap": [
- "string"
], - "pairs": "LTC-EUR",
- "recurring_buy_plan": [
- "string"
], - "uri_scheme": "litecoin",
- "authorize_hd_walled_creation": false
}
]
Read open high low close volume data
currency required | string Value: "eur" |
interval | string Enum: "1m" "3m" "5m" "15m" "30m" "1h" "2h" "4h" "6h" "8h" "12h" "1d" "3d" "1w" "1M" Interval between each ohlcv compute. Iteration can not exceed 1000 (default 500) |
startTime | integer Number of seconds since the Unix Epoch of the oldest ohlcv to fetch. Can be filled if endTime is filled too. |
endTime | integer Number of seconds since the Unix Epoch of the last ohlcv to fetch. Can be filled if startTime is filled too. |
'use strict'; const ccxt = require ('ccxt'); (async function () { let paymium = new ccxt.paymium({ apiKey: 'YOUR_PUBLIC_API_KEY', secret: 'YOUR_SECRET_PRIVATE_KEY', }) console.log(paymium.id, await paymium.fetchOHLCV("eur","1m",undefined,undefined)) })();
[- 1615816800000,
- "47440.0",
- "50000.0",
- "42000.0",
- "43000.0",
- "0.05321696"
]
Read latest ticker data
currency required | string Enum: "eur" "btc" |
'use strict'; const ccxt = require('ccxt'); (async function () { let paymium = new ccxt.paymium({ apiKey: 'YOUR_PUBLIC_API_KEY', secret: 'YOUR_PRIVATE_API_KEY', }) console.log(paymium.id, await paymium.publicGetDataCurrencyTicker({ "currency": "eur" })) })();
{- "high": "45998.99",
- "low": "37210.0",
- "volume": "39.77651173",
- "bid": "40600.0",
- "ask": "40783.75",
- "midpoint": "40691.875",
- "vwap": "40509.86537845",
- "at": 1619184394,
- "price": "40600.0",
- "open": "45998.99",
- "variation": "-11.7372",
- "currency": "EUR",
- "trade_id": "0a31a001-2deb-48f1-b413-f1a31a9f97c1",
- "size": "0.0052"
}
Read the latest executed trades
currency required | string Enum: "eur" "btc" |
since | integer Number of seconds since the Unix Epoch of the oldest trade to fetch. |
'use strict'; const ccxt = require('ccxt'); (async function () { let paymium = new ccxt.paymium({ apiKey: 'YOUR_PUBLIC_API_KEY', secret: 'YOUR_PRIVATE_API_KEY', }) console.log(paymium.id, await paymium.publicGetDataCurrencyTrades({ "currency": "eur" })) })();
[- {
- "uuid": "59f9c458-cb22-48d6-9103-0b6e54130e29",
- "traded_btc": "0.153",
- "traded_currency": "102.51",
- "created_at": "2014-01-07T11:30:59Z",
- "currency": "EUR",
- "side": "buy",
- "price": "670.0",
- "created_at_int": 1389094259
}
]
Read the market depth, bids and asks are grouped by price.
currency required | string Enum: "eur" "btc" |
'use strict'; const ccxt = require('ccxt'); (async function () { let paymium = new ccxt.paymium({ apiKey: 'YOUR_PUBLIC_API_KEY', secret: 'YOUR_PRIVATE_API_KEY', }) console.log(paymium.id, await paymium.publicGetDataCurrencyDepth({ "currency": "eur" })) })();
{- "bids": [
- {
- "amount": "10484.15571436",
- "price": "35500.0"
}
], - "asks": [
- {
- "amount": "10484.15571436",
- "price": "35500.0"
}
]
}
Read the latest user info.
'use strict'; const ccxt = require ('ccxt'); (async function () { let paymium = new ccxt.paymium({ apiKey: 'YOUR_PUBLIC_API_KEY', secret: 'YOUR_SECRET_PRIVATE_KEY', }) console.log(paymium.id, await paymium.privateGetUser()) })();
{- "name": "BC-U123456",
- "email": "string",
- "locale": "en",
- "channel_id": "string",
- "meta_state": "string",
- "balance_eur": "1893.96",
- "locked_eur": "300.00743886",
- "balance_btc": "25.78866278",
- "locked_btc": "1.0",
- "balance_lbtc": "0.8",
- "locked_lbtc": "0.5",
- "balance_bch": "0.0",
- "locked_bch": "0.0",
- "balance_eth": "0.0",
- "locked_eth": "0.0",
- "balance_ltc": "0.0",
- "locked_ltc": "0.0",
- "balance_bcio": "0.0",
- "locked_bcio": "0.0",
- "balance_bat": "0.0",
- "locked_bat": "0.0",
- "balance_dai": "0.0",
- "locked_dai": "0.0",
- "balance_etc": "0.0",
- "locked_etc": "0.0"
}
Retrieve your Bitcoin deposit addresses along with their expiration timestamp.
'use strict'; const ccxt = require ('ccxt'); (async function () { let paymium = new ccxt.paymium({ apiKey: 'YOUR_PUBLIC_API_KEY', secret: 'YOUR_SECRET_PRIVATE_KEY', }) console.log(paymium.id, await paymium.privateGetUserAddresses()) })();
[- {
- "address": "1HdjGr6WCTcnmW1tNNsHX7fh4Jr5C2PeKe",
- "valid_until": 1620041926,
- "label": "Savings",
- "currency": "BTC"
}
]
Create a new deposit address unless 5 other one are already active. Currencies available are the ones which support a deposit.
currency | string Example: currency=BTC The currency for which the deposit address will be created |
label | string Example: label=Savings A label for the wallet address |
'use strict'; const ccxt = require ('ccxt'); (async function () { let paymium = new ccxt.paymium({ apiKey: 'YOUR_PUBLIC_API_KEY', secret: 'YOUR_SECRET_PRIVATE_KEY', }) console.log(paymium.id, await paymium.privatePostUserAddresses({ currency: 'BTC' })) })();
{- "address": "1HdjGr6WCTcnmW1tNNsHX7fh4Jr5C2PeKe",
- "valid_until": 1620041926,
- "label": "Savings",
- "currency": "BTC"
}
Retrieve details for a single address
address required | string Example: 1FPDBXNqSkZMsw1kSkkajcj8berxDQkUoc |
'use strict'; const ccxt = require ('ccxt'); (async function () { let paymium = new ccxt.paymium({ apiKey: 'YOUR_PUBLIC_API_KEY', secret: 'YOUR_SECRET_PRIVATE_KEY', }) console.log(paymium.id, await paymium.privateGetUserAddressesAddress({"address": "1HdjGr5WCHcnmW1tNNsHX7fh4Jr6C3PeKe" })) })();
{- "address": "1HdjGr6WCTcnmW1tNNsHX7fh4Jr5C2PeKe",
- "valid_until": 1620041926,
- "label": "Savings",
- "currency": "BTC"
}
List user'orders (market or limit)
In previous API versions, this endpoint was also used to read other types of transfers, this is no longer the case.
There are two types of pagination (exclusive) :
offset
/limit
window (enabled if offset
is set)page
number and a number of items per_page
(enabled by default or when per_page
is set)Pagination is not eligible for active orders (orders in order book).
active | boolean only show active orders |
offset | integer Default: 0 pagination offset (must be set to enable offset/limit pagination) |
limit | integer Default: 50 Examples:
pagination limit |
page | integer >= 1 Default: 1 Page number |
per_page | integer [ 5 .. 100 ] Default: 20 Item per page |
types | Array of strings Deprecated Items Enum: "LimitOrder" "MarketOrder" "BitcoinDeposit" "WireDeposit" "Payment" "EmailTransfer" "EmailDeposit" (see filter by types |
'use strict'; const ccxt = require ('ccxt'); (async function () { let paymium = new ccxt.paymium({ apiKey: 'YOUR_PUBLIC_API_KEY', secret: 'YOUR_SECRET_PRIVATE_KEY', }) console.log(paymium.id, await paymium.privateGetUserOrders()) })();
[- {
- "uuid": "968f4580-e26c-4ad8-8bcd-874d23d55296",
- "currency_amount": "string",
- "state": "executed",
- "btc_fee": "0.0",
- "currency_fee": "0.0",
- "created_at": "2013-10-24T10:34:37Z",
- "updated_at": "2013-10-24T10:34:37Z",
- "currency": "BTC",
- "comment": "string",
- "amount": "1.0",
- "type": "MarketOrder",
- "traded_btc": "string",
- "traded_currency": "string",
- "direction": "buy",
- "price": "string",
- "account_operations": [
- {
- "uuid": "968f4580-e26c-4ad8-8bcd-874d23d55296",
- "amount": "1.0",
- "currency": "BTC",
- "created_at": "2013-10-24T10:34:37Z",
- "created_at_int": 1389094259,
- "name": "account_operation",
- "address": "1FPDBXNqSkZMsw1kSkkajcj8berxDQkUoc",
- "tx_hash": "string",
- "is_trading_account": true
}
]
}
]
Create an order
type | string Enum: "LimitOrder" "MarketOrder" |
currency | string must be EUR |
direction | string Enum: "buy" "sell" |
price | number price per BTC, must be omitted for market orders |
amount | number or null BTC amount to trade. Either one of amount or currency_amount must be specified. When the amount is specified, the engine will buy or sell this amount of Bitcoins. When the currency_amount is specified, the engine will buy as much Bitcoins as possible for currency_amount or sell as much Bitcoins as necessary to obtain currency_amount. |
currency_amount | number or null Currency amount to trade. Either one of amount or currency_amount must be specified. When the amount is specified, the engine will buy or sell this amount of Bitcoins. When the currency_amount is specified, the engine will buy as much Bitcoins as possible for currency_amount or sell as much Bitcoins as necessary to obtain currency_amount. |
{- "type": "LimitOrder",
- "currency": "string",
- "direction": "buy",
- "price": 1,
- "amount": 0.001,
- "currency_amount": 0
}
{- "uuid": "968f4580-e26c-4ad8-8bcd-874d23d55296",
- "currency_amount": "string",
- "state": "executed",
- "btc_fee": "0.0",
- "currency_fee": "0.0",
- "created_at": "2013-10-24T10:34:37Z",
- "updated_at": "2013-10-24T10:34:37Z",
- "currency": "BTC",
- "comment": "string",
- "amount": "1.0",
- "type": "BitcoinTransfer",
- "traded_btc": "string",
- "traded_currency": "string",
- "direction": "buy",
- "price": "string",
- "account_operations": [
- {
- "uuid": "968f4580-e26c-4ad8-8bcd-874d23d55296",
- "amount": "1.0",
- "currency": "BTC",
- "created_at": "2013-10-24T10:34:37Z",
- "created_at_int": 1389094259,
- "name": "account_operation",
- "address": "1FPDBXNqSkZMsw1kSkkajcj8berxDQkUoc",
- "tx_hash": "string",
- "is_trading_account": true
}
]
}
Read details from a specific order.
uuid required | string Example: d64e6450-bf17-44a7-9bc1-bb830610293a |
'use strict'; const ccxt = require ('ccxt'); (async function () { let paymium = new ccxt.paymium({ apiKey: 'YOUR_PUBLIC_API_KEY', secret: 'YOUR_SECRET_PRIVATE_KEY', }) console.log(paymium.id, await paymium.privateGetUserOrdersUuid({ "uuid": "20f8dd15-ae87-4617-a353-d0996be60010" })) })();
{- "uuid": "968f4580-e26c-4ad8-8bcd-874d23d55296",
- "currency_amount": "string",
- "state": "executed",
- "btc_fee": "0.0",
- "currency_fee": "0.0",
- "created_at": "2013-10-24T10:34:37Z",
- "updated_at": "2013-10-24T10:34:37Z",
- "currency": "BTC",
- "comment": "string",
- "amount": "1.0",
- "type": "BitcoinTransfer",
- "traded_btc": "string",
- "traded_currency": "string",
- "direction": "buy",
- "price": "string",
- "account_operations": [
- {
- "uuid": "968f4580-e26c-4ad8-8bcd-874d23d55296",
- "amount": "1.0",
- "currency": "BTC",
- "created_at": "2013-10-24T10:34:37Z",
- "created_at_int": 1389094259,
- "name": "account_operation",
- "address": "1FPDBXNqSkZMsw1kSkkajcj8berxDQkUoc",
- "tx_hash": "string",
- "is_trading_account": true
}
]
}
Only active trade orders and email transfers may be canceled (an email notification will be sent)
uuid required | string Example: d64e6450-bf17-44a7-9bc1-bb830610293a |
'use strict'; const ccxt = require ('ccxt'); (async function () { let paymium = new ccxt.paymium({ apiKey: 'YOUR_PUBLIC_API_KEY', secret: 'YOUR_SECRET_PRIVATE_KEY', }) console.log(paymium.id, await paymium.privateDeleteUserOrdersUuid({ "uuid": "20f8dd15-ae87-4617-a353-d0996be60010" })) })();
Request BTC or fiat withdrawals. A confirmation is sent by email to the user before it can be executed.
currency required | string Enum: "BTC" "EUR" Example: currency=EUR |
amount required | number Example: amount=0.001 amount to transfer |
address | string BTC address if withdrawing BTC |
'use strict'; const ccxt = require ('ccxt'); (async function () { let paymium = new ccxt.paymium({ apiKey: 'YOUR_PUBLIC_API_KEY', secret: 'YOUR_SECRET_PRIVATE_KEY', }) console.log(paymium.id, await paymium.privatePostUserWithdrawals({ "currency": "BTC", "amount": "1.0", "withdrawal_address": "1HdjGr6WCTcnmW1tNNsHX7fh4Jr5C2PeKe" })) })();
{- "uuid": "968f4580-e26c-4ad8-8bcd-874d23d55296",
- "currency_amount": "string",
- "state": "executed",
- "btc_fee": "0.0",
- "currency_fee": "0.0",
- "created_at": "2013-10-24T10:34:37Z",
- "updated_at": "2013-10-24T10:34:37Z",
- "currency": "BTC",
- "comment": "string",
- "amount": "1.0",
- "type": "BitcoinTransfer",
- "traded_btc": "string",
- "traded_currency": "string",
- "direction": "buy",
- "price": "string",
- "account_operations": [
- {
- "uuid": "968f4580-e26c-4ad8-8bcd-874d23d55296",
- "amount": "1.0",
- "currency": "BTC",
- "created_at": "2013-10-24T10:34:37Z",
- "created_at_int": 1389094259,
- "name": "account_operation",
- "address": "1FPDBXNqSkZMsw1kSkkajcj8berxDQkUoc",
- "tx_hash": "string",
- "is_trading_account": true
}
]
}
List withdrawals
page | integer >= 1 Default: 1 Page number |
per_page | integer [ 5 .. 100 ] Default: 20 Item per page |
currencies | Array of strings Items Enum: "BTC" "EUR" |
[- {
- "uuid": "968f4580-e26c-4ad8-8bcd-874d23d55296",
- "currency_amount": "string",
- "state": "executed",
- "btc_fee": "0.0",
- "currency_fee": "0.0",
- "created_at": "2013-10-24T10:34:37Z",
- "updated_at": "2013-10-24T10:34:37Z",
- "currency": "BTC",
- "comment": "string",
- "amount": "1.0",
- "type": "BitcoinTransfer",
- "traded_btc": "string",
- "traded_currency": "string",
- "direction": "buy",
- "price": "string",
- "account_operations": [
- {
- "uuid": "968f4580-e26c-4ad8-8bcd-874d23d55296",
- "amount": "1.0",
- "currency": "BTC",
- "created_at": "2013-10-24T10:34:37Z",
- "created_at_int": 1389094259,
- "name": "account_operation",
- "address": "1FPDBXNqSkZMsw1kSkkajcj8berxDQkUoc",
- "tx_hash": "string",
- "is_trading_account": true
}
]
}
]
Initiate a money transfer to an e-mail address. The transfer is immediately executed if the user have a valid account. Otherwise, an e-mail is sent with a registration invitation. This transfer expire after 1 month if it is not collected. In this case, the order is cancelled and the sender re-credited.
amount | number amount to transfer |
currency | string Enum: "BTC" "EUR" |
string an e-mail address | |
comment | string a small note explaining the transfer |
'use strict'; const ccxt = require ('ccxt'); (async function () { let paymium = new ccxt.paymium({ apiKey: 'YOUR_PUBLIC_API_KEY', secret: 'YOUR_SECRET_PRIVATE_KEY', }) console.log(paymium.id, await paymium.privatePostUserEmailTransfers({ "currency": "BTC", "amount": "1.0", "email": "johnsmith@example.com", "comment": "For your savings" })) })();
{- "uuid": "968f4580-e26c-4ad8-8bcd-874d23d55296",
- "currency_amount": "string",
- "state": "executed",
- "btc_fee": "0.0",
- "currency_fee": "0.0",
- "created_at": "2013-10-24T10:34:37Z",
- "updated_at": "2013-10-24T10:34:37Z",
- "currency": "BTC",
- "comment": "string",
- "amount": "1.0",
- "type": "BitcoinTransfer",
- "traded_btc": "string",
- "traded_currency": "string",
- "direction": "buy",
- "price": "string",
- "account_operations": [
- {
- "uuid": "968f4580-e26c-4ad8-8bcd-874d23d55296",
- "amount": "1.0",
- "currency": "BTC",
- "created_at": "2013-10-24T10:34:37Z",
- "created_at_int": 1389094259,
- "name": "account_operation",
- "address": "1FPDBXNqSkZMsw1kSkkajcj8berxDQkUoc",
- "tx_hash": "string",
- "is_trading_account": true
}
]
}
This functionality allows one to create a payment request that is sent by e-mail to the designated recipient, when the link contained in the e-mail is clicked, the recipient is presented with a Bitcoin address to which he is instructed to direct his payment. Once the Bitcoin payment is confirmed, the payee is credited in the originally requested currency.
currency | string Enum: "BTC" "EUR" |
amount | number amount to transfer |
string an e-mail address | |
payment_split | number Percentage of the payment the merchant will get in currency expressed as a two-decimal places float between 0 and 1 (required). Warning, when one request bitcoin, payment split must be 0. |
comment | string a small note explaining the transfer |
'use strict'; const ccxt = require ('ccxt'); (async function () { let paymium = new ccxt.paymium({ apiKey: 'YOUR_PUBLIC_API_KEY', secret: 'YOUR_SECRET_PRIVATE_KEY', }) console.log(paymium.id, await paymium.privatePostUserPaymentRequests({ "currency": "BTC", "amount": "0.001", "email": "johnsmith@example.com", "comment": "For the restaurant", "payment_split": "0" })) })();
[- {
- "uuid": "6cecd395-92bf-4da6-8f2c-0611940ea0bb",
- "label": "For the restaurant",
- "currency": "BTC",
- "payment_split": "0.0",
- "requires_customer_email": false,
- "requires_delivery_address": false,
- "amount": "0.01",
- "created_at": "1688138855",
- "updated_at": "1688138855"
}
]
The Merchant API enables merchants to securely sell goods and services and get paid in Bitcoin. The API makes it possible for the merchant to completely eliminate the risk of market fluctuations when requesting to receive fiat currency in their account. It is also possible to keep a part of the payment in Bitcoin without having it converted at a guaranteed rate. The API allows developers to integrate Bitcoin payments very tightly into their platforms, pre-packaged plugins are also available for a growing list of popular e-commerce frameworks. For merchants that have very simple needs payment buttons are also available, these buttons remove the integration completely by allowing merchants to simply include a code snippet on a static HTML page, or on a blog to receive fixed-amount payments.
The 'merchant token' authentication mechanism has been removed please use an API token or an OAuth2 token instead with the 'merchant' scope.
A payment is created by a merchant platform when the customer chooses Bitcoin as his desired checkout option. The merchant platform can then :
https://paymium.com/invoice/{UUID}
can be used, this is used by the e-commerce framework plugins.
Once the payment request is displayed, the customer has 15 minutes to send the appropriate amount. Paymium notifies the merchant of the completion of his payment via the associated callback (for which an URL may be provided when creating the payment request), once one Bitcoin confirmation for the payment is received the funds are credited to the merchant's account, a callback notification is then made.
Create merchant payment
amount required | number Example: amount=0.001 amount requested for the payment |
payment_split required | number Example: payment_split=0.5 Percentage of the payment the merchant will get in currency expressed as a two-decimal places float between 0 and 1 |
currency required | string Enum: "BTC" "EUR" |
callback_url | string Example: callback_url=http://myonlineshop/payments/order-987978/callback Merchant callback URL, it is called when the state of the payment changes |
redirect_url | string Example: redirect_url=http://myonlineshop/payments/order-987978/success URL to which the customer should be redirected at upon payment |
cancel_url | string Example: cancel_url=http://myonlineshop/payments/order-987978/cancel URL to which the customer should be redirected when cancelling |
merchant_reference | string Example: merchant_reference=order-987978 Arbitrary merchant data associated to the payment |
'use strict'; const ccxt = require('ccxt'); (async function () { let paymium = new ccxt.paymium({ apiKey: 'YOUR_PUBLIC_API_KEY', secret: 'YOUR_PRIVATE_API_KEY', }) console.log(paymium.id, await paymium.privatePostMerchantCreatePayment({ "amount": "0.0001", "payment_split": "0", "currency": "BTC", "callback_url": "https://myonlineshop/payments/order-987978/callback", "redirect_url": "http://myonlineshop/payments/order-987978/success", "merchant_reference": "order-987978" })) })();
{- "uuid": "8f60c9df-76da-4618-906d-52af659baddf",
- "currency": "BTC",
- "payment_split": 0,
- "state": "pending_payment",
- "merchant_name": "PM-U24582195",
- "expires_at": 1619449070,
- "merchant_reference": "order-987978",
- "amount": "0.0001",
- "btc_amount": "0.0001",
- "payment_address": "1H7X3bH8r5snj8vqXRCPnQ8Ewn6AHfVd9j",
- "created_at": 1619447270,
- "updated_at": 1619447270,
- "account_operations": {
- "uuid": "968f4580-e26c-4ad8-8bcd-874d23d55296",
- "amount": "1.0",
- "currency": "BTC",
- "created_at": "2013-10-24T10:34:37Z",
- "created_at_int": 1389094259,
- "name": "account_operation",
- "address": "1FPDBXNqSkZMsw1kSkkajcj8berxDQkUoc",
- "tx_hash": "string",
- "is_trading_account": true
}
}
Get merchant payment
uuid required | string Example: 458f4580-e26c-4ad8-8bcd-874d23d55296 payment identifier |
'use strict'; const ccxt = require('ccxt'); (async function () { let paymium = new ccxt.paymium({ apiKey: 'YOUR_PUBLIC_API_KEY', secret: 'YOUR_PRIVATE_API_KEY', }) console.log(paymium.id, await paymium.privateGetMerchantGetPaymentUuid({ "uuid": "0a31a001-2deb-48f1-b413-f1a31a9f97c1" })) })();
{- "uuid": "8f60c9df-76da-4618-906d-52af659baddf",
- "currency": "BTC",
- "payment_split": 0,
- "state": "pending_payment",
- "merchant_name": "PM-U24582195",
- "expires_at": 1619449070,
- "merchant_reference": "order-987978",
- "amount": "0.0001",
- "btc_amount": "0.0001",
- "payment_address": "1H7X3bH8r5snj8vqXRCPnQ8Ewn6AHfVd9j",
- "created_at": 1619447270,
- "updated_at": 1619447270,
- "account_operations": {
- "uuid": "968f4580-e26c-4ad8-8bcd-874d23d55296",
- "amount": "1.0",
- "currency": "BTC",
- "created_at": "2013-10-24T10:34:37Z",
- "created_at_int": 1389094259,
- "name": "account_operation",
- "address": "1FPDBXNqSkZMsw1kSkkajcj8berxDQkUoc",
- "tx_hash": "string",
- "is_trading_account": true
}
}
A socket.io endpoint is available to receive public data. This allows you to receive new data without having to poll the server.
The socket.io socket will emit a stream
event when new data is available. The received JSON data contains one or more of the properties listed below, depending on what was updated.
Socket.io must connect to https://paymium.com/<public or user>
and the path
option must be set to /ws/socket.io
.
Assuming you have node.js installed, you can install the socket.io client library by running npm install socket.io-client
.
The code below shows how to connect to the Paymium socket, and outputs any received data to the console.
var io = require('socket.io-client');
var socket = io.connect('https://paymium.com/public', {
path: '/ws/socket.io'
});
console.log('CONNECTING');
socket.on('connect', function() {
console.log('CONNECTED');
console.log('WAITING FOR DATA...');
});
socket.on('disconnect', function() {
console.log('DISCONNECTED');
});
socket.on('stream', function(data) {
console.log('GOT DATA:');
console.log(data);
});
Websockets are implemented using socket.io v1.3.
You must connect your socket.io client to paymium.com/public
, setting the path option to /ws/socket.io
. When new data is available, a stream
event is triggered.
var io = require('socket.io-client');
var socket = io.connect('https://paymium.com/public', {
path: '/ws/socket.io'
});
console.log('CONNECTING');
socket.on('connect', function() {
console.log('CONNECTED');
console.log('WAITING FOR DATA...');
});
socket.on('disconnect', function() {
console.log('DISCONNECTED');
});
socket.on('stream', function(publicData) {
console.log('GOT DATA:');
console.log(publicData);
});
The stream
event will emit an object when new data is available. The object will have properties only for the data that changed.
If the ticker changed, publicData.ticker
will contains the new ticker information.
Example:
{
ticker: {
high: "275",
low: "275",
volume: "0.10909089",
bid: "205",
ask: "275",
midpoint: "240",
vwap: "275",
at: 1446464202,
price: "275",
open: "270",
variation: "1.8519",
currency: 'EUR',
trade_id: '460aff60-8fff-4fb0-8be5-2f8dc67758c2'
}
}
If new trades are executed, publicData.trades
will be an array containing the new trades.
Example:
{
trades: [
{
price: "275",
traded_btc: "0.03636363",
timestamp: 1446464202000,
currency: 'EUR'
}
]
}
If buy orders have changed (created, changed, or deleted), publicData.bids
will be an array containing the modified orders. Orders are aggregated by price. If amount
is 0
, there are no more orders at this price.
Example:
{
bids: [
{
timestamp: 1424208720,
amount: "17.43992373",
price: "265",
currency: 'EUR'
}
]
}
If sell orders have changed (created, changed, or deleted), publicData.asks
will be an array containing the modified orders. Orders are aggregated by price. If amount
is 0
, there are no more orders at this price.
Example:
{
asks: [
{
timestamp: 1424208720,
amount: 17.43992373,
price: 275,
currency: 'EUR'
}
]
}
You must connect your socket.io client to https://paymium.com/user
, setting the path option to /ws/socket.io
.
You must emit a channel
event with the user channel id. This channel id is available in the user's json (/api/v1/user
).
When new data is available, a stream
event is triggered.
var io = require('socket.io-client');
var socket = io.connect('https://paymium.com/user', {
path: '/ws/socket.io'
});
console.log('CONNECTING');
socket.on('connect', function() {
console.log('CONNECTED');
console.log('WAITING FOR DATA...');
});
// Replace USER_CHANNEL_ID with the channel id of the user
socket.emit('channel', 'USER_CHANNEL_ID');
socket.on('disconnect', function() {
console.log('DISCONNECTED');
});
socket.on('stream', function(userData) {
console.log('GOT DATA:');
console.log(userData);
});
The stream
event will emit an object when new data is available. The object will have properties only for the data that changed.
If the available EUR balance changed, userData.balance_eur
will contain the new balance.
{
balance_eur: "410.04"
}
If the locked EUR balance changed, userData.locked_eur
will contain the new balance.
{
locked_eur: "20.24"
}
If the available BTC balance changed, userData.balance_btc
will contain the new balance.
{
balance_btc: "53.29811458"
}
If the locked BTC balance changed, userData.locked_btc
will contain the new balance.
{
locked_btc: "0"
}
If user orders have changed (created, filled, cancelled, etc...), userData.orders
will be an array containing the modified orders. You can check the state of the orders to handle them properly.
Example:
{
orders: [
{
uuid: '89d4b612-5e6a-4154-94f3-120d03f4e891',
amount: "1",
currency_amount: "10",
state: "pending_execution",
btc_fee: "0",
currency_fee: "0",
updated_at: '2015-11-02T11:36:41.000Z',
created_at: '2015-11-02T11:36:41.000Z',
currency: 'EUR',
comment: null,
type: 'MarketOrder',
traded_btc: "0",
traded_currency: "0",
direction: 'buy',
price: "1000",
account_operations: []
}
]
}