GithubHelp home page GithubHelp logo

naoufal / react-native-payments Goto Github PK

View Code? Open in Web Editor NEW
1.6K 1.6K 407.0 13.28 MB

Accept Payments with Apple Pay and Android Pay using the Payment Request API.

Home Page: https://www.npmjs.com/package/react-native-payments

JavaScript 59.15% Java 14.19% Objective-C 26.18% Ruby 0.48%
apple-pay payment-request payments react-native

react-native-payments's Introduction

react-native-payments

Codeship Status for freeman-industries/react-native-payments

🚨 Important notice 🚨

This project is no longer maintained. The good news is that the landscape of payments on React Native has massively changed in the last few years. There is still room for this repo to evolve which I'll detail below, but first I would like to direct your attention to well-funded and well-maintained alternatives that will give you fewer grey hairs.

Stripe

  • Stripe has released an official React Native SDK supporting Apple Pay that has a huge team of paid engineers behind it.
  • It has also been included in the Expo managed environment, which means it works on Expo Go. Huge achievement.
  • For a bug free experience and easy integration I strongly recommend you use @stripe/stripe-react-native on any new projects.
  • More information and discussion in this issue: #335

Community forks and alternatives

Braintree

Other forks

Future of this library

The scope of this library should probably change to:

  • Support networks and products unavailable within Stripe
  • Stick to the principles of the PaymentRequest open interface

If you want to own that direction, please get in touch.

  • @naoufal (project owner) on Twitter (sometimes difficult to get hold of)
  • Me, Nabs (afk maintainer) on my LinkedIn (I also have Twitter @NabsFreeman, but I think Elon shadowbanned me during the whole jet thing)

Naoufal is the only administrator and he needs to appoint authors and maintainers. I can commit and merge PRs to help any new maintainer get started.

Nabs

On to the old README...

Introduction

Welcome to the best and most comprehensive library for integrating payments like Apple Pay and Google Pay into your React Native app.

This library is designed to be fully compatible with React Native 0.61 and onwards.

Installation

npm install --save react-native-payments

You'll need to autolink on each platform:

Android

npx jetify

iOS

cd ios
pod install

Guides

Example projects

Live demo

For a step by step guide, check out this talk by @naoufal.

https://www.youtube.com/watch?v=XrmUuir9OHc&t=652

API Spec

Down below we have a detailed specification for PaymentRequest and instructions for configuring Apple Pay and Google Pay, which is hopefully enough to get you started.

We also have some legacy example projects in the examples directory that will be rewritten soon and linked above.

Bear with us while we organize things a bit.

Roadmap

Completed

  • Apple Pay Stripe

Completed, untested

  • Apple Pay Braintree
  • Google Pay (Stripe, Braintree)
  • Web

In progress

  • Stripe: Payment Intents (for SCA)

Planned

  • Tutorial docs

Naoufal, the original author of this library, has done a lot of the hard work integrating iOS, Android, Web platforms and Stripe and Braintree gateways.

The library has fallen out of regular maintenance and we're working to test and update all parts to be compatible for RN in the 2020s.

If you're feeling brave give the untested platforms a try and let us know how it worked.

Contributors

Many people have contributed to the development of react-native-payments over time. The people below are currently available to help.


Merge PRs: βš™οΈ | Review issues: ✏️

Join us!

All contributions, big or small are welcomed.

For large PRs, please open an issue and have a discussion with us first before you dive in.

Our plan for this library is for it to be useful to all React Native developers so we want to architect it carefully.

In the wild

These amazing people use react-native-payments in their projects.

To add your organization, open a PR updating this list.


🚧

🚧

🚧

🚧

🚧


This project is currently in beta and APIs are subject to change.

React Native Payments

react-native version npm npm styled with prettier

Accept Payments with Apple Pay and Android Pay using the Payment Request API.

Features

  • Simple. No more checkout forms.
  • Effective. Faster checkouts that increase conversion.
  • Future-proof. Use a W3C Standards API, supported by companies like Google, Firefox and others.
  • Cross-platform. Share payments code between your iOS, Android, and web apps.
  • Add-ons. Easily enable support for Stripe or Braintree via add-ons.

Table of Contents

Demo

You can run the demo by cloning the project and running:

$ yarn run:demo

In a rush? Check out the browser version of the demo.

Note that you'll need to run it from a browser with Payment Request support.

Installation

First, download the package:

$ yarn add react-native-payments

Second, link the native dependencies:

$ react-native link react-native-payments

Usage

Setting up Apple Pay/Android Pay

Before you can start accepting payments in your App, you'll need to setup Apple Pay and/or Android Pay.

Apple Pay

  1. Register as an Apple Developer
  2. Obtain a merchant ID
  3. Enable Apple Pay in your app

Apple has a documentation on how to do this in their Configuring your Environment guide.

Android Pay

  1. Add Android Pay and Google Play Services to your dependencies
  2. Enable Android Pay in your Manifest

Google has documentation on how to do this in their Setup Android Pay guide.

Importing the Library

Once Apple Pay/Android Pay is enabled in your app, jump into your app's entrypoint and make the PaymentRequest globally available to your app.

// index.ios.js
global.PaymentRequest = require('react-native-payments').PaymentRequest;

Initializing the Payment Request

To initialize a Payment Request, you'll need to provide PaymentMethodData and PaymentDetails.

Payment Method Data

The Payment Method Data is where you defined the forms of payment that you accept. To enable Apple Pay, we'll define a supportedMethod of apple-pay. We're also required to pass a data object to configures Apple Pay. This is where we provide our merchant id, define the supported card types and the currency we'll be operating in.

const METHOD_DATA = [{
  supportedMethods: ['apple-pay'],
  data: {
    merchantIdentifier: 'merchant.com.your-app.namespace',
    supportedNetworks: ['visa', 'mastercard', 'amex'],
    countryCode: 'US',
    currencyCode: 'USD'
  }
}];
See Android Pay Example
const METHOD_DATA = [{
  supportedMethods: ['android-pay'],
  data: {
    supportedNetworks: ['visa', 'mastercard', 'amex'],
    currencyCode: 'USD',
    environment: 'TEST', // defaults to production
    paymentMethodTokenizationParameters: {
      tokenizationType: 'NETWORK_TOKEN',
      parameters: {
        publicKey: 'your-pubic-key'
      }
    }
  }
}];

Payment Details

Payment Details is where define transaction details like display items, a total and optionally shipping options.

Google has excellent documentation for Defining Payment Details.

const DETAILS = {
  id: 'basic-example',
  displayItems: [
    {
      label: 'Movie Ticket',
      amount: { currency: 'USD', value: '15.00' }
    }
  ],
  total: {
    label: 'Merchant Name',
    amount: { currency: 'USD', value: '15.00' }
  }
};

Once you've defined your methodData and details, you're ready to initialize your Payment Request.

const paymentRequest = new PaymentRequest(METHOD_DATA, DETAILS);

🚨 Note: On Android, display items are not displayed within the Android Pay view. Instead, the User Flows documentation suggests showing users a confirmation view where you list the display items. When using React Native Payments, show this view after receiving the PaymentResponse.

Displaying the Payment Request

Now that you've setup your Payment Request, displaying it is as simple as calling the show method.

paymentRequest.show();
See Screenshots

Aborting the Payment Request

You can abort the Payment Request at any point by calling the abort method.

paymentRequest.abort();

🚨 Note: Not yet implemented on Android Pay

Requesting Contact Information

Some apps may require contact information from a user. You can do so by providing a PaymentOptions as a third argument when initializing a Payment Request. Using Payment Options, you can request a contact name, phone number and/or email.

Requesting a Contact Name

Set requestPayerName to true to request a contact name.

const OPTIONS = {
  requestPayerName: true
};
See Screenshots

🚨 Note: On Android, requesting a contact name will present the user with a shipping address selector. If you're not shipping anything to the user, consider capturing the contact name outside of Android Pay.

Requesting a Phone Number

Set requestPayerPhone to true to request a phone number.

const OPTIONS = {
  requestPayerPhone: true
};
See Screenshots

🚨 Note: On Android, requesting a phone number will present the user with a shipping address selector. If you're not shipping anything to the user, consider capturing the phone number outside of Android Pay.

Requesting an Email Address

Set requestPayerEmail to true to request an email address.

const OPTIONS = {
  requestPayerEmail: true
};
See Screenshots

You can also request all three by setting them all to true.

const OPTIONS = {
  requestPayerName: true,
  requestPayerPhone: true,
  requestPayerEmail: true
};

Requesting a Shipping Address

Requesting a shipping address is done in three steps.

First, you'll need to set requestShipping to true within PaymentOptions.

const OPTIONS = {
  requestShipping: true
};

Second, you'll need to include shippingOptions in your Payment Details.

const DETAILS = {
  id: 'basic-example',
  displayItems: [
    {
      label: 'Movie Ticket',
      amount: { currency: 'USD', value: '15.00' }
    }
  ],
+ shippingOptions: [{
+   id: 'economy',
+   label: 'Economy Shipping',
+   amount: { currency: 'USD', value: '0.00' },
+   detail: 'Arrives in 3-5 days' // `detail` is specific to React Native Payments
+ }],
  total: {
    label: 'Merchant Name',
    amount: { currency: 'USD', value: '15.00' }
  }
};

Lastly, you'll need to register event listeners for when a user selects a shippingAddress and/or a shippingOption. In the callback each event, you'll need to provide new PaymentDetails that will update your PaymentRequest.

paymentRequest.addEventListener('shippingaddresschange', e => {
  const updatedDetails = getUpdatedDetailsForShippingAddress(paymentRequest.shippingAddress;

  e.updateWith(updatedDetails);
});

paymentRequest.addEventListener('shippingoptionchange', e => {
  const updatedDetails = getUpdatedDetailsForShippingOption(paymentRequest.shippingOption);

  e.updateWith(updatedDetails);
});

For a deeper dive on handling shipping in Payment Request, checkout Google's Shipping in Payment Request.

🚨 Note: On Android, there are no shippingaddresschange and shippingoptionchange events. To allow users to update their shipping address, you'll need to trigger a new PaymentRequest. Updating shipping options typically happens after the receiving the PaymentResponse and before calling its getPaymentToken method.

Processing Payments

Now that we know how to initialize, display, and dismiss a Payment Request, let's take a look at how to process payments.

When a user accepts to pay, PaymentRequest.show will resolve to a Payment Response.

paymentRequest.show()
  .then(paymentResponse => {
    // Your payment processing code goes here

    return processPayment(paymentResponse);
  });

There are two ways to process Apple Pay/Android Pay payments -- on your server or using a payment processor.

Processing Payments on Your Server

If you're equipped to process Apple Pay/Android Pay payments on your server, all you have to do is send the Payment Response data to your server.

⚠️ Note: When running Apple Pay on simulator, paymentData equals to null.

import { NativeModules } from 'react-native';

paymentRequest.show()
  .then(paymentResponse => {
    const { transactionIdentifier, paymentData } = paymentResponse.details;

    return fetch('...', {
      method: 'POST',
      body: {
        transactionIdentifier,
        paymentData
      }
    })
    .then(res => res.json())
    .then(successHandler)
    .catch(errorHandler)
  });
See Android Pay Example
paymentRequest.show()
  .then(paymentResponse => {
    const { getPaymentToken } = paymentResponse.details;

    return getPaymentToken()
      .then(paymentToken => {
        const { ephemeralPublicKey, encryptedMessage, tag } = paymentResponse.details;

        return fetch('...', {
          method: 'POST',
          body: {
            ephemeralPublicKey,
            encryptedMessage,
            tag
          }
        })
        .then(res => res.json())
        .then(successHandler)
        .catch(errorHandler)
      });
  });

You can learn more about server-side decrypting of Payment Tokens on Apple's Payment Token Format Reference documentation.

Processing Payments with a Payment Processor

When using a payment processor, you'll receive a paymentToken field within the details of the PaymentResponse. Use this token to charge customers with your payment processor.

paymentRequest.show()
  .then(paymentResponse => {
    const { paymentToken } = paymentResponse.details; // On Android, you need to invoke the `getPaymentToken` method to receive the `paymentToken`.

    return fetch('...', {
      method: 'POST',
      body: {
        paymentToken
      }
    })
    .then(res => res.json())
    .then(successHandler)
    .catch(errorHandler);
  });
See Android Pay Example
paymentRequest.show()
  .then(paymentResponse => {
    const { getPaymentToken } = paymentResponse.details;

    return getPaymentToken()
      .then(paymentToken => fetch('...', {
        method: 'POST',
        body: {
          paymentToken
        }
      })
      .then(res => res.json())
      .then(successHandler)
      .catch(errorHandler);
    });
  });

For a list of supported payment processors and how to enable them, see the Add-ons section.

Dismissing the Payment Request

Dismissing the Payment Request is as simple as calling the complete method on of the PaymentResponse.

paymentResponse.complete('success'); // Alternatively, you can call it with `fail` or `unknown`

🚨 Note: On Android, there is no need to call paymentResponse.complete -- the PaymentRequest dismisses itself.

Testing Payments

Apple Pay

The sandbox environment is a great way to test offline implementation of Apple Pay for apps, websites, and point of sale systems. Apple offers detailed guide for setting up sandbox environment.

⚠️ Note: It is also important to test Apple Pay in your production environment. Real cards must be used in the production environment. Test cards will not work.

⚠️ Note: There are known differences when running Apple Pay on simulator and real device. Make sure you test Apple Pay on real device before going into production.

Apple Pay Button

Provides a button that is used either to trigger payments through Apple Pay or to prompt the user to set up a card. Detailed docs and examples

Add-ons

Here's a list of Payment Processors that you can enable via add-ons:

🚨 Note: On Android, Payment Processors are enabled by default.

API

Resources

Payment Request

Apple Pay

Android Pay

License

Licensed under the MIT License, Copyright Β© 2017, Naoufal Kadhom.

See LICENSE for more information.

react-native-payments's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-payments's Issues

Plans to Support Pay with Google

Greetings - We are currently exploring using react-native-payments with Stripe add-on for Apple Pay and Android Pay instead of using tipsi-stripe. Do you have plans for this lib to support Pay with Google since Android Pay is being deprecated? I think many are assuming that the migration won't be too difficult, but we would want to avoid unnecessary rework if support for Pay with Google is coming soon. https://developers.google.com/payments/

Thanks!

"apple-pay" as identifer

According to the PMI spec, short strings like "apple-pay" must be registered with the w3c. For nonstandard strings, the spec says to use a URL.

[iOS] paymentToken not present on real device

Yesterdays production deployment kinda surprised me.

When testing in sandbox/production on device, paymentToken got lost. On simulator, it works perfectly.

Despite token arrives into JS "accept" handler , it does pass _getPlatformDetailsIOS
The fact it works on simulator is an accident, present on these lines

return Object.assign({}, details, {
    paymentData: null,
    serializedPaymentData
});

Calling Object.assign copies whatever is present in details object and passes it further.
Unfortunately, for real device, returned values are hand picked.

In both cases, return values should be hand picked to make sure they are equal in shape and/or values.

I am aware of #21 PR, I will try to build on that (unfortunately found the PR after my fix)

Offtopic:
Apple review passed, this lib is definitely safe for work!

Does not work well with react-native-navigation on iOS

Because of this TODO item: https://github.com/naoufal/react-native-payments/blob/master/packages/react-native-payments/lib/ios/ReactNativePayments.m#L60

When using react-native-navigation, it's possible that we add on more views using things like showModal, so the root controller has already presented another view controller, which results in a warning like

Warning: Attempt to present <PKPaymentAuthorizationViewController: 0x12de27c90>  on <RCCTabBarController: 0x12887cc00> which is already presenting <RCCNavigationController: 0x1281eb200>

And the apple pay view will just not show up.

Meeting Apple Store compliance

My understanding is Apple requires an in-app purchase option for any payments done through mobile apps. They want their 30% cut. Does using this library with Apply Pay work to comply with their requirements? I'm new to mobile payment processing and trying to understand how to offer payment/subscription systems in a RN app that meets Apple's guidelines. Do you have pointers to documentation perhaps?

canMakePayments in ReactNativePaymentsModule does not call errorCallback

I would like to check on Android, whether native payments are supported or not.

When native payments are not supported, the promise in canMakePayments in NativePayments.js is neither resolved nor rejected.

The reason seems to be that [ReactNativePayments.canMakePayments](https://github.com/naoufal/react-native-payments/blob/master/packages/react-native-payments/android/src/main/java/com/reactnativepayments/ReactNativePaymentsModule.java) native module does not call the error callback given to it.

Need help mapping functions while using with brain tree

I would like to use this library with existing BT setup we have. In our current setup, I have something like this:

// Get token from server
BTClient.setup(token);
BTClient.getCardNonce(card details)
...
// Pass nonce to the server and server creates a reference to this payment method

Later in Buy process
Pass the reference to the server that does the payment

Now with this library, I am not able to figure out how to achieve the same mapping? (i.e. I select apple pay as payment method in payment setup screen and during Buy process, pass the paymentResponse data to server)

Make it easier to check if native payments are available

In my case, any way, the API as it currently is, requiring me to construct a PaymentRequest to check if Apple Pay or Android Pay are available is a bit cumbersome. It's not necessarily the natural flow, where I would simply want to know if ApplePay is supported before I show the button, and then build the payment request.

I'd like to see a static, non-standard method, maybe PaymentRequest.nativePaymentsAvailable, that simply gives that answer. On iOS, it seems it's a static flag anyway. On Android, we might call IsReadyToPayRequest without any filter.

[iOS] Cannot Display PR from native Modal

When native Modal (e.g. modal solution provided by React Native) is open, Payment Request UI cannot be open - it seems to be covered by modal itself.

Javascript based modal views don't cause this troubles.

Improve docs

For some API, docs are incorrect (at least it looks like that)

I could not use NativePayments.complete(status: string) as described in docs. Possibly, there are other APIs affected

Worldpay

When do you plan to implement Worldpay ?

Cannot link to existing ExpoKit Project (iOS)

I had an existing app running in ExpoKit (which I think uses pod to manage dependencies). Doing react-native link react-native-payments doesn't correctly link this library as I get a 'React/RCTBridgeModule.h' file not found error during compile time in XCode. To solve this I:

  1. Added pod 'ReactNativePayments', :path => '../node_modules/react-native-payments/lib/ios' to my podfile.
  2. Had to add a homepage to the .podspec file and replace s.source_files = "ReactNativePayments/**/*.{h,m}" with s.source_files = "*.{h,m}" in it.

After running pod install everything works nicely but I get the sense that react-native link should work out of the box and I guess it isn't doing so because either the .podspec file is not formatted correctly or because it is not located in the same location as the package.json.

I've already forked this project and applied my solution but as I'm no iOS expert I don't want to send a pull request until @naoufal checks out what I've done.

I'm using react-native-cli v2.0.1 and react-native v52.0

Android cannot find "../common/App"

Hi,
I have cloned and started the example/native- App. I can build, but the packager shows:

Loading dependency graph, done.
Bundling `index.android.js`  [development, non-minified, hmr disabled]  0.0% (0/4), failed.
error: bundling failed: "Unable to resolve module `../common/App` from `/Users/fuerst/Documents/RN/AP/react-native-payments/packages/react-native-payments/examples/native/index.android.js`: could not resolve `/Users/fuerst/Documents/RN/AP/react-native-payments/packages/react-native-payments/examples/common/App' as a file nor as a folder"

I started the react-native run-android in /Users/fuerst/Documents/RN/AP/react-native-payments/packages/react-native-payments/examples/native

paymentToken is undefined

Following the docs. Was seeing if I am doing something wrong. I have Carthage setup along with linking stripe. Here is a snippet of my payment method

global.PaymentRequest = require("react-native-payments").PaymentRequest;

    const METHOD_DATA = [
      {
        supportedMethods: ["apple-pay"],
        data: {
          merchantIdentifier: "merchantIDGoesHere",
          supportedNetworks: ["visa", "mastercard", "amex"],
          countryCode: "US",
          currencyCode: "USD"
          // paymentMethodTokenizationParameters: {
          //     parameters: {
          //       gateway: "stripe",
          //       "stripe:publishableKey": "STRIPE-PK-KEY"
          //     }
          //   }
        }
      }
    ];

    const DETAILS = {
      displayItems: [
        {
          label: `${someTitle}`,
          amount: { currency: "USD", value: somePrice }
        }
      ],
      shippingOptions: [
        {
          id: "economy",
          label: "Economy Shipping",
          amount: { currency: "USD", value: "0.00" },
          detail: "Arrives in 3-5 days" // `detail` is specific to React Native Payments
        }
      ],
      total: {
        // Merchant Name
        label: "Merchant Name",
        amount: { currency: "USD", value: somePrice }
      }
    };

    const OPTIONS = {
      requestPayerEmail: true
    };

    const pr = new PaymentRequest(METHOD_DATA, DETAILS, OPTIONS);

    pr
      .show()
      .then(paymentResponse => {
        const { paymentToken } = paymentResponse.details;

        console.log("paymentToken", paymentToken); // undefined

        paymentResponse.complete("success");
      })
      .catch(e => {
        console.log(e);
        pr.abort();
      });
  };

Google Pay

Since Google no longer enables new Android Pay API now, do you plan to support Google Pay recently? Thanks.

[iOS] Correctly handle unavailable networks

Current behaviour
When using network not supported by iOS, app crashes.

Expected behaviour
App should not crash.
Possibly, in dev mode lib could log into console with warning about using network not supported by deployment target (OS version)

Resources

Found this Network-OS version availability information

./PassKit.framework/Headers/PKConstants.h-19-extern PKPaymentNetwork const PKPaymentNetworkAmex NS_AVAILABLE_IOS(8_0) __WATCHOS_AVAILABLE(3.0);
./PassKit.framework/Headers/PKConstants.h:20:extern PKPaymentNetwork const PKPaymentNetworkCarteBancaire NS_AVAILABLE_IOS(10_3) __WATCHOS_AVAILABLE(3.2);
./PassKit.framework/Headers/PKConstants.h-21-extern PKPaymentNetwork const PKPaymentNetworkChinaUnionPay NS_AVAILABLE_IOS(9_2) __WATCHOS_AVAILABLE(3.0);
./PassKit.framework/Headers/PKConstants.h-22-extern PKPaymentNetwork const PKPaymentNetworkDiscover NS_AVAILABLE_IOS(9_0) __WATCHOS_AVAILABLE(3.0);
./PassKit.framework/Headers/PKConstants.h-23-extern PKPaymentNetwork const PKPaymentNetworkInterac NS_AVAILABLE_IOS(9_2) __WATCHOS_AVAILABLE(3.0);
./PassKit.framework/Headers/PKConstants.h-24-extern PKPaymentNetwork const PKPaymentNetworkMasterCard NS_AVAILABLE_IOS(8_0) __WATCHOS_AVAILABLE(3.0);
./PassKit.framework/Headers/PKConstants.h-25-extern PKPaymentNetwork const PKPaymentNetworkPrivateLabel NS_AVAILABLE_IOS(9_0) __WATCHOS_AVAILABLE(3.0);
./PassKit.framework/Headers/PKConstants.h-26-extern PKPaymentNetwork const PKPaymentNetworkVisa NS_AVAILABLE_IOS(8_0) __WATCHOS_AVAILABLE(3.0);
./PassKit.framework/Headers/PKConstants.h-27-extern PKPaymentNetwork const PKPaymentNetworkJCB NS_AVAILABLE_IOS(10_1) __WATCHOS_AVAILABLE(3.1);
./PassKit.framework/Headers/PKConstants.h-28-extern PKPaymentNetwork const PKPaymentNetworkSuica NS_AVAILABLE_IOS(10_1) __WATCHOS_AVAILABLE(3.1);
./PassKit.framework/Headers/PKConstants.h:29:extern PKPaymentNetwork const PKPaymentNetworkQuicPay NS_AVAILABLE_IOS(10_3) __WATCHOS_AVAILABLE(3.2);
./PassKit.framework/Headers/PKConstants.h:30:extern PKPaymentNetwork const PKPaymentNetworkIDCredit NS_AVAILABLE_IOS(10_3) __WATCHOS_AVAILABLE(3.2);

Xamarin PassKit implementation

Possible Unhandled Promise Rejection (id: 0): 10

Hello guys, i am newbie in react native. Then i'm learning about this library. I just try to show react-native-android payments. But when i click the button i got an error .

Possible Unhandled Promise Rejection (id: 0): 10

    androidPay(){
    	const DETAILS = {
			  id: 'basic-example',
			  displayItems: [
			    {
			      label: 'Movie Ticket',
			      amount: { currency: 'USD', value: '15.00' }
			    }
			  ],
			  total: {
			    label: 'Merchant Name',
			    amount: { currency: 'USD', value: '15.00' }
			  }
			};
    	const METHOD_DATA = [{
			  supportedMethods: ['android-pay'],
			  data: {
			    supportedNetworks: ['visa', 'mastercard', 'amex'],
			    currencyCode: 'USD',
			    environment: 'TEST', // defaults to production
			    paymentMethodTokenizationParameters: {
			      tokenizationType: 'NETWORK_TOKEN',
			      parameters: {
			        publicKey: 'pk_test_jTdyDhKRi0XUBF12a3mALc4n'
			      }
			    }
			  }
			}];
			const paymentRequest = new PaymentRequest(METHOD_DATA, DETAILS)
			paymentRequest.show().then((response) => {
    		console.log(response)
    	})

    }

Android Pay ReactNativePayments is undefined

image

Every time I click Android pay button, it will show this error message. Please help.

"react": "16.0.0",
"react-native": "^0.51.0",
"react-native-payments": "^0.3.1",
"react-native-payments-addon-braintree": "^4.8.4-1",
"react-native-payments-cli": "^0.2.0",

dependencies {
compile project(':react-native-navigation')
compile project(':react-native-braintree-xplat')
compile project(':react-native-config')
compile project(':react-native-payments')
compile project(':react-native-maps')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.facebook.react:react-native:+" // From node_modules
compile project(":react-native-navigation")
compile 'com.google.android.gms:play-services-wallet:11.4.0'
compile 'com.android.support:support-v4:24.1.1'
compile 'com.android.support:appcompat-v7:24.1.1'
}

[iOS] Provide API for PKPaymentButton

Provide API for PKPaymentButton to help developer render Guidelines compliant payment button. Yes, Apple insist on visuals, let's make our lives easier.

This is WIP, PR coming soon

Error with gateways

canOpenURL: failed for URL: "com.venmo.touch.v2://x-callback-url/vzero/auth" - error: "This app is not allowed to query for scheme com.venmo.touch.v2"

image

Getting error when add addon-braintree

Hi guys,

I'm facing an issue when I add react-native-payments-addon-braintree (detail in my screenshot
image)
I have 2 questions:

  • How can I solve it?
  • Just wonder why a demo is added as an library?

I try to delete and reinstall node module still happen :(

Can not find show();

I completed the first three steps:
Registering as a Merchant
Importing the Library
Initializing the Payment Request

paymentRequest.show();Can not find it
wx20170811-181403

No mention of PaymentResponse.complete in the manual

Docs of this library say nothing about calling complete method on PaymentResponse instance. However, without this, the payments dialog just freezes in processing mode. Can you please add an example of how to use the library correcly?

Xcode (v 9.2) build fails after linking stripe

screen shot 2018-01-17 at 3 20 06 pm

The linking seems to have worked correctly, and carthage is installed (via brew), but the pictured build step fails with the error

Failed to read file or folder at /Users/David/Documents/app-name/ios/../node_modules/react-native-payments-addon-stripe/Carthage/Build/iOS/Stripe.framework

And indeed upon checking that location there is no folder called Carthage.

restore purchases

I have not found any way to restore purchased items, does this library not include this feature?

Adding cards

Is there any future plan to allow the ability to add cards?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.