Crypttp JS
Installation
1. Download dependency in project directory
npm i -s crypttp
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')
const crypttp = new Crypttp()
With ES6
import Crypttp from 'crypttp';
const crypttp = new Crypttp()
in Browser
<script src="https://crypttp.com/sdk/js/index.min.js"></script>
Use
const data = {
type: '2',
merchant_id: 'example_id',
to: {
BTC:'btcaddress1234'
},
country_currency: 'USD',
amount: '100',
onsuccess: 'https://example.com/order_paid',
onerror: 'https://example.com/order_failed'
}
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
or onerror
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.