# bcc-pay

> bcc-pay webcomponent

Latest version **0.1.70** (published 2021-12-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install bcc-pay
pnpm add bcc-pay
yarn add bcc-pay
bun add bcc-pay
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.70 |
| Published | 2021-12-09 |
| First published | 2021-07-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 138.1 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| Author | bcc-pay-devteam |
| Maintainers | oskarpbcc |

## Links

- npm: https://www.npmjs.com/package/bcc-pay
- Repository: https://github.com/bcc-code/bcc-pay
- Homepage: https://github.com/bcc-code/bcc-pay#readme
- Issues: https://github.com/bcc-code/bcc-pay/issues
- npm.io page: https://npm.io/package/bcc-pay

## Dependencies (3)

- [axios](https://npm.io/package/axios.md) ^0.21.1
- [lit-html](https://npm.io/package/lit-html.md) ^1.4.1
- [lit-element](https://npm.io/package/lit-element.md) ^2.5.1

## Recent versions

- 0.1.70 (latest) — 2021-12-09
- 0.1.69 — 2021-12-08
- 0.1.68 — 2021-12-07
- 0.1.67 — 2021-12-07
- 0.1.66 — 2021-12-02
- 0.1.65 — 2021-12-01
- 0.1.64 — 2021-11-19
- 0.1.63 — 2021-11-18
- 0.1.62 — 2021-11-17
- 0.1.61 — 2021-11-12
- 0.1.60 — 2021-11-05
- 0.1.59 — 2021-11-05
- 0.1.58 — 2021-11-05
- 0.1.57 — 2021-11-03
- 0.1.56 — 2021-11-03
- … 151 more at https://npm.io/package/bcc-pay/versions

## README

# BCC Pay WebComponent

This webcomponent follows the [open-wc](https://github.com/open-wc/open-wc) recommendation.

# Development

To run webComponent in dev mode go to /webComponent/bcc-pay/
`npm install`
`npm run storybook`

We are pushing new version from CI/CD to NPM and Github repositories:

- registry.npmjs.org (public)
- npm.pkg.github.com (scoped as @bcc-it)

Pushing webComponent manually:
`npm run versionCheck`
`npm version patch`
`npm run build`
`npm publish`

In application type:
`npm install bcc-pay@latest`

# Instalation

Install of component:
`npm install bcc-pay`

For angular module you have to add CUSTOM_ELEMENTS_SCHEMA from '@angular/core'

```JavaScript
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
@NgModule({
  declarations: [SampleComponent],
  imports: [CommonModule, SampleRoutingModule],
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
```

Then you can use webComponent with one of options presented below, you have to always pass your netsCheckoutKey from nets admin panel:

```
> https://portal.dibspayment.eu/dashboard
> Company
> Integration
> Checkout key
```

Examples of using component

```html
<bcc-pay netsCheckoutKey="#netsCheckoutKey#" isDevEnv="true"></bcc-pay>

<bcc-pay
  item="Subscpription"
  currency="NOK"
  country="NOR"
  amount="10"
  server="https://localhost:5001"
  netsCheckoutKey="#netsCheckoutKey#"
></bcc-pay>
```

You can also pass user object to component:

JS

```JavaScript
const sampleUser = {
    email: 'doe@test.no',
    phoneNumber: '+47661626839',
    firstName: 'John',
    lastName: 'Doe',
    addressLine1: 'TestAddressLine1',
    addressLine2: 'TestAddressLine2',
    city: 'Oslo',
    postalCode: '0001',
  };
```

HTML

```html
<bcc-pay
  item="Subscpription"
  currency="NOK"
  country="NOR"
  amount="12"
  server="https://localhost:5001"
  user="${this.sampleUser}"
  netsCheckoutKey="#netsCheckoutKey#"
></bcc-pay>
```

You can also pass additional headers for requests:

Request model

```TypeScript
export class RequestHeader {
  key: string;
  value: string;
  }
```

Sample request headers created in JS

```Javascript
const requestHeaders = [{ key: 'is-mobile-app', value: 'true' }],
```

HTML

```html
<bcc-pay
  requestHeaders="${this.requestHeaders}"
  netsCheckoutKey="#netsCheckoutKey#"
  isDevEnv="true"
></bcc-pay>
```

List of possible parameters and default values:

```Typescript
  @property({ type: String }) item = 'Subscription';
  @property({ type: Number }) amount = 0;
  @property({ type: String }) currency = 'NOK';
  @property({ type: String }) country = 'NOR';
  @property({ type: String }) paymentType = '';
  @property({ type: User }) user: User = {};
  @property({ type: String }) server = 'https://localhost:5001';
  @property({ type: String }) netsCheckoutKey = '#checkout_key#';
  @property({ type: Boolean }) isDevEnv: boolean = false;
  @property({ type: [RequestHeader] }) requestHeaders:
    | [RequestHeader]
    | undefined;
  @property({ type: String }) paymentId: string = '';
  @property({ type: String }) primaryColor: string = '#006fc2';
  @property({ type: String }) secondaryColor: string = 'white';
  @property({ type: String }) accentColor: string = '#bae1ff';
```

---
_Source: https://npm.io/package/bcc-pay · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
