Twetch pay is a simple way to accept payments on your website from a number of wallet providers and payment methods.
Currently supported wallets are Money Button, RelayX and Maxthon VBox.
The simplest Twetch Pay usage looks like this:
// in HTML
<script src="https://pay.twetch.com/pay.js"></script>
// in javascript
twetchPay.pay({ outputs: [{
to: '1harrywon46Aq2b2TK29wKviKUiDzc9EQ',
amount: 0.0002
}]
});
Including the TwetchPay embed on your makes twetchPay
available on the browser's window
object. It has one asynchronous method, pay
that resolves with
a payment object upon a successful payment and throws if there was an error. pay
returns undefined
if the payment was canceled.
An array containing a list of output ojects. Each output object may have the following properties:
to
: (string) - bitcoin addressamount
: (number) - amount of bitcoin (BSV)script
: (string) - valid bitcoin script using ASM formatA string array of available wallets for use in the widget. Options are: moneybutton
, relayx
and vbox
.
A function that is called after a successful payment
A function that is called when an error occurs during the payment
Additional properties passed into moneybutton.
Additional propeties passed into relayx
Whether to enable debugging logging
Optional. Set application name for some wallets (such as VBox) that need it. Default: 'Twetch Pay'
Optional. Set application logo for some wallets (such as VBox) that need it. Default: 'https://twetch-app.now.sh/static/favi.png'
Optional. Set prodeuct name for some wallets (such as VBox) that need it. Default: 'Purchase'