Giter Club home page Giter Club logo

netaxept-android-sdk's Introduction

PiA - Netaxept Android SDK v1.5.0


Logo

PiA Netaxept Android SDK is a library that provides the native In-App interaction of performing the Netaxept payment directly from an app on the Android device and minimizes PCI DSS requirements for you.

PiA - Netaxept iOS SDK can also be found here

Installation


In your build.gradle application level file, add:

implementation('eu.nets.pia:pia-sdk:1.5.0') { transitive = true; changing=true; }

Important: for the release version of your .apk, add the following rules in your application's proguard-rules.pro file:

#Rules required by Card.Io library
-keep class eu.nets.pia.cardio.** { *; }
-dontwarn eu.nets.pia.cardio.**

Note: the library is available through both jcenter() and mavenCentral() repositories.

Frequently Asked Questions


If you encounter any blockers when integrating the Netaxept - Android SDK, feel free to check the Frequently Asked Questions page. If any of these answers does not fit your question, don't hesitate to contact us.

Requirements


Minimum supported Android version is 5.0 - Due to PCI DSS requirements and known vulnerabilities in secure protocols less than TLS 1.2, TLS 1.2 is the only secure protocol available when connecting towards Netaxept. For this reason, we don't support the Android versions lower than 5.0 which are NOT enabled/supported TLS 1.2 by default. For more information, you can check the details from Netaxept.

Permissions


These permissions are handled inside the binary, and your integration won't require any additional changes.

PiA SDK will require the internet permissions to be fully operational.

<uses-permission android:name="android.permission.INTERNET" />

CardIo library integrated by PiA SDK will also require permission for Camera and Vibrate.

 <uses-permission android:name="android.permission.CAMERA" />
 <uses-permission android:name="android.permission.VIBRATE" />

Examples


We have provided a Sample Application to help you understand the use cases of the SDK functionalities. All you need to do is to setup your Back-End solution with Netaxept (see more), get the source code (check ReadMe on how to do basic setup) and then run it.

Project Status


Supported payment methods:

  • Cards: Visa, Mastercard, American Express, Diners, JCB, Maestro, Dankort, PayPal
  • Vipps
  • Swish
  • Mobile wallets (MobilePay) โ€“ available soon

Usage


Depending on your selected payment method, the SDK can be launched in multiple functionalities: Register Card, Basic Payment, Easy Payment, PayPal Payment etc. Please check our full documentation to see more.

In the example below, the SDK is launched to perform a payment with a new card.

  • Create you own RegisterPayment handler, implementing the SDK's RegisterPaymentHandler
    public class RegisterPaymentHandlerImpl implements RegisterPaymentHandler {
         @Override
        public TransactionInfo doRegisterPaymentRequest(boolean saveCard) {
            PaymentFlowCache paymentFlowCache = PaymentFlowCache.getInstance();
            PaymentRegisterRequest paymentRegisterRequest = paymentFlowCache.getPaymentRegisterRequest();
            paymentRegisterRequest.setStoreCard(saveCard);

            MerchantRestClient.getInstance().registerPayment(paymentRegisterRequest);

            if (!paymentFlowCache.isFinishedWithError()) {
                PaymentRegisterResponse paymentRegisterResponse = paymentFlowCache.getPaymentRegisterResponse();
                return new TransactionInfo(paymentRegisterResponse.getTransactionId(),
                        paymentRegisterResponse.getRedirectOK());
            }

            return null;
        }
    }
  • Initialize and launch SDK to perform payment:
    public class MainActivity extends AppCompatActivity {

        private RegisterPaymentHandler mRegisterPaymentHandler;
        private static final String CURRENCY = "EUR";
        private static final String ORDER_NUMBER = "PiaSDK-Android";

         @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            mRegisterPaymentHandler = new RegisterPaymentHandlerImpl();

        }

        private MerchantInfo getMerchantInfo() {
            boolean testMode = true; //Notify the SDK to use the test environment
            return new MerchantInfo(BuildConfig.MERCHANT_ID, testMode);
        }

        private OrderInfo getOrderInfo() {
            String priceString = mPriceView.getText().toString();
            double price = priceString.isEmpty() ? 0 : Double.parseDouble(priceString);

            return new OrderInfo(
            price,
            CURRENCY
            );
        }

        private void callPiaSDK(PaymentMethod method) {
            Bundle bundle = new Bundle();
            bundle.putParcelable(PiaActivity.BUNDLE_MERCHANT_INFO, getMerchantInfo());
            bundle.putParcelable(PiaActivity.BUNDLE_ORDER_INFO, getOrderInfo());
            PiaSDK.getInstance().start(MainActivity.this, bundle, mRegisterPaymentHandler);
        }
    }
  • In the activity which launched the SDK, override the onActivityResult() to handle the SDK result:
...
        @Override
        protected void onActivityResult(int requestCode, int resultCode, Intent data) {

            if (requestCode != PiaSDK.PIA_SDK_REQUEST) {
                super.onActivityResult(requestCode, resultCode, data);
                return;
            }

            //in case user cancelLed
            Bundle bundle = new Bundle();
            if (resultCode == RESULT_CANCELED) {
                rollbackTransaction();
                return;
            }

            if (resultCode == RESULT_OK) {
                PiaResult result = data.getParcelableExtra(PiaActivity.BUNDLE_COMPLETE_RESULT);
                if (result.isSuccess()) {
                    //in case of success, commit the payment
                    mRestClient.commitPayment(
                                mPaymentCache.getPaymentRegisterResponse().getTransactionId()
                            );
                } else {
                    // Otherwise, handle the failure case
                }
            }
        }
...

Contact


If you have any question or feedback, please contact us via email: [email protected]

License


Please check License file.

netaxept-android-sdk's People

Contributors

buildmanager-nets avatar miss-pia avatar

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.