1.0.1 • Published 1 year ago

ngx-razorpay v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

ngx-razorpay

NPM Version NPM Downloads GitHub release License GitHub Pull Requests

Angular library for integrating the Razorpay payment gateway, compatible with both Single Page Applications (SPA) and Server-Side Rendering (SSR).

Installation

You can install ngx-razorpay via npm:

npm install ngx-razorpay

You can install ngx-razorpay via yarn:

yarn add ngx-razorpay

You can install ngx-razorpay via pnpm:

pnpm add ngx-razorpay

Usage

Import the Module

Import the NgxRazorpayModule into your Angular module:

import { NgxRazorpayModule } from 'ngx-razorpay';

@NgModule({
  imports: [
    NgxRazorpayModule
  ]
})
export class AppModule { }

Use in the Component

Use the ngx-razorpay component in your Angular templates:

<ngx-razorpay
  [key]="yourRazorpayKey" 
  [amount]="paymentAmount" 
  [businessName]="businessName" 
  [orderId]="orderId"
>
</ngx-razorpay>

Inputs

InputTypeDescription
keystring (required)Razorpay API key
amountnumber (required)Amount to be paid in paisa (e.g., 100 for ₹1)
businessNamestring (required)Name of the business
orderIdstring (required)Order ID or reference
currencystringCurrency code (default: "INR")
descriptionstringDescription of the payment
logoUrlstringURL of the business logo
customerNamestringName of the customer
customerEmailstringEmail of the customer
customerMobilestringMobile number of the customer
methodPaymentMethodPayment method (e.g., 'card', 'netbanking', 'wallet'...)
notes{ key: string: any }Additional notes or metadata
hideTopbarbooleanHide the top bar
themeColorstringColor theme for the checkout form
backdropColorstringBackground color of the overlay
backdropClosebooleanClose on backdrop click
escapebooleanClose on escape key press
handleBackbooleanHandle back button press
confirmClosebooleanConfirm before close
onDismissFunctionCallback function on dismiss
animationbooleanEnable animation
subscriptionIdstringID of the subscription
subscriptionCardChangebooleanAllow card change for subscription
recurringbooleanEnable recurring payments
redirectbooleanRedirect after payment
customerIdstringID of the customer
rememberCustomerbooleanRemember customer details
timeoutnumberTimeout for payment (in milliseconds)
isCustomerNameReadOnlybooleanMake customer name field readonly
isCustomerEmailReadOnlybooleanMake customer email field readonly
isCustomerMobileReadOnlybooleanMake customer mobile field readonly
isCustomerEmailHiddenbooleanHide customer email field
isCustomerMobileHiddenbooleanHide customer mobile field
ngClassstringCustom CSS classes
ngStyle{ key: string: string }Custom inline styles
payBtnTextstringText for the pay button
payBtnTemplateTemplateRef<any>Template for the pay button

Outputs

OutputDescription
paymentSuccessEventEvent emitted on successful payment
paymentFailedEventEvent emitted on failed payment

Methods

MethodDescription
onPayMethod to handle the payment event.

License

This project is licensed under the MIT License - see the LICENSE file for details.

1.0.1

1 year ago

1.0.0

1 year ago