1.0.9 • Published 8 months ago
budpay v1.0.9
BudPay Angular Library
Easily integrate BudPay Inline Checkout into your Angular applications with the BudPay Angular Library.
Table of Contents
Installation
To install the BudPay Angular Library, use the following npm command:
npm install budpay
Usage
Import the BudpayService
First, import the BudpayService
into your module:
import { BudpayService } from 'budpay';
@NgModule({
...
providers: [BudpayService],
...
})
export class AppModule { }
Use the Service in Your Component
In your component, inject the BudpayService
and use the payWithBudPay
method to initiate the payment:
import { Component } from '@angular/core';
import { BudpayService } from 'budpay';
@Component({
selector: 'app-payment',
templateUrl: './payment.component.html',
styleUrls: ['./payment.component.css']
})
export class PaymentComponent {
email: string = '';
firstName: string = '';
lastName: string = '';
phone: string = '';
amount: number = 0;
logo_url: string = 'http://secure-dev.tranzfar.com/assets/img/dashboard-logo.svg';
currency: string = 'NGN';
reference: string = '' + Math.floor((Math.random() * 100000000000) + 1) + new Date().getSeconds() + new Date().getMilliseconds();
key: string = 'YOUR_PUBLIC_KEY';
constructor(private budpayService: BudpayService) {}
initiatePayment(): void {
this.budpayService.payWithBudPay(
this.email,
this.firstName,
this.lastName,
this.phone,
this.amount,
this.logo_url,
this.currency,
this.reference,
this.key
).subscribe({
next: (response) => {
alert('Payment complete!: ' + response.reference);
},
error: (err) => {
alert('Error: ' + err);
}
});
}
}
Replace YOUR_PUBLIC_KEY
with your BudPay public key.
Support
For any issues or queries related to the BudPay Angular Library, please contact michaelegbo@gmail.com.
Remember to adjust the support email to your actual support email address and replace YOUR_PUBLIC_KEY
with the appropriate placeholder or instruction.