npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cashfree-pg-capacitor

v1.0.2

Published

Cashfree PG plugin for capacitor

Downloads

13

Readme

cashfree-pg-capacitor

The Cashfree Capacitor SDK allows you to integrate Cashfree Payment Gateway into your application and start collecting payments from your customers. It opens the payment page in a webview. The Capacitor SDK has been designed to minimise the complexity of handling and integrating payments in your Capacitor project.

Click here for more Documentation.

Install

Step 1 (Install the plugin)

Run the following commands in your capacitor project.

npm install cashfree-pg-capacitor
npx cap sync

Step 2 (Configure for Android and iOS)

Android

If the project's targetSdkVersion is 30 or above, add the following to your app Android Manifest file.

<manifest ...> 
	<queries>  
		<intent>  
			<action  android:name="android.intent.action.VIEW"  />  
			<data  android:scheme="upi"  android:host="pay"/>  
		</intent>  
		<package  android:name="com.android.chrome"  />  
	</queries>
<application ...>

also register the plugin in MainActivity.java of your app. Example

import com.cashfree.capacitor.CFBridge;
...
public class MainActivity extends BridgeActivity {  
  
 @Override  
 protected void onCreate(Bundle savedInstanceState) {  
    super.onCreate(savedInstanceState);  
    registerPlugin(CFBridge.class); // register the plugin here
  }  
}

iOS

Add the following code to application's info.plist file.

<key>LSApplicationCategoryType</key> 
<string></string> 
<key>LSApplicationQueriesSchemes</key> 
<array> 
<string>phonepe</string> 
<string>tez</string> 
<string>paytm</string> 
<string>bhim</string> 
</array>

API

startPaymentWEB()

startPaymentWEB(params: Object | Map<string, string>) => Object  

Parameters

Returns An Object containing the Response Parameters.


startPaymentUPI()

startPaymentUPI(params: Object | Map<string, string>) => Object  

Parameters

Returns An Object containing the Response Parameters.


getUPIApps()

getUPIApps() => Object  

Returns An Object containing the list of UPI apps installed in the User Phone supporting UPI intent payment mode.

Response Parameters:

  • displayName: Display name of the app to be used to show in the UI.
  • id: UPI app id to be used in UPI seamless Flow (with key appName).
  • icon: Icon of the UPI app encoded in Base64 to show in the UI.

Sample response parsed to JSON:

[
	{ 
		“displayName”: “Gpay”, 
		“id”: “com.google.android.apps.nbu.paisa.user”, 
		“icon”: “iVBORw0KGgoAAAANSUhEUgAAALQAAAC0CAYAAAA9zQYyAAAAAXNSR0IArs4c6QAA... (in base64)” 
	}, 
	{ 
		“displayName”: “PHONEPE”, 
		“id”: “com.phonepe.app”, 
		“icon”: “iVBORw0KGgoAAAANSUhEUgAAALQAAAC0CAYAAAA9zQYyAAAAAXNSR0IArs4c6QAA... (in base64)” 
	} 
]

getIcon()

getIcon(base64String: string) => string  

Parameters

  • base64String : A base64 icon string obtained from 'icon' field of a UPIApp from getUPIApps.

Returns A string prepended with data:image/png;base64, to make it usable as a source for image.


transFormUPIResponse()

This function is created as a helper function specifially for typescript.

transFormUPIResponse(result: any) => UPIApp[]  

Parameters

Returns An array of UPIApp.


Request and Response Parameters

Request Parameters

| Parameter | Required | Description| | --- | ----------- | ----- | |appId|Yes|Your app ID| |orderId|Yes|Order or Invoice ID| |orderCurrency|Yes|Currency code for the order.| |orderAmount|Yes|Bill amount of the order| |orderNote|No|Help text to provide customers with more information about the order.| |customerName|No|Name of the customer| |customerPhone|Yes|Phone number of the customer| |customerEmail|Yes|Email ID of the customer| |notifyUrl|No|Notification URL for server-server communication. Useful when a user's connection drops after completing the payment.| |paymentModes|No|Allowed payment modes for this order. Available values: cc, dc, nb, paypal, upi, wallet.Leave it blank if you want to display all modes.| |tokenData|Yes|Token generated for the payment.| |stage|Yes|Environment of the project setup (TEST or PROD)| |appName|No|UPI app id when invoking seamless UPI intent.|


Response Parameters

These parameters are sent in the response Object. They contain the details of the transaction.

| Parameter | Description | | --- | ----------- | |orderId|Order id for which transaction has been processed. Example, GZ-212.| |orderAmount|Order amount. Example, 256.00| |paymentMode|Payment mode of the transaction.| |referenceId|Cashfree generated unique transaction ID. Example, 140388038803.| |txStatus|Payment status for that order. Values can be, SUCCESS, FLAGGED, PENDING, FAILED, CANCELLED.| |paymentMode|Payment mode used by customers to make the payment. Example, DEBIT_CARD, MobiKwik.| |txMsg|Message related to the transaction. Will have the reason, if payment failed.| |txTime|Time of the transaction.| |type|Fixed value : CashFreeResponse. To identify the response is from Cashfree SDK.| |signature|Response signature, more here.|