Crypttp JS
Installation
1. Download dependency in project directory
npm i -s crypttp-acq
2.
Signup at dashboard https://crypttp.com/dashboard
And copy merchant id
Add to project
Add crypttp
module to your project
const Crypttp = require('crypttp-acq')
const crypttp = new Crypttp()
With ES6
import Crypttp from 'crypttp-acq';
const crypttp = new Crypttp()
in Browser
<script src="https://crypttp.com/sdk/js/index-acq.min.js"></script>
Use
/**
* @param {string} merchant_id id which you can find at console.crypttp.com
* @param {string} to address of wallet where transfer should be sent to
* @param {string} country_currency only fiat currency
* @param {string} currency object with details of transaction
* @param {string} amount amount to charge in local currency numeration
* @param {string} payload any extra data that you want to send with cryptocurrency transaction
* @param {string} memo a special tag for specific blockchains
* @param {string} onsuccess url where to redirect user after checkout complete (can be deeplink)
* @param {string} onerror url where to redirect user if checkout failed (can be deeplink)
*/
const data = {
merchant_id: 'example_id',
to: 'btcaddress1234',
currency: 'BTC',
country_currency: 'USD',
amount: '100', // note that amount will be passed in USD
onsuccess: 'https://example.com/order_paid', // you also can parse deeplink here
onerror: 'https://example.com/order_failed' // you also can parse deeplink here
}
crypttp.pay(data)
What will go next
-
Crypttp will convert automatically convert 100 USD to cryptos
-
All transaction detailes will be shared with wallets
-
When transaction will be successfully made wallet will route back user to the
onsuccess
oronerror
link
Server side
If you will use api on the server side it will return string (URL).
Redirect user to that URL or set it as href
attribute to redirect user on click.