Introduction
Common
This is a documentation for public https://cryptoprocessing.io service. Before using this API you need to get API keys of the related page in your personal account.
Idempotent Requests
curl "https://cryptoprocessing.io/api/v1/ping" \
-H "Authorization: Token <token>" \
-H "Idempotency-Key: 60Nk1zqhQJDoFnKj"
The API supports idempotency for safely retrying requests without accidentally performing the same operation twice. For example, if a request to create a charge fails due to a network connection error, you can retry the request with the same idempotency key to guarantee that only a single charge is created.
GET
and DELETE
requests are idempotent by definition, meaning that the same backend work will occur no matter how many times the same request is issued. You shouldn't send an idempotency key with these verbs because it will have no effect.
To perform an idempotent request, provide an additional Idempotency-Key:
How you create unique keys is up to you, but we suggest using V4 UUIDs or another appropriately random string. We'll always send back the same response for requests made with the same key, and keys can't be reused with different request parameters. Keys expire after 24 hours.
Request IDs
Each API request has an associated request identifier. You can find this value in the response headers, under Request-Id
. You can also find request identifiers in the URLs of individual request logs in your Dashboard. If you need to contact us about a specific request, providing the request identifier will ensure the fastest possible resolution.
Pagination
All top-level API resources have support for bulk fetches via "list" API methods. For instance, you can list transactions, wallets. These list API methods share a common structure, taking at least these two parameters: page
and limit
.
Argument | Description |
---|---|
page |
Pagination starts at page 1, not at page 0 (page 0 will return the same results as page 1) |
limit |
A limit on the number if objects to be returned. (default 25, max 100) |
Dates
All dates should be passed and will be formatted according with iso8601
- YYYY-MM-DDTHH:mm:ss.sssZ
(ex. 2018-04-10T14:48:00.000Z
)
Errors
Processing uses conventional HTTP response codes to indicate the success or failure of an API request. In general: Codes in the 2xx
range indicate success. Codes in the 4xx
range indicate an error that failed given the information provided (e.g., a required parameter was omitted, a charge failed, etc.). Codes in the 5xx
range indicate an error with processing's servers (these are rare).
Some 4xx
errors that could be handled programmatically (e.g., a card is declined) include an error code that briefly explains the error reported.
Processing API uses the following error codes:
Error Code | Meaning |
---|---|
400 | Bad Request -- Your request is invalid. |
401 | Unauthorized -- Your API key is wrong. |
403 | Forbidden -- The requested is not authorized. |
404 | Not Found -- Resource could not be found. |
405 | Method Not Allowed -- You tried to access resource with an invalid method. |
406 | Not Acceptable -- You requested a format that isn't json. |
410 | Gone -- The resource requested has been removed from our servers. |
429 | Too Many Requests -- You're requesting too frequently! Slow down! |
500 | Internal Server Error -- We had a problem with our server. Try again later. |
503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. |
Signing API requests
Key generation
The client on his side generates a public and private key based on the RSA256 algorithm. After that it sends only the public key to eugene@cryptoprocessing.io, this key will be used to validate all requests. Unsigned requests will be rejected.
Create request signature
Sample code for creating a signature:
Base64.strict_encode64(OpenSSL::PKey::RSA.new(YOUR_PRIVATE_KEY).private_encrypt(Digest::SHA256.hexdigest("#{API_KEY}#{URL}#{BODY_STR}")))
The signature is added to the Sign header of the request.
Sample code to add a Sign header:
post URL, params: JSON.load(BODY_STR), as: :json, headers: {
"Content-Type": "application/json",
"Authorization": "Token #{API_KEY}",
"Sign": Base64.strict_encode64(OpenSSL::PKey::RSA.new(YOUR_PRIVATE_KEY).private_encrypt(Digest::SHA256.hexdigest("#{API_KEY}#{URL}#{BODY_STR}")))
}
Variable | Meaning |
---|---|
YOUR_PRIVATE_KEY | private key |
API_KEY | key generated in your account |
URL | request URL (for example, https://cryptoprocessing.io/api/v1/ping) |
BODY_STR | request body, if any |
Invoice processing
Invoice object
Example
{
"id": "3cc95f4b-8b14-4c02-95e2-0002b77caa4d",
"store_id": "8f314370-83ab-4c00-8c77-c9874d4b2a6a",
"amount": "1001.54",
"currency": "EUR",
"status": "NEW",
"success_redirect_url": "https://example.com/process/success",
"error_redirect_url": "https://example.com/process/error",
"created_at": "2020-12-28T10:10:34.791Z",
"updated_at": "2020-12-28T10:10:34.791Z",
"customer_email": "customer@example.com",
"btc_address": "2N84FHPk745t1Ws7vjTX2V4UTvDtwMVfzQq",
"btc_amount": "0.045762499579444076",
"btc_rate": "0.000045692133693556",
"usd_amount": "1181.8172",
"usd_rate": "1.18"
}
Attributes:
Attribute | Description |
---|---|
id |
Invoice ID |
store_id |
Store ID |
amount |
Amount set at invoice creation |
currency |
Settlement currency, available values: "EUR", "USD", "BTC" |
status |
Available statuses: "NEW", "PAID" |
success_redirect_url |
Redirect url for paid invoice |
error_redirect_url |
URL for "RETURN TO STORE" link |
created_at |
Time of creation |
updated_at |
Time of updating |
customer_email |
Customer email |
btc_address |
BTC address |
btc_amount |
BTC amount |
btc_rate |
BTC per settlement currency |
usd_amount |
USD amount |
usd_rate |
USD per settlement currency |
Create invoice
POST https://cryptoprocessing.io/api/v1/checkout/stores/:store_id/invoices
Example request
curl --location --request POST 'https://cryptoprocessing.io/api/v1/checkout/stores/8f314370-83ab-4c00-8c77-c9874d4b2a6a/invoices' \
--header 'Content-Type: application/json' \
--header 'Authorization: Token <token>' \
--data-raw '{
"amount": "1001.54",
"currency": "EUR",
"customer_email": "customer@example.com",
"success_redirect_url": "https://example.com/process/success",
"error_redirect_url": "https://example.com/process/error"
}'
The above command returns JSON structured like this:
{
"id": "165152de-4fde-4c40-ab3e-354a580c8e99",
"store_id": "8f314370-83ab-4c00-8c77-c9874d4b2a6a",
"amount": "1001.54",
"currency": "EUR",
"status": "NEW",
"success_redirect_url": "https://example.com/process/success",
"error_redirect_url": "https://example.com/process/error",
"created_at": "2020-12-30T12:49:49.899Z",
"updated_at": "2020-12-30T12:49:49.899Z",
"customer_email": "customer@example.com",
"btc_address": "2N9HjtJZLvoiZ4kpXnJv9nGPSAYydEQhJQW",
"btc_amount": "0.044237474907194096",
"btc_rate": "0.000044169453948114",
"usd_amount": "1181.8172",
"usd_rate": "1.18"
}
Show invoice
GET https://cryptoprocessing.io/api/v1/checkout/stores/:store_id/invoices/:invoice_id
Example request
curl --location --request GET 'http://cryptoprocessing.io/api/v1/checkout/stores/8f314370-83ab-4c00-8c77-c9874d4b2a6a/invoices/7e0eea17-5433-4879-b0e0-52081fbf7431' \
--header 'Content-Type: application/json' \
--header 'Authorization: Token <token>'
The above command returns JSON structured like this:
{
"id": "165152de-4fde-4c40-ab3e-354a580c8e99",
"store_id": "8f314370-83ab-4c00-8c77-c9874d4b2a6a",
"amount": "1001.54",
"currency": "EUR",
"status": "NEW",
"success_redirect_url": "https://example.com/process/success",
"error_redirect_url": "https://example.com/process/error",
"created_at": "2020-12-30T12:49:49.899Z",
"updated_at": "2020-12-30T12:49:49.899Z",
"customer_email": "customer@example.com",
"btc_address": "2N9HjtJZLvoiZ4kpXnJv9nGPSAYydEQhJQW",
"btc_amount": "0.044237474907194096",
"btc_rate": "0.000044169453948114",
"usd_amount": "1181.8172",
"usd_rate": "1.18"
}
Invoice webhook
Callback object
Example
{
"id": "165152de-4fde-4c40-ab3e-354a580c8e99",
"store_id": "8f314370-83ab-4c00-8c77-c9874d4b2a6a",
"amount": "1001.54",
"currency": "EUR",
"status": "PAID",
"success_redirect_url": "https://example.com/process/success",
"error_redirect_url": "https://example.com/process/error",
"created_at": "2020-12-30T12:49:49.899Z",
"updated_at": "2020-12-30T12:49:49.899Z",
"customer_email": "customer@example.com",
"btc_address": "2N9HjtJZLvoiZ4kpXnJv9nGPSAYydEQhJQW",
"btc_amount": "0.044237474907194096",
"btc_rate": "0.000044169453948114",
"usd_amount": "1181.8172",
"usd_rate": "1.18"
}
Callbacks is used to sent notifications once invoice is updated.
Deactivate invoice
PUT https://cryptoprocessing.io/api/v1/checkout/invoices/:invoice_id/deactivate
Example request
curl -X PUT 'https://cryptoprocessing.io/api/v1/checkout/invoices/8f314370-83ab-4c00-8c77-c9874d4b2a6a/deactivate' \
-H 'Content-Type: application/json' \
-H 'Authorization: Token <token>' \
-d ''
The above command returns JSON structured like this:
{
"id": "165152de-4fde-4c40-ab3e-354a580c8e99",
"store_id": "8f314370-83ab-4c00-8c77-c9874d4b2a6a",
"amount": "1001.54",
"currency": "EUR",
"status": "NEW",
"success_redirect_url": "https://example.com/process/success",
"error_redirect_url": "https://example.com/process/error",
"created_at": "2020-12-30T12:49:49.899Z",
"updated_at": "2020-12-30T12:49:49.899Z",
"customer_email": "customer@example.com",
"btc_address": "2N9HjtJZLvoiZ4kpXnJv9nGPSAYydEQhJQW",
"btc_amount": "0.044237474907194096",
"btc_rate": "0.000044169453948114",
"usd_amount": "1181.8172",
"usd_rate": "1.18",
"activated": false
}
Activate invoice
PUT https://cryptoprocessing.io/api/v1/checkout/invoices/:invoice_id/activate
Example request
curl -X PUT 'https://cryptoprocessing.io/api/v1/checkout/invoices/8f314370-83ab-4c00-8c77-c9874d4b2a6a/activate' \
-H 'Content-Type: application/json' \
-H 'Authorization: Token <token>' \
-d ''
The above command returns JSON structured like this:
{
"id": "165152de-4fde-4c40-ab3e-354a580c8e99",
"store_id": "8f314370-83ab-4c00-8c77-c9874d4b2a6a",
"amount": "1001.54",
"currency": "EUR",
"status": "NEW",
"success_redirect_url": "https://example.com/process/success",
"error_redirect_url": "https://example.com/process/error",
"created_at": "2020-12-30T12:49:49.899Z",
"updated_at": "2020-12-30T12:49:49.899Z",
"customer_email": "customer@example.com",
"btc_address": "2N9HjtJZLvoiZ4kpXnJv9nGPSAYydEQhJQW",
"btc_amount": "0.044237474907194096",
"btc_rate": "0.000044169453948114",
"usd_amount": "1181.8172",
"usd_rate": "1.18",
"activated": true
}