0.0.6 • Published 2 years ago

ngx-theteller v0.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

NgxTheteller

This library is meant to add payment integration for theTeller by PaySwitch

Installation

  1. Run npm i ngx-theteller to install.
  2. Add the NgxThetellerModule to your AppModule imports
...
import { NgxThetellerModule } from 'ngx-theteller';

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

@NgModule({
  ...
  imports: [
    NgxThetellerModule
  ],
  ...
})
export class AppModule { }
  1. Add the js script to your angular.json
"scripts": [
  ...
  "node_modules/ngx-theteller/assets/js/payswitchProd.js"
  ...
  ]

Usage

Add the ngx-theteller component to your page

<ngx-theteller
 [apikey]="'Your API Key'"
 [transaction_id]="'123456789098'"
 [amount]="1"
 [currency]="GHS"
 [customer_email]="'test@email.com'"
 [return_url]="'https://returnurl.com'"
 [custom_class]="'payment-button'"
 [description]="'Payment for vans sneaker'"
></ngx-theteller>

Parameters

ParameterTypeRequiredDescription
apikeystringtrueYour merchant API key provided when you create an account with theTeller
transaction_idstringtrueA 12-digit unique transaction reference provided by you
amountnumbertrueAmount to charge
customer_emailstringtrueCustomer's Email
currencystringtrueCurrency to charge customer in. Defaults to GHS
return_urlstringtrueURL to redirect to when transaction is completed
button_textstringfalseText to show on payment button. Defaults to Pay Now
descriptionstringtrueText to be displayed as a short transaction narration
payment_methodstringtrueChoose between card or mobile money payment. e.g card, momo, both. Defaults to both
custom_classstringfalseA custom class to style payment button

Contributing

Please feel free to fork this package and contribute by submitting a pull request to enhance the functionalities.

Two projects exist in this repository

  • The ngx-theteller package: ./projects/ngx-theteller
  • The demo: ./projects/testing

Demo

  • Run ng build ngx-theteller
  • Run ng serve

Thanks to Julius Asante