Skip to content

ha2mza/ngx-ycpay

Repository files navigation

Installation

To install the last active version:

npm install ngx-ycpay@latest

Notice

This library is a reserve until the youcan teams create a library for angular

  1. This package is only a short module for integration youcanpay card in your angular

  2. You need to import https://youcanpay.com/js/ycpay.js to your angular.json

  3. This package required your smile before installation 😏

If you dont know angular.json (im also dont know 😅 ) follow me with this steps

  1. go to your project
  2. scroll down behind of package.json you will see angular.json (if you don't know package.json this library is not recommended for you)
  3. is not important step
  4. open angular.json
  5. projects -> project-name -> architect -> options -> scripts
  6. oh wow we finish

Using the library

  1. Import the NgxYcpayModule into your application
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';

// Import the library
import { NgxYcpayModule } from 'ngx-ycpay';

@NgModule({
  declarations: [AppComponent],
  imports: [
    BrowserModule,
    ReactiveFormsModule,
    NgxYcpayModule,
    LibraryModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule {}

Now go to your component and 🤙 call <ngx-ycpay [yc-publicKey]="'publicKey'"></ngx-ycpay>

other params not required:

Name Default Value
yc-form ycForm
yc-lang en
yc-error ycError
yc-class empty
class yc-group

The ngx-ycpay has only one event i call him Pay for more explination when user click pay the event will emit a instance of YCPay in (Pay)="" Event

// component.html

<ngx-ycpay [yc-publicKey]="'publicKey'" (Pay)="MyMethodForCreatToken($event)"></ngx-ycpay>

// component.ts

MyMethodForCreatToken(ycPay){
ycPay.pay(tokenId)
      .then(successCallback)
      .catch(errorCallback);
}

Donation

Lah yrheem lawalidin is enough 👌

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published