Skip to content

React native bridge for Paypal (iOS and Android) mobile SDKs

License

Notifications You must be signed in to change notification settings

narayananvenk/react-native-paypal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Paypal for React Native

Setup:

  1. Android setup
  2. iOS setup
  3. import Paypal from "react-native-paypal";
This module supports Paypal versions 2.15.3 for android and 2.16.3 for iOS.

Methods:

  1. configure(<params object>)

    Configure Paypal for single payment. Call this only once in your application.

    <params object>
    Name Type Optional Description
    environment String Paypal.SANDBOX
    Paypal.NO_NETWORK
    Paypal.PRODUCTION
    clientId String
    merchantName String
    acceptCreditCards boolean Yes Indicate whether credit card support should be enabled. Defaults to true
    defaultUserEmail String Yes
    defaultUserPhone String Yes
    defaultUserPhoneCountryCode String Yes
    rememberUser boolean Yes Defaults to true
  2. isProcessable(<params object>, <callback>)

    Checks if the payment object can be processed. The callback returns false for cases such as negative amount, currency string not recognized etc.

    <params object>
    Name Type Optional Description
    amount Number
    currency String
    description String
    bnCode String Yes Build Notation Code
    custom String Yes
    invoiceNumber String Yes
    softDescriptor String Yes
    shippingAddress Object Yes
    paymentDetails Object Yes
    <shippingAddress object>
    Name Type Optional Description
    recipientName String
    line1 String
    line2 String Yes
    postalCode String Yes
    city String
    state String Yes
    countryCode String Yes
    <paymentDetails object>
    Name Type Optional Description
    shipping Number
    subtotal Number
    tax Number
  3. singlePayment(<params object>, <success callback>, <failure callback>)

    Process a single payment using the sdk. The success callback will return a confirmation object. Sample confirmation object and steps to verify payment can be found here. The failure callback can have one of 2 error codes, Paypal.ERROR_USER_CANCELED or Paypal.ERROR_INVALID_CONFIG (only for android).

    <params object> is the same as defined for isProcessable.

  4. logout()

    Deletes all remembered user data (credit cards, paypal account, email, phone). This can be used while logging out a user in the app.