Integration guide (testnet)

This guide will walk you step by step to integrate with our API and assumes no prior BitcoinPaygate API knowledge.

Obtaining API key

Contact our support for Merchant creation in our system

Our support is going to create account in client panel, which is needed to obtain secret API key for API access. You have to provide an e-mail address, which you will be able to access during the whole integration process.

After the account is created in our system you'll receive an e-mail message to verify your e-mail. Please do it before proceeding.

Create API key in client panel

API keys are needed to connect to BPG API.

First time in client panel

Client panel: https://panel-demo.bitcoinpaygate.com

  1. Before first login you have to reset your password, using Don't remember your password? link on login page. Provide e-mail address that was used for Merchant creation when our support created merchant account for you. Be sure to have access to provided e-mail, as you will receive link to reset your password. Reset password

  2. Check received e-mail, click provided link and enter new password Reset password

  3. Now you have set your password, so follow to next section

Create API keys

  1. Login to client panel using e-mail provided to our support and password that was set during first login.

  2. Go to My API keys section in menu on the left side of the web page. My API keys

  3. Click New API key button. New api key

  4. Provide API key Name that describes the purpose of the API key for you. You should use only letters, numbers and underscore. Create api key

  5. Click Create API key

  6. You will see a popup that shows your newly created API key. It's very important to store it in some safe place as we will not be able to restore this API key secret for you. It's never stored as plain text in our system. Your API key number

  7. Click I saved API Key

  8. The pair containing the name and secret of API key will be needed to use our API.

Create payments via BitcoinPaygate API

In this document httpie tool https://httpie.org/ is used to show how to send requests to BPG API. Please use your favorite tool or programming language to do it.

Basic information about the requests

  • To authorize in BPG API you have to use basic auth over https. Use API key name as username and API key secret as password.
  • The url to demo environment is: https://api-demo.bitcoinpaygate.com/v2/.

  • All available endpoints are described in API requests section (jump to it using Table of contents) and in swagger doc

Example

➜ http -v -a oneKey_toRule_themAll:LrcyXoeFF35Okc2XWduJc0a30O8ixZZ9 POST https://api-demo.bitcoinpaygate.com/v2/payments/new amount=9.99 currency=USD notificationUrl="http://localhost:8888/helloPayment" message="Test payment abc" merchantTransactionId="123456789abcdef"

Replace oneKey_toRule_themAll:LrcyXoeFF35Okc2XWduJc0a30O8ixZZ9 with <API_KEY_NAME>:<API_KEY_SECRET>

Httpie tool produces such request:

POST /v2/payments/new HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Authorization: Basic b25lS2V5X3RvUnVsZV90aGVtQWxsOkxyY3lYb2VGRjM1T2tjMlhXZHVKYzBhMzBPOGl4Wlo5
Connection: keep-alive
Content-Length: 169
Content-Type: application/json
Host: api-demo.bitcoinpaygate.com
User-Agent: HTTPie/0.9.9

{
    "amount": "9.99",
    "currency": "USD",
    "merchantTransactionId": "123456789abcdef",
    "message": "Test payment abc",
    "notificationUrl": "http://localhost:8888/helloPayment"
}

and request will look similar to:

HTTP/1.1 200 OK
Connection: keep-alive
Content-Encoding: gzip
Content-Security-Policy: script-src 'self'; object-src 'self'
Content-Type: application/json
Strict-Transport-Security: max-age=15768000
Transfer-Encoding: chunked
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block

{
    "address": "2Mt5mwbNiX3ndxNiFSEftzcnTmht5rzeo8d",
    "amount": 0.00098911,
    "expirationTime": "2018-01-16T22:38:35.066Z",
    "label": "oneKey_toRule_themAll",
    "merchantTransactionId": "123456789abcdef",
    "message": "Test payment abc",
    "paymentAddress": "bitcoin:2Mt5mwbNiX3ndxNiFSEftzcnTmht5rzeo8d?amount=0.00098911&label=oneKey_toRule_themAll&message=Test+payment+abc",
    "paymentId": "d88b9898dbfa4df8a499f70def52e4bb1ffbd04b3feb45ef82a9beea7d9cc76e",
    "paymentPageUrl": "https://payments.bitcoinpaygate.com/d88b9898dbfa4df8a499f70def52e4bb1ffbd04b3feb45ef82a9beea7d9cc76e"
}

Using clients and libraries provided by BitcoinPaygate

API Clients and demos