Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
react-native-stripe
Advanced tools
Wraps the native Stripe iOS SDK for React Native apps.
npm i react-native-stripe --save
open node_modules/react-native-stripe
StripeNative.xcodeproj
into your Libraries
groupBuild Phases
expand the Link Binary With Libraries
header+
to add a librarylibStripeNative.a
and libStripe.a
under the Workspace
groupvar React = require('react-native');
var StripeNative = require('react-native-stripe');
const STRIPE_KEY = "<YOUR STRIPE KEY>";
const SOME_ITEMS = [
{
label: "Llama Kitty T-shirt",
amount: 19.99,
},
{
label: "Hello Kitty Humidifier",
amount: 25.00,
},
];
var AppEntry = React.createClass({
componentDidMount: function () {
StripeNative.init(STRIPE_KEY);
},
applePay: function () {
Promise.all([StripeNative.canMakePayments(), StripeNative.canMakePaymentsUsingNetworks()]).then(
function (canMakePayments) {
if (!canMakePayments[0])
alert("Apple Pay is not enabled on this device");
else if (!canMakePayments[1])
alert("Apple Pay is enabled but no card is configured");
else {
var options = {
fallbackOnCardForm: false,
shippingAddressFields: StripeNative.iOSConstants.PKAddressFieldAll,
currencyCode: 'USD'
};
StripeNative.paymentRequestWithApplePay(SOME_ITEMS, "Llama Kitty Shop", options).then(function (obj) {
var token = obj[0],
shippingInfo = obj[1],
billingInfo = obj[2];
// (Create charge here)
(chargeWasSuccessful ? StripeNative.success : StripeNative.failure)();
}, function (err) {
alert(err);
})
}
});
},
});
cd node_modules/react-native-stripe/example/
index.ios.js
and replace <YOUR STRIPE KEY>
with your Stripe publishable key.<YOUR APPLE PAY MERCHANT ID>
with your merchant ID. Note that this doesn't matter for testing in the simulator.npm install
react-native start
open ios/example.xcodeproj
Code and documentation copyright 2016-2017 Lane M Rettig. Code released under the MIT license.
FAQs
React Native wrapper for native iOS Stripe SDK
We found that react-native-stripe 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
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.