
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
@creadi/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.xcodeprojlibRNDatatransPayment.a to your project's Build Phases âžś Link Binary With LibrariesCmd+R)<android/app/src/main/java/[...]/MainActivity.javaimport 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
The npm package @creadi/react-native-datatrans receives a total of 193 weekly downloads. As such, @creadi/react-native-datatrans popularity was classified as not popular.
We found that @creadi/react-native-datatrans demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers 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.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.