NeXTSTEP Programming Mastermind

    rns-paypal-wrapper

    1.0.0 • Public • Published

    rns-paypal-wrapper

    add invoiceNumber for android, welcome to pr for IOS

    React Native PayPal wrapper for iOS and Android

    Getting started

    $ yarn add rns-paypal-wrapper

    Installation

    $ react-native link rns-paypal-wrapper

    Extra steps for iOS 🙄 see here

    Usage

    Payment

    import PayPal from 'rns-paypal-wrapper';
     
    // 3 env available: NO_NETWORK, SANDBOX, PRODUCTION
    PayPal.initialize(PayPal.NO_NETWORK, "<your-client-id>");
    PayPal.pay({
      price: '40.70',
      currency: 'MYR',
      description: 'Your description goes here',
      invoiceNumber: 'Your invoiceNumber' // only android
    }).then(confirm => console.log(confirm))
      .catch(error => console.log(error));

    FuturePayment

    import PayPal from 'rns-paypal-wrapper';
     
    // Required for Future Payments
    const options = {
      merchantName : "Merchant name",
      merchantPrivacyPolicyUri: "https://example.com/privacy",
      merchantUserAgreementUri: "https://example.com/useragreement",
    }
    // 3 env available: NO_NETWORK, SANDBOX, PRODUCTION
    PayPal.initializeWithOptions(PayPal.NO_NETWORK, "<your-client-id>", options);
     
    PayPal.obtainConsent().then(authorization => console.log(authorization))
      .catch(error => console.log(error));
     
    // To decrease payment declines, you must specify a metadata ID header (PayPal-Client-Metadata-Id) 
    // in the payment call. See docs: 
    // https://developer.paypal.com/docs/integration/mobile/make-future-payment/#required-best-practices-for-future-payments
     
    const metadataID = await PayPal.getClientMetadataId();
     

    Acknowledgement

    This project is fork https://github.com/taessina/react-native-paypal-wrapper

    Install

    npm i rns-paypal-wrapper

    DownloadsWeekly Downloads

    1

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    58.4 MB

    Total Files

    20

    Last publish

    Collaborators

    • jindada