Home

Awesome

Paymium logo

NEW: Our sandbox environment is now available, visit sandbox.paymium.com (you may have to add a security exception for the SSL certificate to validate).

The Paymium API allows developers to extend the capabilities of the Paymium platform, from reading the latest ticker to automating trades with bots.

IMPORTANT NOTE: Your API client must support SNI in order to not receive certificate name mismatch warnings.

Is 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

Table of contents

General information

Formats and required HTTP request headers

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.

Localization

The relevant results and error messages will be localized to the language associated to the user, currently English and French are supported.

Datetime formats

Datetime values will be returned as regular JSON format and Unix timestamps, the timestamps are suffixed with _int.

Error handling

Whenever an error is encountered, the answer to a JSON API call will have:

Example:
{
  "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)"
  ]
}

Successful calls

If the API call was successful, the platform will answer with:

Rate-limiting

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

Authentication

Permissions

Before you request authorization to access a user's account, you must decide which permissions, or scopes you would like to access.

The following scopes are available:

namedescription
basicRead account number, language, and balances (default)
activityRead trade orders, deposits, withdrawals, and other operations
tradeCreate and cancel trade orders
withdrawRequest EUR and BTC withdrawals (requires email confirmation from users upon withdrawing)
depositList bitcoin deposit addresses and create a new one if needed
merchantCreate and manage an account's invoices

Token authentication

This authentication mechanism is the recommended method if you need to access your own account data and is also referred to as HMAC authentication, if you need to access other users accounts on their behalf you'll need to use the OAuth2 authentication method.

Generating a token

For this authentication method you need to generate a token/secret pair that you will use to make requests against our API. In order to do so visit the "API tokens" menu in your account profile and click on "Create token". You will be presented with the following screen that will enable you to select the desired access permissions for this token. For security reasons you will need to confirm your access credentials.

Create an API token

Once your token is created you'll be presented once with the matching secret key, this secret key is only displayed once, you need to record it carefully. If the secret key is lost the token becomes useless.

Making requests

Once you have an API token and its matching secret key you can use them to make requests against our API. In order to do so you must include three HTTP headers that will authenticate your request.

$ curl "https://paymium.com/api/v1/user"               \
     --header "Api-Key: <YOUR API TOKEN>"              \
     --header "Api-Signature: <THE REQUEST SIGNATURE>" \
     --header "Api-Nonce: <AN UPDATED NONCE>"          \

OAuth2 authentication

This authentication mechanism is best suited to cases where a developer publishes an app that requires access its users Paymium accounts.

Many programming languages already have libraries to develop clients that connect to OAuth2 APIs, hence the following steps may not be necessary. For instance, if you are a Ruby developer, you can use this example to get started.

The process can be summarized as follows:

  1. Send the user to your application's authorization URL
  2. Receive the authorization code if the user accepted the request
  3. Get an access token and a refresh token from the authorization code
  4. Refresh the access token when needed
Requesting user authorization

To get user's permission to use his/her account, you must send him/her to your application's redirect URI. You can see this URI by visiting your application's page: https://paymium.com/page/developers/apps.

By default, the basic scope will be requested.

If your application requires specific access scopes, you must append a scope GET parameter to the authorization URI:

https://paymium.com/...&scope=basic+activity+trade

The user will then be prompted to authorize your application with the specified scopes.

Receiving the authorization code

If you specified the test redirection URI https://paymium.com/page/oauth/test, the user will be presented the autorization code upon accepting your request which can be used by the application to fetch access tokens.

Otherwise the code or error will be sent to the redirection URI so that your application can retrieve it (in this case https://example.com/callback):

https://example.com/callback?code=AUTHORIZATION_CODE

Or if the request was denied by the user:

https://example.com/callback?error=access_denied&error_description=The+resource+owner+or+authorization+server+denied+the+request.

The authorization code is valid 5 minutes.

Fetching an access token and a refresh token

Once your application received the authorization code, it can request an access token and a refresh token:

$ curl "https://paymium.com/api/oauth/token"                    \
    -d "client_id=APPLICATION_KEY"                              \
    -d "client_secret=APPLICATION_SECRET"                       \
    -d "grant_type=authorization_code"                          \
    -d "redirect_uri=REDIRECT_URI"                              \
    -d "code=AUTHORIZATION_CODE"
{
  "access_token": "ACCESS_TOKEN",
  "token_type": "bearer",
  "expires_in": 1800,
  "refresh_token": "REFRESH_TOKEN",
  "scope": "basic"
}

An access token can be used to authorize user requests for the approved scopes and is valid 30 minutes.

Refreshing the access token

Since an access token is only valid 30 minutes, your application may need to fetch a new access token using the refresh token:

$ curl "https://paymium.com/api/oauth/token"                    \
    -d "client_id=APPLICATION_KEY"                              \
    -d "client_secret=APPLICATION_SECRET"                       \
    -d "grant_type=refresh_token"                               \
    -d "redirect_uri=REDIRECT_URI"                              \
    -d "refresh_token=REFRESH_TOKEN"
{
  "access_token": "NEW_ACCESS_TOKEN",
  "token_type": "bearer",
  "expires_in": 1800,
  "refresh_token": "NEW_REFRESH_TOKEN",
  "scope": "basic"
}

After refreshing the access token, the previous tokens (access and refresh) are no longer valid.

Public data

Public data (ticker, asks, bids, trades) can be accessed without registering an application.

Countries

Description

Read the list of countries, we currently serve the residents of countries for which the accepted flag is set to true.

Endpoint
methodpathauthorization
GET/api/v1/countriesnot required
Example
$ curl https://paymium.com/api/v1/countries
[
  {
    "id": 76,
    "accepted": true,
    "iso_alpha2": "FR",
    "iso_alpha3": "FRA",
    "iso_numeric": 250,
    "name_en": "France",
    "name_fr": "France",
    "telephone_code": 33
  },
  {
    "id": 157,
    "accepted": true,
    "iso_alpha2": "NL",
    "iso_alpha3": "NLD",
    "iso_numeric": 528,
    "name_en": "Netherlands",
    "name_fr": "Pays-Bas",
    "telephone_code": 31
  }
]

Ticker

Description

Read the latest ticker data.

Endpoint
methodpathauthorization
GET/api/v1/data/eur/tickernot required
Example
$ curl https://paymium.com/api/v1/data/eur/ticker
{
  "high": 720.0,
  "low": 640.0001,
  "volume": 198.16844745,
  "bid": 676.01,
  "ask": 679.9999999,
  "midpoint": 678.00499995,
  "at": 1389092410,
  "price": 680.0,
  "vwap": 679.87459,
  "variation": -5.5556,
  "currency": "EUR"
}
Properties
namedescriptionexample value
currencycurrency"EUR"
attimestamp1389092410
priceprice of latest trade680.0
bidbid price676.01
askask price679.9999999
midpointmidpoint price678.00499995
volume24h volume198.16844745
variation24h variation (percentage)-5.5556
high24h high price720.0
low24h low price640.0001
vwap24h volume-weighted average price679.87459

Latest trades

Description

Read the latest executed trades.

Endpoint
methodpathauthorization
GET/api/v1/data/eur/tradesnot required
Parameters
namedescriptionrequiredtypedefaultexample
sinceThe timestamp of the oldest trade to fetch.falseInteger1 week ago1389094259
Example
$ curl "https://paymium.com/api/v1/data/eur/trades?since=1389094259"
[
  {
    "uuid": "59f9c458-cb22-48d6-9103-0b6e54130e29",
    "traded_btc": 0.153,
    "traded_currency": 102.51,
    "created_at": "2014-01-07T11:30:59Z",
    "currency": "EUR",
    "price": 670.0,
    "created_at_int": 1389094259
  },
  {
    "uuid": "4787c80b-bc90-48d4-87ee-b23fbff2fbb7",
    "traded_btc": 0.06,
    "traded_currency": 40.2,
    "created_at": "2014-01-07T11:31:00Z",
    "currency": "EUR",
    "price": 670.0,
    "created_at_int": 1389094260
  },
  {
    "uuid": "67838a4d-cd2e-47d1-9b3c-0ff7a6d2ea89",
    "traded_btc": 0.4,
    "traded_currency": 268.0,
    "created_at": "2014-01-07T11:31:00Z",
    "currency": "EUR",
    "price": 670.0,
    "created_at_int": 1389094260
  }
]
Properties

The response is an array of trades.

Trade properties
namedescriptionexample value
uuidunique ID of trade"59f9c458-cb22-48d6-9103-0b6e54130e29"
currencycurrency"EUR"
created_atdate created"2014-01-07T11:30:59Z"
created_at_inttimestamp1389094259
priceprice per BTC670.0
traded_btcamount of BTC traded0.153
traded_currencyamount of currency traded102.51

Market depth

Description

Read the market depth. Bids and asks are grouped by price.

Endpoint
methodpathauthorization
GET/api/v1/data/eur/depthnot required
Example
$ curl "https://paymium.com/api/v1/data/eur/depth"
{
  "bids": [
    {
      "timestamp": 1389087724,
      "amount": 0.89744,
      "price": 665.0,
      "currency": "EUR"
    },
    {
      "timestamp": 1389082088,
      "amount": 0.06,
      "price": 666.0,
      "currency": "EUR"
    }
  ],
  "asks": [
    {
      "timestamp": 1389094178,
      "amount": 0.57709999,
      "price": 679.99,
      "currency": "EUR"
    },
    {
      "timestamp": 1389092448,
      "amount": 0.20684181,
      "price": 680.0,
      "currency": "EUR"
    }
  ]
}
Properties
namedescription
bidsan array of bids
asksan array of asks
Bids / asks properties
namedescriptionexample value
currencycurrency"EUR"
timestamptimestamp1389087724
priceprice665.0
amountamount at price0.06

Bitcoin-Charts endpoints

Two API endpoints dedicated to Bitcoin-Charts are publicly accessible, they are accessible at:

The data they return is formatted according to the Bitcoin Charts exchange API specification.

WebSocket

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 configuration

Socket.io must connect to paymium.com/<public or user> and the path option must be set to /ws/socket.io.

Message descriptions

The Websocket messages are documented separately: documentation.

Node.js example

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.

The example is available in the examples/public_socket.js directory of this repository.

var io = require('socket.io-client');

var socket = io.connect('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);
});

FIX streaming API

The FIX API is documented separately: documentation.

User data

Before you can access your own data or other users data, you must register an application on Paymium:

  1. Verify your account and log in
  2. Visit https://paymium.com/page/developers/apps
  3. Create an application (set redirect URI to https://paymium.com/page/oauth/test when testing)

User info

Description

Read the latest user info.

Endpoint
methodpathauthorization
GET/api/v1/useroauth2 (scope: basic)
Example
$ curl "https://paymium.com/api/v1/user"                        \
     --header "Authorization: Bearer ACCESS_TOKEN"
{
  "name": "BC-U123456",
  "locale": "en",
  "balance_btc": 25.78866278,
  "locked_btc": 1.0,
  "balance_eur": 1893.96,
  "locked_eur": 300.00743886
}
Properties
namedescriptionexample value
nameaccount number / name"BC-U123456"
localelocale code"en"
balance_euravailable EUR balance1893.96
locked_eurEUR balance locked in trading300.00743886
balance_btcavailable BTC balance25.78866278
locked_btcBTC balance locked in trading1.0

User activity

Description

Read user activity.

Endpoint
methodpathauthorization
GET/api/v1/user/ordersoauth2 (scope: activity)
Parameters
namedescriptionexample value
offsetpagination offset (optional)20
limitpagination limit (optional)20
types[]filter by types (optional)LimitOrder
activeonly show active orders (optional)true
Example
$ curl "https://paymium.com/api/v1/user/orders?offset=20"                \
     --header "Authorization: Bearer ACCESS_TOKEN"
[
  {
    "uuid": "968f4580-e26c-4ad8-8bcd-874d23d55296",
    "amount": 1.0,
    "state": "executed",
    "btc_fee": 0.0,
    "currency_fee": 0.0,
    "updated_at": "2013-10-24T10:34:37.000Z",
    "created_at": "2013-10-22T19:12:02.000Z",
    "currency": "BTC",
    "type": "Transfer",
    "account_operations": [
      {
        "uuid": "94b42d0f-9c2d-43f3-978b-aba28533d1f9",
        "name": "bitcoin_transfer",
        "amount": -1.0,
        "currency": "BTC",
        "created_at": "2013-10-22T19:12:02.000Z",
        "created_at_int": 1382469122,
        "is_trading_account": false
      }
    ]
  },
  {
    "uuid": "1953cd1b-3903-4812-9590-42c3ebcc08c2",
    "amount": 49.38727114,
    "state": "executed",
    "btc_fee": 0.0,
    "currency_fee": 0.0,
    "updated_at": "2013-10-22T14:30:06.000Z",
    "created_at": "2013-10-22T14:30:06.000Z",
    "currency": "BTC",
    "type": "AdminOrder",
    "account_operations": [
      {
        "uuid": "a940393b-4d2f-4a5a-8a0a-3470d7419bad",
        "name": "account_operation",
        "amount": 49.38727114,
        "currency": "BTC",
        "created_at": "2013-10-22T14:30:06.000Z",
        "created_at_int": 1382452206,
        "is_trading_account": false
      }
    ]
  }
]
Properties

The response is an array of orders. See order properties.

Order details

Description

Read details from a specific order.

Endpoint
methodpathauthorization
GET/api/v1/user/orders/{UUID}oauth2 (scope: activity)
Example
$ curl "https://paymium.com/api/v1/user/orders/968f4580-e26c-4ad8-8bcd-874d23d55296"         \
     --header "Authorization: Bearer ACCESS_TOKEN"
{
  "uuid": "968f4580-e26c-4ad8-8bcd-874d23d55296",
  "amount": 1.0,
  "state": "executed",
  "btc_fee": 0.0,
  "currency_fee": 0.0,
  "updated_at": "2013-10-24T10:34:37.000Z",
  "created_at": "2013-10-22T19:12:02.000Z",
  "currency": "BTC",
  "type": "Transfer",
  "account_operations": [
    {
      "uuid": "94b42d0f-9c2d-43f3-978b-aba28533d1f9",
      "name": "bitcoin_transfer",
      "amount": -1.0,
      "currency": "BTC",
      "created_at": "2013-10-22T19:12:02.000Z",
      "created_at_int": 1382469122,
      "is_trading_account": false
    }
  ]
}
Properties

See order properties.

Trading

Description

Create trade orders.

Limit and market orders are supported, the price parameter must be omitted for market orders.

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.

Endpoint
methodpathauthorization
POST/api/v1/user/ordersoauth2 (scope: trade)
Payload
namedescriptionexample value
typemust be "LimitOrder" or "MarketOrder""LimitOrder"
currencymust be "EUR""EUR"
directiontrade direction, must be "buy" or "sell""buy"
priceprice per BTC, must be omitted for market orders300.0
amountBTC amount to trade (only if no currency_amount is specified)1.0
currency_amountCurrency amount to trade (only if no amount is specified)1.0
Example
$ curl "https://paymium.com/api/v1/user/orders"                     \
     --header "Authorization: Bearer ACCESS_TOKEN"                  \
     -d "type=LimitOrder"                                           \
     -d "currency=EUR"                                              \
     -d "direction=buy"                                             \
     -d "price=300.0"                                               \
     -d "amount=1.0"

Would return:

{
  "uuid": "4924ee0f-f60e-40b4-b63e-61637ef253ac",
  "amount": 1.0,
  "state": "pending_execution",
  "btc_fee": 0.0,
  "currency_fee": 0.0,
  "updated_at": "2013-11-21T15:27:04.000Z",
  "created_at": "2013-11-21T15:27:04.000Z",
  "currency": "EUR",
  "type": "LimitOrder",
  "traded_btc": 0.0,
  "traded_currency": 0.0,
  "direction": "buy",
  "price": 300.0,
  "account_operations": [
    {
      "uuid": "63e1d9c4-dff2-42bc-910b-c5b585b625cc",
      "name": "lock",
      "amount": -300.0,
      "currency": "EUR",
      "created_at": "2013-11-21T15:27:04.000Z",
      "created_at_int": 1385047624,
      "is_trading_account": false
    },
    {
      "uuid": "c9d3e824-b29a-4630-8396-3864a0704336",
      "name": "lock",
      "amount": 300.0,
      "currency": "EUR",
      "created_at": "2013-11-21T15:27:04.000Z",
      "created_at_int": 1385047624,
      "is_trading_account": true
    }
  ]
}
Properties

See order properties.

Withdrawing

Request BTC or fiat withdrawals. A confirmation is sent by email to the user before it can be executed.

Endpoint
methodpathauthorization
POST/api/v1/user/ordersoauth2 (scope: withdraw)
Payload
namedescriptionexample value
typemust be "Transfer""Transfer"
currencycurrency code"BTC"
amountamount to transfer0.5
addressBTC address if withdrawing BTC"1PzU1ERAnHJmtU8J3qq3wwJhyLepwUYzHn"
Example
$ curl "https://paymium.com/api/v1/user/orders"                     \
     --header "Authorization: Bearer ACCESS_TOKEN"                  \
     -d "type=Transfer"                                             \
     -d "currency=BTC"                                              \
     -d "amount=0.5"                                                \
     -d "address=1PzU1ERAnHJmtU8J3qq3wwJhyLepwUYzHn"

Would return:

{
  "uuid": "9229fd6e-0aad-45d6-8090-a400f37a0129",
  "amount": 0.5,
  "state": "pending",
  "btc_fee": 0.0,
  "currency_fee": 0.0,
  "updated_at": "2014-01-09T10:22:00.858Z",
  "created_at": "2014-01-09T10:22:00.858Z",
  "currency": "BTC",
  "type": "Transfer",
  "account_operations": [
    {
      "uuid": "4c4f4682-354f-46d1-a916-72d88d5584e3",
      "name": "bitcoin_transfer",
      "amount": -0.5,
      "currency": "BTC",
      "created_at": "2014-01-09T10:22:02.171Z",
      "created_at_int": 1389262922,
      "is_trading_account": false
    }
  ]
}
Properties

See order properties.

Sending money

Description

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.

Endpoint

methodpathauthorization
POST/api/v1/user/ordersoauth2 (scope: send)
Payload
namedescriptionexample value
typemust be "EmailTransfer""EmailTransfer"
currencycurrency code"BTC"
amountamount to transfer0.5
emailan e-mail address"user@example.com"
commenta small note explaining the transfer"Hi, refund for that thing"
Example
$ curl "https://paymium.com/api/v1/user/orders"                     \
     --header "Authorization: Bearer ACCESS_TOKEN"                  \
     -d "type=EmailTransfer"                                        \
     -d "currency=BTC"                                              \
     -d "amount=0.5"                                                \
     -d "email=user@example.com"                                    \
     -d "comment=Hi, refund for that thing"

Would return:

{
  "uuid": "9229fd6e-0aad-45d6-8090-a400f37a0129",
  "amount": 0.5,
  "state": "pending",
  "btc_fee": 0.0,
  "currency_fee": 0.0,
  "updated_at": "2014-01-09T10:22:00.858Z",
  "created_at": "2014-01-09T10:22:00.858Z",
  "currency": "BTC",
  "type": "EmailTransfer",
  "account_operations": [
    {
      "uuid": "4c4f4682-354f-46d1-a916-72d88d5584e3",
      "name": "email_transfer",
      "amount": -0.5,
      "currency": "BTC",
      "created_at": "2014-01-09T10:22:02.171Z",
      "created_at_int": 1389262922,
      "is_trading_account": false
    }
  ]
}

Requesting money by e-mail

Description

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.

Endpoint

methodpathauthorization
POST/api/v1/user/payment_requestsoauth2 (scope: receive)
Payload
namedescriptionexample value
typemust be "PaymentRequest""PaymentRequest"
currencycurrency code"BTC"
amountamount to transfer0.5
emailan e-mail address"user@example.com"
payment_splitPercentage of the payment the merchant will get in currency expressed as a two-decimal places float between 0 and 1 (required)1.0
commenta small note explaining the transfer"Hi, refund for that thing"
Example
$ curl "https://paymium.com/api/v1/user/payment_requests" \
     --header "Authorization: Bearer ACCESS_TOKEN"        \
     -d "type=PaymentRequest"                             \
     -d "currency=BTC"                                    \
     -d "amount=0.5"                                      \
     -d "email=user@example.com"                          \
     -d "payment_split=1"                                 \
     -d "comment=Hi, refund for that thing"

If successful, responds with a HTTP/1.1 201 Created status code.

Canceling orders

Description

Cancel an order. Only active trade orders and email tranfers may be canceled.

Endpoint
methodpathauthorization
DELETE/api/v1/user/orders/{UUID}/canceloauth2 (scope: trading)
Example
$ curl "https://paymium.com/api/v1/user/orders/968f4580-e26c-4ad8-8bcd-874d23d55296"         \
     -X DELETE --header "Authorization: Bearer ACCESS_TOKEN"

Bitcoin addresses

Description

List and create bitcoin deposit addresses

Endpoint
methodpathauthorization
GET/api/v1/user/addressesoauth2 (scope: deposit)
GET/api/v1/user/addresses/:btc_addressoauth2 (scope: deposit)
POST/api/v1/user/addressesoauth2 (scope: deposit)
Examples

Retrieve your Bitcoin deposit addresses along with their expiration timestamp.

$ curl "https://paymium.com/api/v1/user/addresses"         \
     --header "Authorization: Bearer ACCESS_TOKEN"
[
  {
    "address": "1PzU1ERAnHJmtU8J3qq3wwJhyLepwUYzHn",
    "valid_until": 1402579836
  }
]

Retrieve details for a single address.

$ curl "https://paymium.com/api/v1/user/addresses/1PzU1ERAnHJmtU8J3qq3wwJhyLepwUYzHn"         \
     --header "Authorization: Bearer ACCESS_TOKEN"
{
  "address": "1PzU1ERAnHJmtU8J3qq3wwJhyLepwUYzHn",
  "valid_until": 1402579836
}

Create a new Bitcoin deposit address unless another one is already active.

$ curl -X POST "https://bitcoin-central.net/api/v1/user/addresses" \
     --header "Authorization: Bearer ACCESS_TOKEN"
{
  "address": "1PzU1ERAnHJmtU8J3qq3wwJhyLepwUYzHn",
  "valid_until": 1402579836
}

Price alerts

Description

Register a mobile device for alerts on price movements.

Endpoint
methodpathauthorization
GET/api/v1/user/price_alertsoauth2 (scope: activity)
POST/api/v1/user/price_alertsoauth2 (scope: activity)
DELETE/api/v1/user/price_alerts/:idoauth2 (scope: activity)
Examples

Retrieve currently active price alerts.

$ curl "https://paymium.com/api/v1/user/price_alerts" \
     --header "Authorization: Bearer ACCESS_TOKEN"
[
  {
    "id": 42,
    "token": "0ff2f39d-cd9f-4710-9eb5-3f8385f5e059",
    "notify_above": 220.5,
    "notify_below": 180.0,
    "last_sent_at": 1445610041
  }
]

Create a new price alert.

$ curl "https://paymium.com/api/v1/user/price_alerts"     \
     -X POST                                              \
     --header "Authorization: Bearer ACCESS_TOKEN"        \
     -d "token=0ff2f39d-cd9f-4710-9eb5-3f8385f5e059"      \
     -d "notify_below=100"                                \
     -d "notify_above=110"                                \

If successful, it responds with a HTTP/1.1 201 Created status code.

Merchant API

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.

Payment creation

Authentication

The "merchant token" authentication mechanism has been removed please use an API token or an OAuth2 token instead with the "merchant" scope.

Description

A payment is created by a merchant platform when the customer chooses Bitcoin as his desired checkout option.

The merchant platform can then :

To display the payment request to the user, the https://paymium.com/invoice/{UUID} can be used, this is used by the e-commerce framework plugins.

<p align="center"> <img src="https://raw.githubusercontent.com/Paymium/api-documentation/master/display-invoice.png" /> </p>

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.

Endpoint
methodpathauthorization
POST/api/v1/merchant/create_paymentoauth2 (scope: merchant)
Parameters
namedescriptionexample value
amountAmount requested for the payment (required)20
payment_splitPercentage of the payment the merchant will get in currency expressed as a two-decimal places float between 0 and 1 (required)1.0
currencyCurrency in which the merchant wishes to be credited and in which the amount is expressed (required)EUR
callback_urlMerchant callback URL, it is called when the state of the payment changes (optional)http://myonlineshop/payments/order-987978/callback
redirect_urlURL to which the customer should be redirected at upon payment (optional)http://myonlineshop/payments/order-987978/success
merchant_referenceArbitrary merchant data associated to the payment (optional)order-987978
Response

See Payment properties

Payment callbacks

When a payment is created or updated, and if a callback URL was provided, a notification is made.

When the notification is made a POST request is made to the callback URL, it contains the JSON representation of the payment (see the payment properties).

The merchant should ensure the callback is legitimate by requesting confirmation from the Paymium API for the invoice data.

Note : The callback notifications are not guaranteed to be unique, it must have idempotent results on the merchant side if the payment has not actually changed.

Get payment information

This endpoint returns the payment request as a JSON object given a payment UUID

Endpoint
MethodPath
GET/api/v1/merchant/get_payment/{UUID}
Returned JSON object properties
NameDescription
uuidPayment UUID
currencyCurrency in which the currency_amount is expressed
payment_splitPercentage of the payment the merchant will get in currency
stateSee payment states
callback_urlMerchant notification URL
redirect_urlRedirection url to which the customer is redirected on success
merchant_nameName of the merchant that is displayed to the customer
expires_atExpiration timestamp
merchant_referenceReference string associated to the payment
amountAmount associated to the payment
btc_amountBTC amount to pay
payment_addressPayment address
created_atCreation timestamp
updated_atLast update timestamp
account_operationsAccount operations made against the merchant account

Example

{
    "account_operations": [
        {
            "amount": 25.0,
            "created_at": "2014-05-15T10:19:21.000Z",
            "created_at_int": 1400149161,
            "currency": "EUR",
            "is_trading_account": false,
            "name": "merchant_currency_payment",
            "uuid": "afca953b-dfa6-40b6-b856-c04d548baefb"
        }
    ],
    "amount": 25.0,
    "btc_amount": 0.079945,
    "callback_url": "http://mysite.com/wc-api/WC_Paymium/",
    "cancel_url": "http://mysite.com/commande/panier/",
    "comment": null,
    "created_at": 1400147834,
    "currency": "EUR",
    "expires_at": 1400148734,
    "merchant_name": "Demo SAS",
    "merchant_reference": "888",
    "payment_address": "1NHRnMn1831D84owh7powxtAbqfzA9aaL5",
    "payment_split": 1.0,
    "redirect_url": "http://mysite.com/order/checkout/order-received/888?key=wc_order_53784&order=888",
    "state": "paid",
    "updated_at": 1400149161,
    "uuid": "f8e7c539-7b7b-4b63-9ccf-5fc2ca91bf0b"
}

E-commerce frameworks plugins

The currently available plugins are available

FrameworkPlugin URL
PrestaShop 1.6https://github.com/Paymium/prestashop
WooCommercehttps://github.com/Paymium/woocommerce

Appendix

Currencies

The following currencies are available:

symbolcurrency
EUREuro
BTCBitcoin

Order types

Orders can have the following types:

typedescription
WireDepositwire (fiat) deposit
BitcoinDepositBTC deposit
LimitOrderlimit trade order
TransferBTC or fiat transfer or withdraw
EmailTransferBTC or fiat transfer by e-mail
AdminOrderspecial order executed by an admin

Order properties

All order types share generic properties.

Each type may have additional properties as described below.

Generic order properties
namedescriptionexample value
uuidunique id"968f4580-e26c-4ad8-8bcd-874d23d55296"
typeorder type"Transfer"
currencycurrency"BTC"
created_atdate created"2013-10-24T10:34:37.000Z"
updated_atdate updated"2013-10-22T19:12:02.000Z"
amountcurrency amount1.0
stateorder state"executed"
currency_feecurrency fee collected0.0
btc_feeBTC fee collected0.0
commentoptional comment
account_operationsan array of account operations executed
Market order specific properties
namedescriptionexample value
directiontrade direction ("buy" or "sell")"buy"
priceprice per BTC620.0
traded_currencycurrency exchanged310.0
traded_btcBTC echanged0.5
EmailTransfer specific properties
namedescriptionexample value
email_addressemail address of the receiver"user@example.com"

Order states

namedescription
pending_executionorder is queued and pending execution
pendingorder is pending, such as an unconfirmed withdrawal
processingorder is processing
authorizedorder has been authorized, such as a confirmed withdrawal
activeorder is active, such as a trade order in the order book
filledorder has been completely filled
executedorder has been executed
canceledorder has been canceled

Email Transfer states

NameDescription
pendingEmail Transfer is pending the email confirmation
pending_collectionEmail Transfer queued and pending for the receiver registration and profile completion
executedEmail Transfer has been executed
expiredEmail Transfer has expired
canceledEmail Transfer has been canceled

Payment states

NameDescription
pending_paymentWaiting for payment
processingThe correct amount has been received, waiting for a Bitcoin network confirmation
paidPayment completed, the requested amount has been credited to the merchant account
errorAn error has occurred, the merchant must get in touch with the support
btc_forwardedDue to an incorrect paid, the received funds could not be converted and have been credited directly to the merchant
expiredPayment expired, no Bitcoins were received

Account operation properties

namedescriptionexample value
uuidunique id"a940393b-4d2f-4a5a-8a0a-3470d7419bad"
currencycurrency"BTC"
namename of operation"account_operation"
created_atdate created"2013-10-22T14:30:06.000Z"
created_at_inttimestamp1382452206
amountcurrency amount49.38727114
addressbitcoin address if any"1FPDBXNqSkZMsw1kSkkajcj8berxDQkUoc"
tx_hashbitcoin transaction hash if any"86e6e72aa559428524e035cd6b2997004..."
is_trading_accountwhether the trading account is targetedfalse

Ruby example

This example uses the OAuth2 Ruby gem.

The AutoRefreshToken class encapsulates this logic, it is available as a Gist.

require 'oauth2'

client = OAuth2::Client.new('6fcf1c32f6e14cd773a7a6640832bdbf83a5b2b8d4382e839c6aff83a8f1bb3b', '55554ecad5627f0465034c4a116e59a38d9c3ab272487a18404078ccc0b64798', site: 'https://paymium.com', authorize_url: '/api/oauth/authorize', token_url: '/api/oauth/token')

client.auth_code.authorize_url(redirect_uri: 'https://paymium.com/page/oauth/test', scope: 'basic activity trade withdraw')
 => "https://staging.paymium.com/api/oauth/authorize?response_type=code&client_id=71a28131e16a0d6756a41aa391f1aa28b2f5a2ed4a6b911cf2bf640c8a0cc2cd&redirect_uri=https%3A%2F%2Fstaging.paymium.com%2Fpage%2Foauth%2Ftest&scope=basic+activity+trade+withdraw"

# Visit this URL in your browser, approve the request and copy the authorization code

authorization_code = '9b55e27c840f59d927284fdc438ee3d8fac94b00e24d331162ddff76c1a6bcc0'

token = client.auth_code.get_token(authorization_code, redirect_uri: 'https://paymium.com/page/oauth/test')

token.get('/api/v1/user').body
=> {"name":"BC-U123456","locale":"en","balance_btc":117.56672217,"locked_btc":0.0,"balance_eur":0.0,"locked_eur":0.00995186}