# Crypttp-angular

## Environment
```
node -v
// your version > 10.9
```

## Installation
### 1. Download dependency in project directory
```
npm i -s crypttp-angular
```

### 2.
Signup at dashboard
https://crypttp.com/dashboard

And copy merchant id

<img src="https://i.imgur.com/fyW4P6s.png" height="100%" />

## Usage
### 1. Add crypttp to imports of root app.module
```JavaScript
/*
 here your imports goes
*/
import {Crypttp} from 'crypttp-angular';

@NgModule({
    declarations: [ /* your components */ ],
    imports: [
        /* other angular modules */
        Crypttp,
    ]
})
export class AppModule {
}
```

### 2. Add component to your cart
```HTML
<crypttp type=''
    merchant_id=''
    country_currency=''
    currency=''
    amount=''
    to=''
    payload=''
    memo=''
    onsuccess=''
    onerror=''></crypttp>
```

### 3. Pass params
| Type   | Name | Optional \ Required | Discription |
|--------|------|---------------------|-------------|
| string | type | required | 0 - if you are CRYPTO ACUQRING, track transactions yourself, you keep wallet address of merchant. 1 - if you are MERCHANT and want charge user. We will create wallet address for you to accept cryptos |
| string | merchant_id | required | id which you can find at crypttp.com/dashboard |
| string | country_currency | required | currency of your client. Can't vary for each client. |
| string | currency | optional | pass it only if you know which crypto you want to charge from client |
| string | amount | required | amount to charge in native currency numeration |
| object | to | optional | pass it IF YOU KNOW MERCHANTS WALLET - object that should contain wallets of merchant for each currency {ETH:"0x1234"} |
| string | payload | optional | any extra data that you want to send with cryptocurrency transaction |
| string | memo | optional | a special tag for specific blockchains |
| string | onsuccess | optional | url where to redirect user after checkout complete (can be deeplink)|
| string | onerror | optional | url where to redirect user if checkout failed (can be deeplink)|
