Skip to content

alcoldev/acpay-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

ACPAY API

The ACPAY API will provide access to our payment services and information to our sellers.
API calls are implemented as HTTP POST calls to https://api.acpay.com/v1/

API Version: v1.0

API Setup

The only setup needed is to go to the API Keys page and generate an API key. You will be given a secret and public key used to authenticate your API calls. Make sure you don't share your secret key with any 3rd parties!

API Request

API calls are made as basic HTTP POST requests using the following variables: (note: The POST data is regular application/x-www-form-urlencoded style data, not JSON or XML)

Authentication:

Every API call has a SHA-512 HMAC signature generated with your secret key. Our server generates it's own HMAC signature and compares it with the API caller's. If they don't match the API call is discarded. The HMAC signature is sent as a HTTP header called 'HMAC'.

The HMAC signature is created from the full raw POST data of your request. For example if your API secret key was "api_secret_key" and public key was "api_public_key" and you were using the get_payment_address function the raw request might look like:

currency=btc&key=api_public_key&request=get_deposit_address

and the HMAC would be:

8bee1a1a2bd1d24d70ddbcc5ce30e9fb3220e051f72aed285f77ff60bdb12aa8268fb9739944207f1d1219149f3210f6cdac7d463fb34e8f7a4d4619b5ea099a

API Response

The API will return an array with 1 or 2 elements: 'valid' and 'result'. The result will always have an 'valid' field. If its value is 'true' (boolean) the API call was a success, otherwise it will contain an error message. If there is data to return to you, it will be stored as an array in the 'result' element.

Success example:

{
    "valid":true,
    "result": {
        "address": "0x..."
    }
}

Failed example:

{
    "valid":false,
    "errors": [{
        "message": "Missing required param",
        "fields":["currency"]
    }]
}

Multiple Currencies

Once registered, you can manage the currencies you want to integrate in the Membership area / Currencies. Please enable the currencies there before using this API.

Support crypto currencies:

ID Symbol Name Status
eth ETH Ethereum Available
bdc BDC Bdcoin Available
ttc TTC Test Token Available
btc BTC Bitcoin Maintenance
ltc LTC Litecoin Maintenance
bch BCH Bitcoin Cash Maintenance
usdt USDT Tether Maintenance
dash DASH Dash Maintenance
zec ZEC Zcash Maintenance
qtum QTUM Qtum Maintenance
alc ALC Alcash Maintenance

Support fiat currencies:

ID Symbol Name Status
usd USD US Dollar Available
eur EUR Euro Available
cny CNY Chinese Yuan Available

API Call

All POST requests must be send to the url below, including the HMAC authentication code. https://api.acpay.com/v1/

PHP Example:

https://github.com/alcoldev/acpay-api/blob/master/php/AcpayAPI.class.php

Get Currencies

Parameters:

API POST Fields (in addition to the Main Fields described in the API Request)

Field Description Required
request currencies Yes

Example request:

POST: key=api_public_key&request=currencies

Response:

The API always responds with a JSON string. [data] collection contains the important values:

Response example:

{
    "valid": true,
    "result": {
        "btc": {
            "name": "Bitcoin",
            "symbol": "BTC",
            "enable": true
        }
    }
}

Get Rates

Parameters:

API POST Fields (in addition to the Main Fields described in the API Request)

Field Description Required
request rates Yes
currency Fiat currency to accept (usd) No

Example request:

POST: key=api_public_key&request=rates&currency=usd

Response:

The API always responds with a JSON string. [data] collection contains the important values:

Response example:

{
    "valid": true,
    "result": {
        "usd": {
            "btc": {
                "rate": 6702.33928172,
                "last_update": 1539288831
            },
            "eth": {
                "rate": 305.22915962,
                "last_update": 1539288831
            }
        }
    }
}

Get Deposit Address

Parameters:

API POST Fields (in addition to the Main Fields described in the API Request)

Field Description Required
request get_deposit_address Yes
currency Crypto currency id Yes
callback Callback true or false (Default: false) No
callback_url URL for your callbacks. If not set it will use the callback url in your Edit Settings page if you have one set. No
custom_field Custom Field (Maximum length: 50). No

Example request:

POST: key=api_public_key&request=get_deposit_address&currency=btc&callback=true

Response:

The API always responds with a JSON string. [data] collection contains the important values:

  • [address] is the deposit address to show to the customer.

Response example:

{
    "valid": true,
    "result": {
        "address": "0x2073eb3be1a41908e0353427da7f16412a01ae71"
    }
}

Get Deposit UI:

Create Withdrawal

Parameters:

API POST Fields (in addition to the Main Fields described in the API Request)

Field Description Required
request create_withdrawal Yes
currency Crypto currency id Yes
amount The amount of the withdrawal in the currency below. Yes
address Receiving crypto-currency address Yes
callback Callback true or false (Default: false) No
callback_url URL for your callbacks. If not set it will use the callback url in your Edit Settings page if you have one set. No
custom_field Custom Field (Maximum length: 50). No

Example request:

POST: key=api_public_key&request=create_withdrawal&currency=btc&amount=1.2&address=0x...&callback=true&callback_url=https://www.test.com/payment/callback.php&custom_field=U929281

Response:

The API always responds with a JSON string. [data] collection contains the important values:

  • [ref_id] is the Withdrawal Unique Reference Number of acpay backoffice.

Response example:

{
    "valid": true,
    "result": {
        "ref_id": "793d6f37dbd811e88ace0af998f8ac2c"
    }
}

Callback

A callback is sent every time a new block is mined. To stop further callbacks, reply with the "[OK]" Text. See code sample below.

Field Description Value
id Callback identifier  
version API version  
auth Callback authentication hmac
type Callback type deposit, withdrawal
status Callback / Transaction Status (see table below for details)
currency Crypto currency id btc, eth, ltc, usdt, bch, bdc, alc, ttc ...
ref_id Identifier of acpay console transaction  
transaction_hash Blockchain Transaction hash  
transaction_amount Blockchain Transaction amount  
transaction_to To address  
confirmations Confirmation count of transaction  
custom_field Custom Field  

Callback example:

{
    "id": "a514e32fcae48631f66c472d999aa0dd",
    "version": "1",
    "auth": "hmac",
    "type": "deposit",
    "status": "200",
    "currency": "btc",
    "ref_id": "9f1a7ec862ba0d44413e71fc5aa936c3",
    "transaction_hash": "a321022f8ba56e6fbb3195123d266905757219ae0f625eb29fec48dc018269df",
    "transaction_amount": "1.2",
    "transaction_to": "3A364JM2HEjuWrhBKC6phyDMFSFcWzHzKQ",
    "confirmations": "3",
    "custom_field": ""
}

PHP Example:

https://github.com/alcoldev/acpay-api/blob/master/php/callback.php

Callback Status Code

Code Text Description
100 Pending Transaction not included in the blockchain
101 Waiting Wait for user or merchant confirmation
102 In progress Transaction included in block
103 Cancel Transaction Canceled
200 Completed Secure confirmation / Transaction complete
201 Confirmed Minimal secure confirmation

Rules / Fees

Currency Minimum Deposit Minimum Withdrawal Deposit Fee Withdrawal Fee
eth 0.01 ETH 0.05 ETH No deposit fee 0.005 ETH
bdc 20 BDC 100 BDC No deposit fee 10 BDC
ttc 2 TTC 10 TTC No deposit fee 1 TTC

Request Limit

The system is designed to process thousands of transactions per second, so we do not limit the number of payments you can process. However, for DDoS protection reasons, the API calls are limited to 1000 per minute from one IP.

What to use as a payout address?

You will need payout addresses for all crypto currencies you want to accept. Only you will have access to your payout wallets. You can use any online wallet, service or exchange of your choice. If you don't have one, consider reading our Wallet Guide

About

Acpay Payment API: Accept Bitcoin, Ethereum, Litecoin, Bdcoin, Alcash

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages