Giter Site home page Giter Site logo

adyen-react-native's Introduction

adyen-react-native

With Adyen SDK you can help your shoppers pay with a payment method of their choice, selected from a dynamically generated list of available payment methods. Method availability is based on shoppers’ location, transaction currency, and transaction amount.

To give you as much flexibility as possible, Adyen SDK can be integrated via this library in two ways:

  • Quick integration – Benefit from a fully optimized out-of-the-box UI with the SDK.
  • Custom integration – Design your own UI while leveraging the underlying functionality of the SDK.

Dependencies

  • Node.js
  • npm
  • Android studio, Android SDK and correct PATH/ANDROID_HOME for it.

MacOS only for creating IOS Builds

  • Xcode 10.2+
  • Cocoapods (for installing IOS dependencies)

Getting started

$ npm install adyen-react-native --save

Installation

$ react-native link adyen-react-native

IOS

  • Open ios directory in you project and run pod init

For ios < 10.2

  • Edit Podfile with following content
  platform :ios, '10.0'
  use_frameworks!
  target 'Your Target Name' do
	  pod 'AdyenReactNative', :path => '../node_modules/adyen-react-native'
  end
		
  post_install do |installer|
    installer.pods_project.targets.each do |target|
      if target.name == 'Adyen'
        target.build_configurations.each do |config|
          config.build_settings['SWIFT_VERSION'] = '4.0'
        end
      end
    end
  end
  • Run: $ pod install

  • Open YourProject.xcworkspace/

  • Open Your target > Build Settings and add $(SRCROOT)/../node_modules/adyen-react-native/ios to the Header Search Paths and Library Search Paths sections.

  • Click run or use $ react-native run-ios

For XCode > 10.2

  • React native version > 0.59.3
  • Edit Podfile with following content
  platform :ios, '11.0'
  use_frameworks!
  target 'Your Target Name' do
	  pod 'AdyenReactNative', :path => '../node_modules/adyen-react-native'
  end
  • Run: $ pod install

  • Modify the OS Version for AdyenReactNativeProject to 11.3 to avoid armv7 missing architecture

  • Replace the Adyen framework in your nodemodules ios folder with the newly swift 5 compiled version from the Pods to /node_modules/adyen-react-native/ios like below

image

Copy Adyen3DS2 from Pods/Adyen3DS2/Frameworks and then Copy from Products Folder Adyen.Framework,AdyenInternal.framework and AdyenInternal.bundle

image

  • Link the project manually

  • As per the facebook link below create a empty swift file and create the bridege in your parent RN project,

image

image

  • Within <YourProject.swift> empty file add the following,
import Foundation
import Adyen

@objc class AdyenObjectiveCBridge: NSObject {
  
  @objc(applicationDidOpenURL:)
  static func applicationDidOpen(_ url: URL) -> Bool {
     let adyenHandled = Adyen.applicationDidOpen(url)
     return adyenHandled
  }
}
  • AppDelegate.m file add the below function
.....
#import "<yourProjectName>-Swift.h"
.....
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options {
  
  BOOL handledAdyen =[AdyenObjectiveCBridge applicationDidOpenURL:url];
  
  return handledAdyen;
}
.....
  • Open YourProject.xcworkspace/

  • Open Your target > Build Settings and add $(SRCROOT)/../node_modules/adyen-react-native/ios to the Header Search Paths and Library Search Paths and Framework Search Paths

  • Click run or use $ react-native run-ios

Android

react-native link react-native-adyen should install all the dependency

Quick integration

Android

Credit Card            One-Click           

IOS

                    

Getting started

The Quick integration of the SDK provides UI components for payment method selection, entering payment method details (credit card entry form, iDEAL issuer selection, etc.). To get started, use the Adyen class to start the payment:

import Adyen from adyen-react-native

Add listeners for library's events

Send sdkToken and returnUrl to your own server, which then needs to forward this data, among some other parameters, to the Adyen Checkout API. See the API Explorer for more details.

Adyen.onRequestPaymentSession((token, returnUrl) => {
    //send request to a server and get paymentSession from an Adyen's server
});
Adyen.onPaymentResult((code, payload) => {
    //confirm payment
});

Adyen.onError((code, error) => {
    //payment was cancelled or something else
});

For starting payment proccess call:

Adyen.startPayment();
- Generating StartPaymentParameters

After receiving the payment session data from your own server, use the Adyen.confirmPayment to handle the payment session response:

Adyen.confirmPayment(response.paymentSession);

Custom integration

It will be implement as soon as possible. Thx.

Samples

See also

License

This repository is open source and available under the MIT license. For more information, see the LICENSE file.

adyen-react-native's People

Contributors

blackwave-rt avatar dmitry-blackwave avatar dmitrybwbelov avatar mkharibalaji avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

adyen-react-native's Issues

XCode 10 ios 12 Could not find module Adyen for arm64 architecture

Hi @dmitry-blackwave ,

image

I was getting the above error when i did your installation steps and these were my Adyen Pods that got installed,
Installing Adyen 2.8.1
Installing Adyen3DS2 (0.9.6)
Installing AdyenInternal 2.8.1
Using AdyenReactNative (1.2.0)

My Pod File,
`
platform :ios, '11.0'
use_frameworks!
target 'fermynt' do
pod 'AdyenReactNative', :path => '../node_modules/adyen-react-native'
end

post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == 'Adyen'
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.2'
end
end
end
end
`
But it didn't workout,so I did the manual linking as below and that too didn't work,

image

image

Could not find module Adyen for arm64 architecture

Compile Time Error.

Working versions?

I appreciate this library but it seems to be pretty broken. Is there any version which is known to be working?

With the sample repository I get:

/tmp/adyen-react-native-samples/QuickStart/node_modules/adyen-react-native/android/src/main/java/com/dblackwave/adyen/AdyenModule.java:5: error: package androidx.annotation does not exist
import androidx.annotation.NonNull;

With react-native 0.61 I was able to compile it but then get

D8: Cannot fit requested classes in a single dex file (# methods: 65961 > 65536)

onActivityResultComplete is undefined

Hi Dmitry,
Please advised on how to implement the function:

Adyen.onActivityResultComplete((payload) => {
// Handle payload.
});

as I get an undefined error when using it,

undefined is not a function (evaluating '_adyenReactNative.default.onActivityResultComplete').

an example would be much appreciated.

Thanks

App crash on android

Hello,

I have an issue,
My app crash when i call Adyen.confirmPayment(responseData.paymentSession)

Log:

06-17 11:47:38.182 976 1391 I ActivityTaskManager: START u0 {cmp=com.xxxxxx.app.prod/com.adyen.checkout.ui.internal.common.activity.CheckoutActivity (has extras)} from uid 10447
06-17 11:47:38.183 976 1391 E Parcel : Class not found when unmarshalling: com.adyen.checkout.core.internal.PaymentReferenceImpl
06-17 11:47:38.183 976 1391 E Parcel : java.lang.ClassNotFoundException: com.adyen.checkout.core.internal.PaymentReferenceImpl
06-17 11:47:38.183 976 1391 E Parcel : at java.lang.Class.classForName(Native Method)
06-17 11:47:38.183 976 1391 E Parcel : at java.lang.Class.forName(Class.java:454)
06-17 11:47:38.183 976 1391 E Parcel : at android.os.Parcel.readParcelableCreator(Parcel.java:3350)
06-17 11:47:38.183 976 1391 E Parcel : at android.os.Parcel.readParcelable(Parcel.java:3284)
06-17 11:47:38.183 976 1391 E Parcel : at android.os.Parcel.readValue(Parcel.java:3186)
06-17 11:47:38.183 976 1391 E Parcel : at android.os.Parcel.readArrayMapInternal(Parcel.java:3579)
06-17 11:47:38.183 976 1391 E Parcel : at android.os.BaseBundle.initializeFromParcelLocked(BaseBundle.java:292)
06-17 11:47:38.183 976 1391 E Parcel : at android.os.BaseBundle.unparcel(BaseBundle.java:236)
06-17 11:47:38.183 976 1391 E Parcel : at android.os.BaseBundle.getString(BaseBundle.java:1196)
06-17 11:47:38.183 976 1391 E Parcel : at android.content.Intent.getStringExtra(Intent.java:8889)
06-17 11:47:38.183 976 1391 E Parcel : at com.android.server.wm.ActivityStarter.executeRequest(ActivityStarter.java:1128)
06-17 11:47:38.183 976 1391 E Parcel : at com.android.server.wm.ActivityStarter.execute(ActivityStarter.java:894)
06-17 11:47:38.183 976 1391 E Parcel : at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1710)
06-17 11:47:38.183 976 1391 E Parcel : at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1560)
06-17 11:47:38.183 976 1391 E Parcel : at com.android.server.wm.ActivityTaskManagerService.startActivity(ActivityTaskManagerService.java:1512)
06-17 11:47:38.183 976 1391 E Parcel : at android.app.IActivityTaskManager$Stub.onTransact(IActivityTaskManager.java:1663)
06-17 11:47:38.183 976 1391 E Parcel : at android.os.Binder.execTransactInternal(Binder.java:1190)
06-17 11:47:38.183 976 1391 E Parcel : at android.os.Binder.execTransact(Binder.java:1159)
06-17 11:47:38.183 976 1391 E Parcel : Caused by: java.lang.ClassNotFoundException: com.adyen.checkout.core.internal.PaymentReferenceImpl
06-17 11:47:38.183 976 1391 E Parcel : ... 18 more

ON node_modules/adyen-react-natice/android/build.gradle a have this
dependencies {
compile 'com.facebook.react:react-native:+'
compile "android.arch.lifecycle:extensions:2.1.0"
compile "android.arch.core:runtime:2.1.0"
compile "android.arch.lifecycle:viewmodel:2.1.0"
compile "com.adyen.checkout:ui:2.4.5"
compile "com.adyen.checkout:core-card:2.4.5"
compile "com.adyen.checkout:util:2.4.5"
}

@mkharibalaji

Anybody know how to do this with React Native 60

Hey I'm upgrading to React Native 60 and this library was working following the advice with 59... but with the new autolinking either I get the old null module or if I link it the legacy way it can't find the RCTBridge.h file.

Cannot get property 'lifecycleVersion' on extra properties extension as it does not exist

Hi,

I am following error while running it on Android:

A problem occurred evaluating project ':adyen-react-native'.
> Cannot get property 'lifecycleVersion' on extra properties extension as it does not exist

My environment details is as follows:

"adyen-react-native": "^1.4.0",
"react": "17.0.2",
"react-native": "0.66.2",
Android Studio: 2020.3 AI-203.7717.56.2031.7784292,
AVD: Android 12

Thanks.

Custom integration help / ETA

Hello Dimitry,

Thanks for doing this react native module, do you need any help with the custom integration, I am using Stripe right now, and I will soo switch to Adyen, I can help you with the custom integration.
Do you have an ETA when the custom integration will be done ?

problem with ios implementation

Hi I can't get the implementation going...
if I add the .a files it says
Could not find module 'Adyen' for architecture 'x86_64';

if I don't it doesn't add the native module to the build and it dies

Updated documentation and examples

Hi all,

I believe others are having similar problems in setting up this library. Please can I ask whether anyone has a working example? Also, is this still being maintained?

Thanks,
Alex

Expo

Does it work with Expo?

Google Pay

How to implement Google Pay?
I added this npm to my project, but I only see "Credit Card"
Screenshot_1569853932

Initate payment

@dmitry-blackwave for Adyen.initiatePayment(paymentMethod, paymentMethodDetails);
if my payment method is credit card. Will paymentMethodDetails be an object of
{
encryptedCardNumber: ...,
encrytedSecurityCode: ...,
encryptedExpiryMonth: ...,
encryptedExpiryYear: ...,
}
If not how is initiate payment called?

Swift Compiler Errors on iOS implementation

Hello guys!

I did the integration as it says in readme and works fine for android but I'm facing some issues on implementing it on iOS. Do you have any ideas of what happens? I've added that switch for swift version but I m still getting these errors.

Pods version
Using Adyen (2.5.0)
Using AdyenInternal (2.5.0)
Using AdyenReactNative (1.2.0)

Screen Shot 2019-07-24 at 17 40 36

.idea and .gradle folders in /android folder

Hi!

First of all thanks for taking look at the problem of using Adyen with react-native since there is no support for this from Adyen itself. I will closely follow the development of this library since we are also planning to use Adyen payments in our applications and we are missing a way to implement custom UI for the input fields of card credentials. So perhaps we will contribute to this as well soon :)

One thing I noticed in the last updates is that there are hidden folders included in /android folder that normally should be ignored by .gitignore, otherwise they get overridden by local IDEs and creating uncommited changes locally.

Is it possible to exclude them in the next update please? Not urgent at all.

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.