When I import Paypal-Rest-SDK and try running:
react-native run-android
An error occurs:
"undefined is not a function(evaluating 'r(d[9]).configure')"
Before this error occurred, I deleted the node_modules
folder and reinstalled all modules again, because I had a similar error with "evaluating process.versions.openssl". when I call node -p process.versions
, the following is printed:
{ http_parser: '2.8.0',
node: '8.12.0',
v8: '6.2.414.66',
uv: '1.19.2',
zlib: '1.2.11',
ares: '1.10.1-DEV',
modules: '57',
nghttp2: '1.32.0',
napi: '3',
openssl: '1.0.2p',
icu: '60.1',
unicode: '10.0',
cldr: '32.0',
tz: '2017c' }
and my Code is the following for using the paypal-sdk:
'use strict';
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View, TouchableHighlight, Linking} from 'react-native';
var paypal = require('paypal-rest-sdk');
paypal.configure({
mode: 'sandbox', // Sandbox or live
client_id: 'x',
client_secret: 'y'});
export default class Paypal extends Component{
constructor(props)
{
super(props);
console.log(process);
}
render()
{
return(
<View>
<Text>This is gonna be a PayPal Thing</Text>
</View>
);
}
}
I hope someone can help me. I've googled almost the entire day for this issue.
UPDATE : The Problem is not the include of the paypal-rest-sdk, but the next line when I try to configure the paypal variable. The error dissapears when I comment them out ...but as far as I know it is necessary to configure that
Update No.2 After running npm install --save paypal-rest-sdk I'm back at the problem
undefined is not an object (evaluating 'process.versions.openssl')
You are using paypal-rest-sdk
which is NodeJS PayPal SDK, I belive it is not compatible with React Native. I suggest to try something React Native specific like
https://www.npmjs.com/package/react-native-paypal-wrapper
https://www.npmjs.com/package/react-native-paypal
Or use plain PayPal rest API https://developer.paypal.com/docs/api/overview/#api-requests