NAV Navbar

Xpresslitecoin

shell ruby python javascript

Introduction

Welcome to Xpresslitecoin API. We provides you with a plethora of api methods that you can use to integrate with your applicatio in order to accept Litecoin payments. While designing the api we have cared for its usability for you as its consumer, and hence we have made it as simple for you to use.

We have examples in Shell, Ruby, Python, and JavaScript! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.

Authentication

To authorize, use this code:

require 'rubygems'
require 'excon'

api = Excon.new("https://xpresslitecoin.com/api1.0/",
    :debug_request => true,
    :debug_response => true,
    :persistent => true)
api.get(:path => '/test/',
        :headers => {'Authorization' => 'Token your_authorizationToken'})
import requests

session = requests.session()
loginSession = session.get('https://xpresslitecoin.com/api1.0/test/',
                headers={'Authorization': 'Token your_authorizationToken'})
# With shell, you can just pass the correct header with each request
http GET https://xpresslitecoin.com/api1.0/test/
  'Authorization: Token your_authorizationToken'
const request = require('request');

request.get("https://xpresslitecoin.com/api1.0/test/",
        {"headers":{'Authorization':"Token your_authorizationToken"}},
        function(err,HttpResponse,body){

        });

Make sure to replace your_authorizationToken with your API key.

Xpresslitecoin uses API keys to allow access to the API. You can get your API key from your dashboard.

Xpresslitecoin expects for the API key to be included in all API requests to the server in a header that looks like the following:

Authorization: your_authorizationToken

Transaction

Create Transaction

require 'rubygems'
require 'excon'

api = Excon.new("https://xpresslitecoin.com/api1.0",
    :debug_request => true,
    :debug_response => true,
    :persistent => true)
api.post(:path => '/transaction/create/',
        :body => 'amount=0.52',
        :headers => {'Authorization' => 'Token your_authorizationToken'})
import requests

session = requests.session()
loginSession = session.get('https://xpresslitecoin.com/api1.0/test/',
                headers={'Authorization': 'Token your_authorizationToken'})
createTransaction =  session.post('https://xpresslitecoin.com/api1.0/transaction/create/',
                        data={'amount':0.52})
http -f POST https://xpresslitecoin.com/api1.0/transaction/create/
  'Authorization: Token your_authorizationToken' amount=0.52
const request = require('request');

request.post("https://xpresslitecoin.com/api1.0/transaction/create/",
        {"headers":{'Authorization':"Token your_authorizationToken"},
        form:{amount:0.52}},
        function(err,HttpResponse,body){

        });

The above command returns JSON structured like this:


{
    "amount": "0.52",
    "ltcaddress": "QcNXa4PYKKJScB3zK7meJRXjvpvwhoWQHY",
    "transaction_id": "0a26adc9-cec8-40f8-ab34-1212b3449356"
}

This endpoint create a transaction.

HTTP Request

POST https://xpresslitecoin.com/api1.0/transaction/create/

POST Parameters

Parameter Description
amount The amount in LTC you want to create the transaction.(should be > than 0.009)

It is expected to create one transaction per your business transaction. For example if two of your customers buys an article on your website, you should create two transaction. There is no need to create multiple transactions for each quantity of item of a sale. For example customer (A) buys an article from your website which cost 0.01 ltc and sets its quantity to 3, then there is no need to generate 3 transactions of 0.01 ltc you can generate a single transaction of 0.03 ltc.

Check if confirmed

require 'rubygems'
require 'excon'

api = Excon.new("https://xpresslitecoin.com/api1.0",
    :debug_request => true,
    :debug_response => true,
    :persistent => true)
api.get(:path => '/transaction/isconfirmed/<ltcAddress>/',
        :headers => {'Authorization' => 'Token your_authorizationToken'})
import requests

session = requests.session()
loginSession = session.get('https://xpresslitecoin.com/api1.0/test/',
                headers={'Authorization': 'Token your_authorizationToken'})
checkIfConfirmed =  session.get('https://xpresslitecoin.com/api1.0/transaction/isconfirmed/<ltcAddress>/')
http -f GET https://xpresslitecoin.com/transaction/isconfirmed/<ltcAddress>/
  'Authorization: Token your_authorizationToken'
const request = require('request');

request.get("https://xpresslitecoin.com/api1.0/isconfirmed/<ltcAddress>/",
        {"headers":{'Authorization':"Token your_authorizationToken"}},
        function(err,HttpResponse,body){

        });

The above command returns JSON structured like this if confirmed:

{
    "Result": "confirmed"
}

If unconfirmed:

{
    "Result": "unconfirmed"
}

This endpoint retrieves check if payment is confirmed as per the "min confirmation" setting you selected in the dashboard.

HTTP Request

GET https://xpresslitecoin.com/api1.0/transaction/isconfirmed/<ltcAddress>

URL Parameters

Parameter Description
ltcAddress The ltcAddress you received while creating the transaction

Values posted to webhook if a transaction is confirmed

{
    "transactionID" : "[The transaction ID]",
    "transactionStatus" : "confirmed",
    "amount" : "[The amount received]",
    "amountreceivedto" : "[The ltc address on which the fund was received]"
}

Check Payout

require 'rubygems'
require 'excon'

api = Excon.new("https://xpresslitecoin.com/api1.0",
    :debug_request => true,
    :debug_response => true,
    :persistent => true)
api.get(:path => '/transaction/ispayout/<ltcAddress>/',
        :headers => {'Authorization' => 'Token your_authorizationToken'})
import requests

session = requests.session()
loginSession = session.get('https://xpresslitecoin.com/api1.0/test/',
                headers={'Authorization': 'Token your_authorizationToken'})
checkIfPayout =  session.get('https://xpresslitecoin.com/api1.0/transaction/ispayout/<ltcAddress>/')
http -f GET https://xpresslitecoin.com/api1.0/transaction/ispayout/<ltcAddress>/
  'Authorization: Token your_authorizationToken'
const request = require('request');

request.get("https://xpresslitecoin.com/api1.0/ispayout/<ltcAddress>/",
        {"headers":{'Authorization':"Token your_authorizationToken"}},
        function(err,HttpResponse,body){

        });

The above command returns JSON structured like this:

{
    "payoutDone": false,
    "payoutTransaction": ""
}

This endpoint check if a transaction has been paid out.

HTTP Request

GET https://xpresslitecoin.com/api1.0/ispayout/<ltcAddress>

URL Parameters

Parameter Description
ltcAddress The ltc address you want to check if has been paid out (the ltc address you received when the transaction was created)

Errors

Xpresslitecoin 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 api requested is hidden for administrators only.
404 Not Found -- The specified api could not be found.
405 Method Not Allowed -- You tried to access an api with an invalid method.
406 Not Acceptable -- You requested a format that isn't json.
410 Gone -- The api requested has been removed from our servers.
418 I'm a teapot.
429 Too Many Requests -- You're requesting too many api! 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.

Xpresslitecoinjs

With our xpresslitecoin javascript library, we provide you with a predefined template for accepting payments on your website, however if you wish to add your own custom buttons to your website you can make user of our API.

For more information about our Xpresslitecoinjs check our guide.