0.0.4 • Published 1 year ago

capacitor-phonepe v0.0.4

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

capacitor-phonepe

phonepe payment gateway

Install

npm install capacitor-phonepe
npx cap sync

API

init(...)

init(options: { environment: string; merchantId: string; appId: string; enableLogging: boolean | false; }) => Promise<Record<string, boolean>>

This method is used to initiate PhonePe Payment sdk. Provide all the information as requested by the method signature. Params:

  • environment: This signified the environment required for the payment sdk possible values: UAT, UAT_SIM, PRODUCTION if any unknown value is provided, PRODUCTION will be considered as default.
  • merchantId: The merchant id provided by PhonePe at the time of onboarding.
  • appId: The appId provided by PhonePe at the time of onboarding.
  • enableLogging: If you want to enabled / visualize sdk log

    • enabled = YES
    • disable = NO
  • Return: Boolean (TRUE -> SUCCESS).

    • SUCCESS: TRUE
    • FAILURE: FALSE
      • in iOS = False (if AppID missing:-Please provide PhonePe AppId)
      • in Android = Error in case of invalid arguments ex: "Invalid environment or merchantId!"
ParamType
options{ environment: string; merchantId: string; appId: string; enableLogging: boolean; }

Returns: Promise<Record<string, boolean>>


startPGTransaction(...)

startPGTransaction(options: { body: string; checksum: string; apiEndPoint: string; headers: any; packageName: string | null; callBackURL: string | null; }) => Promise<Record<string, string>>

This method is used to initiate PhonePe B2B PG Flow. Provide all the information as requested by the method signature. Params:

  • body : The request body for the transaction as per the developer docs. Make sure the request body is base64encoded
  • checkSum: checksum for the particular transaction as per the developer docs.
  • apiEndPoint: The API endpoint for the PG transaction.
  • headers: Headers as per the developer doc, to accomodate Container flow
  • packageName: @Optional(for iOS) in case of android if intent url is expected for specific app.
  • callBackURL: Your custom URL Schemes, as per the developer docs. Return: Will be returning a dictionary / hashMap { status: String, // string value to provide the status of the transcation // possible values: SUCCESS, FAILURE, INTERUPTED error: String // if any error occurs }
ParamType
options{ body: string; checksum: string; apiEndPoint: string; headers: any; packageName: string | null; callBackURL: string | null; }

Returns: Promise<Record<string, string>>


startContainerTransaction(...)

startContainerTransaction(options: { body: string; checksum: string; apiEndPoint: string; headers: any; callBackURL: string | null; }) => Promise<Record<string, string>>

This method is used to initiate PhonePe B2B PG Flow. Provide all the information as requested by the method signature. Params:

  • body : The request body for the transaction as per the developer docs. Make sure the request body is base64encoded.

  • checkSum: checksum for the particular transaction as per the developer docs.

  • apiEndPoint: The API endpoint for the container transaction.
  • headers: Headers as per the developer doc, to accomodate Container flow
  • callBackURL: Your custom URL Schemes, as per the developer docs. Return: Will be returning a dictionary / hashMap { status: String, // string value to provide the status of the transcation // possible values: SUCCESS, FAILURE, INTERUPTED error: String // if any error occurs }
ParamType
options{ body: string; checksum: string; apiEndPoint: string; headers: any; callBackURL: string | null; }

Returns: Promise<Record<string, string>>


isPhonePeInstalled()

isPhonePeInstalled() => Promise<Record<string, boolean>>

This method is called to verify / check if PhonePe app is installed on the user / target device. Return: Boolean YES -> PhonePe app installed/available NO -> PhonePe app unavailable NOTE :- In iOS, Add all the request Query URL Schema as per the developer doc.

Returns: Promise<Record<string, boolean>>


isPaytmInstalled()

isPaytmInstalled() => Promise<Record<string, boolean>>

This method is called to verify / check if Paytm app is installed on the user / target device. Return: Boolean YES -> Paytm app installed/available NO -> Paytm app unavailable NOTE :- In iOS, Add all the request Query URL Schema as per the developer doc.

Returns: Promise<Record<string, boolean>>


isGpayInstalled()

isGpayInstalled() => Promise<Record<string, boolean>>

This method is called to verify / check if GPay app is installed on the user / target device. Return: Boolean YES -> GPay app installed/available NO -> GPay app unavailable NOTE :- In iOS, Add all the request Query URL Schema as per the developer doc.

Returns: Promise<Record<string, boolean>>


getPackageSignatureForAndroid()

getPackageSignatureForAndroid() => Promise<Record<string, string>>

This method is called to get package signature while creation of AppId in @Android only. Return: String Non empty string -> app package signature NOTE :- In iOS, it will throw os error at runtime.

Returns: Promise<Record<string, string>>


getUpiAppsForAndroid()

getUpiAppsForAndroid() => Promise<Record<string, string>>

This method is called to get list of upi apps in @Android only. Return: String JSON String -> List of UPI App with packageName, applicationName & versionCode NOTE :- In iOS, it will throw os error at runtime.

Returns: Promise<Record<string, string>>


Type Aliases

Record

Construct a type with a set of properties K of type T

{

}

0.0.4

1 year ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago