npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

adyen-rn

v0.0.2

Published

React Native Adyen SDK

Downloads

1

Readme

react-native-adyen

React Native Adyen Module for iOS and Android. Adyen allows developers to collect payment details utilizing native components or via asymetric encryption. Native components can be broken down into Card Components, Redirect Component and 3DS2 Component. Native asymetric encryption encrypts card number, expiry date and cvc/cvv number.

Currently CCI, 3DS, 3DS2, Scheme Card Component, BCMC Card Component, iDEAL Card Component and EPS Card Component are supported. Currently Drop-in integration is not supported.

Since react-native 0.60 and higher, autolinking makes the installation process simpler.

Configuration

iOS

Edit the Podfile to update the iOS platform to 11.0 - platform :ios, '11.0'. Save the Podfile and install the pods.

pod install

Redirect / 3D Secure

To complete the Adyen redirect and properly receive the redirect result on iOS the deeplink URL will need to be listened to on the native delegate application:openUrl:options. Add a native file that contains the following:

import Foundation
import Adyen

@objc(RCTAdyenExample)
class RCTAdyenExample: NSObject {

  @objc(applicationDidOpen:)
  static func applicationDidOpen(_ url: URL) -> Bool {
     let adyenHandled = RedirectComponent.applicationDidOpen(from : url)

     return adyenHandled
  }
}

When the Adyen URL is received, execute the function RCTAdyenExample.applicationDidOpen(url) - the Adyen delegate function will be executed and the redirect result will be recieved through the pending promise.

Android

Redirect / 3D Secure

To complete the Adyen redirect and properly receive the redirect result on Android the expected Adyen scheme and host must be registered in the Android Manifest.

<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data
        android:host="${applicationId}"
        android:scheme="adyencheckout" />
</intent-filter>

When the Adyen URL is received, the awaited promise will receive the Redirect result.

Usage

Example

import React from 'react';
import {
  encrypt,
  handleAction,
  handleComponent,
} from 'react-native-adyen';

const adyen = () => {
  const cciRes = await encrypt('10001|...', {
    number: '4111111111111111',
    expiryMonth: '03',
    expiryYear: '30',
    securityCode: '737',
  });

  const actionRes = await handleAction(
    'test_',
    'test',
    PaymentMethods.redirect
  );

  const componentRes = await handleComponent(
    'test_',
    'test',
    paymentMethod,
    {
      currencyCode: 'EUR',
      value: 1000,
      countryCode: 'NL',
    }
  );

  .
  .
  .
};

Methods

Summary


encrypt()

const cciRes = await encrypt(publicKey, paymentDetails);

Adyen provides custom card integration via asymmetric encryption through the this function with providing the client public key and payment details.

Parameters:

| Name | Type | Required | Description | | -------------- | ------ | -------- | ----------- | | publicKey | string | Yes | See below. | | paymentDetails | object | Yes | See below. |

Supported options:

  • publicKey (string) - A public key linked to your API credential, used for client-side authentication.
  • paymentDetails (object) - The credit card number, expiry month, expiry year and cvc/cvv numbers.

handleAction()

const actionRes = await handleAction(clientKey, environment, action);

Adyen provides a redirect component for redirect actions / payment methods i.e. 3D Secure, 3D Secure 2, Redirect Payemnts.

Parameters:

| Name | Type | Required | Description | | ----------- | ------ | -------- | ----------- | | clientKey | string | Yes | See below. | | environment | string | Yes | See below. | | action | object | Yes | See below. |

Supported options:

  • clientKey (string) - A public key linked to your API credential, that the SDK Components use for client-side authentication.
  • environment (string) - Use test. When you're ready to accept live payments, change the value to one of our live environments.
  • action (object) - Payment object for some payment methods require additional action from the shopper such as: to authenticate a payment with 3D Secure, or to switch to another app to complete the payment.

handleComponent()

const componentRes = await handleComponent(clientKey, environment, paymentMethod, amount);

Adyen provides native component integration - Adyen takes care of the ui and controller logic and provides the developer with the resulting details.

Parameters:

| Name | Type | Required | Description | | ------------- | ------ | -------- | ----------- | | clientKey | string | Yes | See below. | | environment | string | Yes | See below. | | paymentMethod | object | Yes | See below. | | amount | object | Yes | See below. |

Supported options:

  • clientKey (string) - A public key linked to your API credential, that the SDK Components use for client-side authentication.
  • environment (string) - Use test. When you're ready to accept live payments, change the value to one of our live environments.
  • paymentMethod (object) - Decoded from the /paymentMethods response with the PaymentMethods structure. Find the payment method object for the Component that you want to instantiate.

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

UNLICENSED