{"id":24044956,"url":"https://github.com/oun/react-native-2c2p-sdk","last_synced_at":"2025-04-22T10:43:23.890Z","repository":{"id":57338536,"uuid":"88328481","full_name":"oun/react-native-2c2p-sdk","owner":"oun","description":"React Native Bridge to 2c2p SDK ","archived":false,"fork":false,"pushed_at":"2020-02-04T07:14:40.000Z","size":36215,"stargazers_count":2,"open_issues_count":2,"forks_count":15,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-22T10:43:22.292Z","etag":null,"topics":["2c2p","react-natve"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oun.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-15T06:23:19.000Z","updated_at":"2019-06-02T15:38:09.000Z","dependencies_parsed_at":"2022-09-07T10:10:18.503Z","dependency_job_id":null,"html_url":"https://github.com/oun/react-native-2c2p-sdk","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oun%2Freact-native-2c2p-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oun%2Freact-native-2c2p-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oun%2Freact-native-2c2p-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oun%2Freact-native-2c2p-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oun","download_url":"https://codeload.github.com/oun/react-native-2c2p-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250222357,"owners_count":21394854,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["2c2p","react-natve"],"created_at":"2025-01-08T23:51:40.486Z","updated_at":"2025-04-22T10:43:23.857Z","avatar_url":"https://github.com/oun.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# react-native-my2c2p-sdk\n\nA minimal react-native bridge to 2c2p sdk.\n\n## Installation\n\n`$ npm install react-native-my2c2p-sdk --save`\n\nor\n\n`$ yarn add react-native-my2c2p-sdk`\n\n### Automatic Linking\n\n`$ react-native link react-native-my2c2p-sdk`\n\n### Manual Linking\n\n#### iOS\n\n1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`\n2. Go to `node_modules` ➜ `react-native-my2c2p-sdk` and add `RNMy2c2pSdk.xcodeproj`\n3. In XCode, in the project navigator, select your project. Add `libRNMy2c2pSdk.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`\n4. Run your project (`Cmd+R`)\u003c\n\n#### Android\n\n1. Open up `android/app/src/main/java/[...]/MainActivity.java`\n  - Add `import com.wednesdaynight.rn2c2p.RNMy2c2pSdkPackage;` to the imports at the top of the file\n  - Add `new RNMy2c2pSdkPackage()` to the list returned by the `getPackages()` method\n2. Append the following lines to `android/settings.gradle`:\n  \t```\n  \tinclude ':react-native-my2c2p-sdk'\n  \tproject(':react-native-my2c2p-sdk').projectDir = new File(rootProject.projectDir, \t'../node_modules/react-native-my2c2p-sdk/android')\n  \t```\n3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:\n  \t```\n    compile project(':react-native-my2c2p-sdk')\n  \t```\n\n### Setup My2c2pSDK\n\nFollow instruction on 2c2p ([android](https://s.2c2p.com/manuals/android/setupsdk.html), [iOS](https://s.2c2p.com/manuals/ios/setupsdk.html)) to generate private keys. \n\n#### iOS\n\nInstall via cocoa pods:\nAdd `pod 'my2c2pSDK'` to the ios/Podfile and run `pod install`.\n\n#### Android\n\n1. Download My2c2pSDK library from \u003chttps://s.2c2p.com/manuals/android/download/my2c2psdk.html\u003e.\n   Convert library to gradle module (See [example](https://github.com/oun/react-native-2c2p-example/tree/master/android/app/my2c2psdk)) \n   and put into directory: `your-react-native-project/android/app/my2c2psdk`.\n2. Append the following lines to `android/settings.gradle`:\n    ```\n    include ':my2c2psdk'\n    project(':my2c2psdk').projectDir = new File(rootProject.projectDir, './app/my2c2psdk')\n    ```\n3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:\n  \t```\n    compile project(':my2c2psdk')\n  \t```\n4. Add activity to app AndroidManifest.xml\n    ```\n    \u003cactivity android:name=\"com.ccpp.my2c2psdk.cores.My3DSActivity\"\n            android:theme=\"@style/My2c2pSDK.Theme\"\n            android:screenOrientation=\"portrait\"\u003e\n        \u003cintent-filter\u003e\n            \u003caction android:name=\"android.intent.action.VIEW\" /\u003e\n    \n            \u003ccategory android:name=\"android.intent.category.DEFAULT\" /\u003e\n            \u003ccategory android:name=\"android.intent.category.BROWSABLE\" /\u003e\n            \u003c!-- For 123 payment : eNETS (Direct Debit/Web Payment) Only --\u003e\n            \u003c!-- For demo server --\u003e\n            \u003cdata\n                android:scheme=\"my2c2pjt\"\n                android:host=\"123\" /\u003e\n            \u003c!-- For demo server --\u003e\n            \u003cdata\n                android:scheme=\"my2c2pjt01\"\n                android:host=\"123\" /\u003e\n            \u003c!-- For prod server --\u003e\n            \u003cdata\n                android:scheme=\"my2c2p1001\"\n                android:host=\"123\" /\u003e\n            \u003c!-- End --\u003e\n        \u003c/intent-filter\u003e\n    \u003c/activity\u003e\n    \u003cactivity android:name=\"com.ccpp.my2c2psdk.cores.OTPActivity\"\n        android:screenOrientation=\"portrait\"\n        android:theme=\"@android:style/Theme.NoTitleBar\"/\u003e\n    ```\n\n## Usage\n```javascript\nimport React, { Component } from 'react';\nimport My2c2pSDK from 'react-native-my2c2p-sdk';\nimport { ScrollView, TouchableHighlight, Text, StyleSheet } from 'react-native';\n...\n\nconst privateKey = 'YOUR PRIVATE KEY';\nconst merchantID = 'YOUR MERCHANT ID';\nconst secretKey = 'YOUR SECRET KEY';\nconst productionMode = false;\n\nexport default class PaymentScreen extends Component {\n  componentDidMount() {\n    My2c2pSDK.init(privateKey, productionMode);\n  }\n\n  handlePayment = async () =\u003e {\n    try {\n      const response = await My2c2pSDK.requestPayment({\n        paymentUI: false,\n        merchantID: merchantID,\n        uniqueTransactionCode: '123456789',\n        desc: 'Transaction description',\n        amount: 19.0,\n        currencyCode: '702',\n        cardHolderName: 'John Doe',\n        cardHolderEmail: 'john@doe.com',\n        pan: '4111111111111111',\n        cardExpireMonth: 2,\n        cardExpireYear: 2019,\n        securityCode: '123',\n        panCountry: 'SG',\n        secretKey: secretKey\n      });\n      console.log(response);\n    } catch(error) {\n      if (error.code === 'TRANSACTION_CANCELED') {\n        // transaction is canceled from OTP\n      }\n      console.log(error);\n    }\n  }\n\n  render() {\n    return (\n      \u003cScrollView\u003e\n        // Form ...\n        \u003cTouchableHighlight onPress={this.handlePayment}\u003e\n          \u003cText\u003eSubmit\u003c/Text\u003e\n        \u003c/TouchableHighlight\u003e\n      \u003c/ScrollView\u003e\n    );\n  }\n  \n  ...\n}\n\n```\n\n### Credit card payment (Non-UI)\n```javascript\nMy2c2pSDK.requestPayment({\n  paymentUI: false,\n  merchantID: merchantID,\n  uniqueTransactionCode: '123456789',\n  desc: 'Transaction description',\n  amount: 19.0,\n  currencyCode: '702',\n  cardHolderName: 'John Doe',\n  cardHolderEmail: 'john@doe.com',\n  pan: '4111111111111111',\n  cardExpireMonth: 2,\n  cardExpireYear: 2019,\n  securityCode: '123',\n  panCountry: 'SG',\n  secretKey: secretKey\n});\n```\n\n### Credit card payment (UI)\n```javascript\nMy2c2pSDK.requestPayment({\n  paymentUI: true,\n  merchantID: merchantID,\n  uniqueTransactionCode: '123456789',\n  desc: 'Transaction description',\n  amount: 19.0,\n  currencyCode: '702',\n  secretKey: secretKey\n});\n```\n\nCheck the full document for [payment request](https://s.2c2p.com/manuals/android/reference/nonuirequest.html#payment-request)\nand [response](https://s.2c2p.com/manuals/android/reference/my2c2presponse.html)\n\n## Example app:\n\nhttps://github.com/oun/react-native-2c2p-example\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foun%2Freact-native-2c2p-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foun%2Freact-native-2c2p-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foun%2Freact-native-2c2p-sdk/lists"}