dotwallet-react
Version:
DotWallet Components
70 lines (53 loc) • 1.49 kB
Markdown
#DotWallet Component
> Pay Button and Login Button
## Install
```
npm i dotwallet-react --save
```
## Usage
```jsx
import React from "react";
import ReactDOM from "react-dom";
import { DotWalletLogin, DotWalletPay } from "dotwallet-react";
ReactDOM.render(
<DotWalletLogin appId={APPID} redirectUrl={REDIRECT_URL} />,
document.getElementById("dotwallet-login")
);
```
or
```jsx
<DotWalletLogin
appId={APPID}
redirectUrl={REDIRECT_URL}
>
<div className="my-login-button">Login with DotWallet</div>
</DotWalletLogin>
<DotWalletPay
lang="en"
app-id="89d001043806644fdb4fb14099ff6be5"
redirect-url="http://192.168.1.142:8080/payment-success"
item-name="bananas"
order-amount="900"
api-endpoint="http://192.168.1.142:3000/create-order"
notice-uri="http://192.168.1.142:3000/payment-result"
fetchHeaders={{ "API-Key": "secret" }}
fetchOptions={{ credentials: "same-origin" }}
log={true}
></DotWalletPay>
```
## Documentation
### Props
| params | type | description |
| ----------- | ------ | ----------- |
| appId | string | APP_ID |
| redirectUrl | string | URL |
| lang | string | zh or en |
| className | string | class |
## Features
### Feature Props
> TODO
| params | type | description |
| --------- | --------------- | ------------- |
| onSuccess | Function | Success Event |
| onFailure | Function | Failure Event |
| render | React.ReactNode | |