Catalog npm
PACKAGE EXPLORERView in registry

2c2p-integration

npm

2c2p library for react native

androidiosreact-native2c2pjunxiang
Versions collected3
Direct dependencies20From release 0.3.0
Last observed20 Oct, 19:08 UTC

README

Current package documentation

react-native-junxiang-2c2p-v9

2c2p library

Usage

Set API test/live URLs in src/Junxiang2c2p.tsx.
Set APIEnvironment.Sandbox or APIEnvironment.Production in android/src/main/Junxiang2c2pV9Module.java or ios/Junxiang2c2pV9.swift for iOS.

To Call Payment Method

import { getPaymentToken, decodeJWT } from 'react-native-junxiang-2c2p-v9';
const { Junxiang2c2pV9 } = NativeModules; 

const testPayload = {
  merchantID: merchantID,
  invoiceNo: invoiceNo,
  description: description,
  amount: amount,
  isProduction: false, 
  currencyCode: currencyCode,
  cardNo: cardNo,
  nonceStr: nonceStr,
  expiryMonth: expiryMonth,
  expiryYear: expiryYear,
  securityCode: securityCode,
  securityKey: securityKey,
  paymentChannel: paymentChannel,
  request3DS: request3DS
};

getPaymentToken(testPayload, false).then(async (result:any) => {
  let paymentTokenEncoded = JSON.parse(result).payload;
  let paymentTokenDecoded:any = await decodeJWT(paymentTokenEncoded);
  let paymentParams:any  = JSON.parse(JSON.parse(paymentTokenDecoded).decoded);
  let paymentToken:string = paymentParams.paymentToken;
  let webUrl:string = paymentParams.webPaymentUrl;   

  try {
    const result = await Junxiang2c2pV9.proceed2C2PTransaction(testPayload, paymentToken);
    
    if (result.status === 'redirect') { 
      let urlToOpenInWebview = result.url;
      // open url in webview
    }
    // android returns only url while ios (above) returns json.
    else if (result.startsWith("https://")) {
      let urlToOpenInWebview = result;
      // open url in webview 
    }
  } catch (error) {
    console.error("Payment failed:", error);
  }
});

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 3

Collected releases
VersionPublishedDirect dependenciesOpen version
0.3.0Registry latest14 Nov 202420
0.2.210 Oct 202429
0.2.010 Oct 202429

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
junxiang/2c2p-integration

Shared repository data · GitHub

License detected in repository
Not collected

Repository

PENDING
junxiang/react-native-junxiang-2c2p

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:08 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:058a7f9be29f899a21aa421f8632833a99e2dc4cdbade30cdb57f71d8eab910c