LivePay's Payment Widget documentation

 

Get the Order ID

The Api Livepay is a tool that will allow us to receive payments with cryptocurrencies. Payment will be made with a transfer from your customer's wallet to your wallet.

The first step is to generate the orderId that we will obtain it by sending the following data by POST to the API

API URL:   https://gw17.livepay.io/gw/genorderid
    
    Example:
    The data presented in this example will be explained below.

    coin_symbol            = "TBTC" // Bitcoin TestNet coin   
    currency_symbol        = "USB"    
    amount_f               = "100.00"
    invoice_id             = "5215544"
    fee_pay_b              = "0"
    version                = "1"
    key                    = "EVE3o-JP3al-wcGxj-6ufiM-xUyf9"    (Api Key)
    format                 = "json"
    ipn_url                = "https://testnotification.io"
    amount_c               = ""
    
    
            

Additionally we will send by headers a variable with the name x-livepay-auth-hmac, We will obtain the value of this variable in the following way:

    
    A. form a string by putting the POST variables as URL variables
    
    coin_symbol=TBTC&currency_symbol=USD&amount_f=100.00&invoice_id=pruebaconmartin03&fee_pay_by=0&ipn_url=https%3A%2F%2Fsite.com&version=1&key=EVE3o-JP3al-wcGxj-6ufiM-xUyf9&format=json
    
    
    B. Form a HASH with encryption SHA512 with the string of point A and use the key (Api Secret) in this encryption
    
    
    Example result:
    
    The API will return the result in a json
    
    
        {"error":"none","response":{"crypto_symbol":"TBTC","crypto_amount":"0.01923077","order_id":"7vpgoNVEyc5e"}}
    
    
    The value of the order_id will be used to execute the transfer of cryptocurrencies in another API execution
    

POST https://gw17.livepay.io/gw/genorderid

https://gw17.livepay.io/gw/genorderid

Headers

x-livepay-auth-hmac cb4f19e8e03f581e16a1c2ec65cbf67b4864a9c60dc553554a2688cdb5e69052e0465d14b7cad95515f984a58f48cfc8b6b1f50e06ac1fac0677fe12f2d0ab40
Content-Type application/x-www-form-urlencoded

Body

urlencoded
coin_symbol TBTC

It is the symbol of the cryptocurrency that you want to receive, in these moments we have the following assets BTC (Bitcoin), ETH (Ethereum), LTC (Litecoin) y TBTC (Bitcoin Testnet)

currency_symbol USD

It is the symbol of the fiat coin that you want to collect, it must be accompanied by amount_f and coin_symbol, the amount in fiat will be automatically converted to the coin_symbol that you choose

amount_f 100.00

Is the amount in fiat that you want to receive, must be accompanied by the parameters currency_symbol and coin_symbol, the amount in fiat will be automatically converted to the coin_symbol that you choose

invoice_id 0012566

Number or reference code

fee_pay_by 0

0: Seller 1: Buyer

version 2

API version

key EVE3o-JP3al-wcGxj-6ufiM-xUyf9

It's the Api Key

format json

The output format that the API will give us

ipn_url https://site.com

The Notification URL, if not set we will use the one you have set on your merchant information page.

amount_c 0

It is the amount in cryptocurrency that you want to receive, you must be a companion with a coin_symbol, it should NOT be used together with the amount_f and currency_simbol paramenters

Example Requesthttps://gw17.livepay.io/gw/genorderid
curl --location --request POST "https://gw17.livepay.io/gw/genorderid" \
                        --header "x-livepay-auth-hmac: cb4f19e8e03f581e16a1c2ec65cbf67b4864a9c60dc553554a2688cdb5e69052e0465d14b7cad95515f984a58f48cfc8b6b1f50e06ac1fac0677fe12f2d0ab40" \
                        --header "Content-Type: application/x-www-form-urlencoded" \
                        --data "coin_symbol=TBTC&currency_symbol=USD&amount_f=100.00&invoice_id=pruebaconmartin03&fee_pay_by=0&version=1&key=EVE3o-JP3al-wcGxj-6ufiM-xUyf9&format=json&ipn_url=https%3A//site.com&amount_c=0"
Important

1. If you are paid the equivalent in USD or EUR the variables will be handled like this, example:

currency_symbol = 'USD'
amount_f = 100
coin_symbol = 'BTC'

The system will arrange to change the 100 USD to BTC

2. If they pay you in cryptocurrency the variables will be handled like this, example:

coin_symbol = 'BTC'
amount_c = 0.000152


Generate the Widget

Obtained the orderId we proceed to implement the Widget with javascript.
    
        <center><script type="text/javascript" src="https://gw17.livepay.io/gw/paywidget/?orderId=getvalue"></script></center>
        
        Change the getvalue with the generated orderId and the widget with the required payment information is going will be shown.
        
        
    
The view of the widget in your project has to look like this, it will execute the transfer process when it loads.
 
 
When the transfer of cryptocurrency came to success the widget will show us a go, after confirmations are done we will notify to the choosen IPN Url.
For a quick guide on how to generate LivePay payment widget in PHP please click here.