
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
react-native-datatrans
Advanced tools
# Clone this repository. (in parent folder)
git clone https://github.com/creadi/simpego-app-react-native.git
# Install dependencies
yarn add file:../DatatransPayment
# Link libraries
react-native link react-native-datatrans
# Require library in the Podfile
pod 'RNDatatransPayment', :path => '../node_modules/react-native-datatrans'
# Install required native iOS packages (via pod)
cd ios && pod install
In Xcode navigate to Project targets > Info tab > Url Types
Add app url prefix scheme
When you initialize the library you need to add the twint property
const datatrans = new Datatrans({ ... twint: 'ch.shop' })
Libraries
➜ Add Files to [your project's name]
node_modules
➜ react-native-datatrans
and add RNDatatransPayment.xcodeproj
libRNDatatransPayment.a
to your project's Build Phases
➜ Link Binary With Libraries
Cmd+R
)<android/app/src/main/java/[...]/MainActivity.java
import com.reactlibrary.RNDatatransPaymentPackage;
to the imports at the top of the filenew RNDatatransPaymentPackage()
to the list returned by the getPackages()
methodandroid/settings.gradle
:
include ':react-native-datatrans'
project(':react-native-datatrans').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-datatrans/android')
android/app/build.gradle
:
compile project(':react-native-datatrans')
First initialize the app
import Datatrans from 'react-native-datatrans'
const datatrans = new Datatrans({ merchantId: '1100007268', twint: 'ch.shop', signature: '171127105041804302', testing: false })
You can pay in hidden mode by passing card number and the other checkout parameters
datatrans.payWithCard({
brand: 'Visa',
number: '4242424242424242',
expMonth: 12,
expYear: 2018,
cvv: '123',
name: 'Dani Lazarov',
amount: 199.99,
currencyCode: 'CHF',
country: 'Switzerland',
refNo: '20171207-test-4',
})
.then(res => console.log('Payment was successful', res)
.catch(err => console.error('There was an error', err)
Or open app in ui mode
datatrans.payWithCardUI({
amount: 200,
currencyCode: 'CHF',
country: 'Switzerland',
refNo: '20171207-test-4',
})
.then(res => console.log('Payment was successful', res)
.catch(err => console.error('There was an error', err)
options = {
merchantId: string, // e.g The merchant id
twint: string, // e.g Twint url as defined in description above
signature: string, // e.g Secret
testing: false // e.g The way we are running the app -> test mode or not
}
options = {
brand: 'Visa' | 'Mastercard' | 'Diners' | 'Amex' | 'Jcb' | 'Myone' | 'Discover',
number: string, // e.g. 4242424242424242 no spaces
expMonth: number, // e.g. 12 2 digit month
expYear: number, // e.g. 2025 full year 4 digits
cvv: string, // e.g. 123 3digit number on the back of the card
name: string, // e.g. Cardholder name
amount: number, // e.g. A positive number in the smallest currency unit representing the amount to charge the customer (e.g., 1099 for a €10.99 payment).
currencyCode: string, // e.g. CHF, USD, GBP
country?: string, // e.g. Switzerland
refNo: string, // e.g. This should be provided by your backend
}
FAQs
Datatrans react native wrapper
We found that react-native-datatrans demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.