0.0.7 • Published 5 years ago
@stablepay/widget v0.0.7
StablePay Widget
StablePay is a decentralized cryptocurrency payment platform powered by smart-contracts in the ethereum network that allows anyone to receive easily and securely an asset-backed stablecoin through their site, mitigating the risk of high volatility in the cryptocurrency market.
This repository contains the Widget source code. Widget and docs are still in development.
Usage
Enable cryptocurrency payments and donations in your site by either:
- Using the Widget Component Library by installing our NPM Package in your React App. (Read how to install Here)
- Using our Embeddable Widget in your site using HTML/JavaScript. (Read our Docs for more information)
- Directly calling the Smart Contract. (Read our Docs for more information)
Installing
Using npm:
npm install @stablepay/widget
Using yarn:
yarn add @stablepay/widget
Example
Predefined Widget Button:
import React from 'react';
import { WidgetButton } from '@stablepay/widget';
const Checkout = () => {
const payload = {
type: 'Payment',
source: {
name: 'Your Store',
address: '0x0...'
},
amount: {
total: '9.99'
},
callbackURL: 'https://yourstore.com/checkout',
theme: 'standard'
};
return <WidgetButton {...payload} />;
};
export default Checkout;
Custom Widget Button:
import React from 'react';
import { Widget } from '@stablepay/widget';
const Checkout = () => {
const payload = {
type: 'Payment',
source: {
name: 'Your Store',
address: '0x0...'
},
amount: {
total: '9.99'
},
callbackURL: 'https://yourstore.com/checkout',
theme: 'custom'
};
return (
<button onClick={() => Widget.open(payload)}>Pay With StablePay</button>
);
};
export default Checkout;
Acknowledgments
- Grant by MakerDao