Tonspay
  • 😇Welcome
  • 🚀Roadmap
  • 💰Price
  • 📈Tokenomics
  • ✌️Chain Supports
  • 🤖Tonspay-Bot
    • General
    • Crosschain Payment
  • 🌉Tonsbridge
    • Genral
    • How to use Tonsbridge
  • 📱TONSPAY-WEBAPP
    • General
    • Pages
      • Home Page
      • Wallet Page
  • ☕Tonspay-dashboard
    • General
  • 🚂Demo Working Bot
    • General
    • How to use
    • Source code & example
  • ⌨️Develop
    • Get start
    • 🎓Restful Api Interface
      • Payment method management
        • [POST] New payment method
        • [GET] Get payment method
      • Invoice management
        • [POST] New invoice
        • [POST] New headless invoice
        • [GET] Get invoice by id
    • 📬Web-page Api interface
    • ⏮️Callback interface
      • Http interface
      • Websocket interface
      • Callback ${body}
      • 🖨️Self host monitor
  • 🔗Links
    • Github
    • Twitter
    • Website
    • TonspayBot
    • TonspayChannel
    • Dev&Spport Group
    • TonsbridgeBot
    • TonspaySupportBot
    • PitchDeck
Powered by GitBook
On this page
  1. Develop
  2. Callback interface

Callback ${body}

The callback body sign and verfiy logic .

The callback body will be sign by a keypair of Tonspay official to avoid callback interface being witch attack .

Body :

{
    sign : "The signature data to prove message sended from tonspay"
}

The sign are a signature that using ed25519 . Result being encode by base58 , please decode it into bytes by base58.

You will be able to deocde the signature-data by tweetnacl into data ${base64-data}.

Base64-data decode with json.parse:

{
           "uid":0, //Your merchant user id in telegram bot . Please verfiy if it is your callback.
            "invoiceId":"",//Which invoice this callback for . 
            "paymentMethod":"",//The payment method of the invoice . 
            "confirmedBlock":"", //How many block since the callback confirm . 
            "paymentDetails":{
                    "from":"",//The address of payer . 
                    "amount":0,//How much this transaction paid on chain .
                    "hash" : "",//The transaction hash of this payment . 
            },
            "routerFeeDetails":{
                    "from":"",//The address of payer . 
                    "amount":"",//How much being charged by payment router .
                    "hash" : "" , //The sub transaction of router fee .
                    "isPrepaid":bool, //If this transaction being prepaird by merchant by Token . 
            },
            "createTime":0//The time of this callback .
},

Tonspay signature publick-key

Production ENV :

ENzsJ58Lmb6GMfMPhsTKm1AYaEoL5Z24r9RVPKaYLyJ6

Test/Sandbox ENV :

2885LXvdSb9FYxrr8BD5tgML3hXdWbC33ofT3MWqhZtQ

Verfiy logic in js :

const signData = b58.decode(rawData.sign);

const decodeData = nacl.sign.open( signData, b58.decode('ENzsJ58Lmb6GMfMPhsTKm1AYaEoL5Z24r9RVPKaYLyJ6'))

const finalData = json.parse(
    Buffer.from(decodeData).toString()
)
PreviousWebsocket interfaceNextSelf host monitor

Last updated 1 year ago

⌨️
⏮️