To install the last active version:
npm install ngx-ycpay@latest
This library is a reserve until the youcan teams create a library for angular
-
This package is only a short module for integration youcanpay card in your angular
-
You need to import
https://youcanpay.com/js/ycpay.js
to your angular.json -
This package required your smile before installation 😏
If you dont know angular.json (im also dont know 😅 ) follow me with this steps
- go to your project
- 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)
- is not important step
- open angular.json
- projects -> project-name -> architect -> options -> scripts
- oh wow we finish
- 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);
}
Lah yrheem lawalidin is enough 👌