Giter VIP home page Giter VIP logo

acquired-sdk-android's Introduction

Acquired Android Library

Requirements

  • Android 6.0+
  • Android SDK 23 or later

HPP Library Installation

Gradle users

Add this dependency to your project's build file:

implementation 'com.github.AcquiredSupport:Acquired-SDK-Android:v1.0.0'

Manual

You can integrate the Acquired Android Library into your project manually.

Documentation

https://developer.acquired.com/integrations/hpp

Using the HPP Library

Initiation

To initiate an instance of the HPP payment form do the following:

HPPSetting hppSetting = new HPPSetting(211, 1229, "hashcode");
hppSetting.setIsDebug(true);
hppSetting.setOrderId(generateOrderId());
hppSetting.setTransactionType("AUTH_ONLY");
hppSetting.setCurrencyCode("GBP");
hppSetting.setAmount(Float.valueOf("100.1"));
hppSetting.setErrorUrl("https://www.yourwebsite.com/error");

HPPManager.init(view.getContext(), hppSetting);

Integrate With Your Server

The HPPManager requires some HPP settings which you can get on Acquired Dashboard (server side).

  1. Company ID: Utilising one of the Acquired HPP server SDKs; company_id is necessary to create an instance of HppSetting which is required for HPPManager.

  2. Company MID ID: Using this value the SDK will choose the default template that has been uploaded through the Acquired Dashboard.

  3. Hash Code: This parameter is used to encode the requests of HPP, a new hash will be generated, server side will check the validity of the hash and decode the response.

HPPSetting hppSetting = new HPPSetting(211, 1229, "hashcode");

Present Payment Form

Insert the code fragment into your activity to present a payment form as follows:

HPPManager.init(view.getContext(), hppSetting);

Executing this code, HPPManager will process the given parameters (HppSetting), get the request from the server, send the encoded request to HPP and present the form received back.

HPP Response

On the server-side you can set your own return url or call back url, HPP will handle response automatically that you don't have to do any response handling on your APP. You can also set another return url or call back url when calling HPPManager in your APP:

hppSetting.setReturnUrl("xxxx");
hppSetting.setCallBackUrl("xxxx");

FAQ

Set HPP Properties

HppSetting is used to provide all parameters that server requires: card detail, shipping address, billing address..., etc. You can also set whatever HPP properties you need to in the component, for example;

hppSetting.setIsDebug(true);
hppSetting.setOrderId(generateOrderId());
hppSetting.setCurrencyCode("GBP");
hppSetting.setAmount(Float.valueOf("100.1"));
hppSetting.setBillingEmail("[email protected]");
...

These will be sent to the Request Producer URL, your server-side code must be setup to take in these values and pass them to the HPP server-side SDK for them to be included in the request.

Testing

Acquired maintains separate endpoints for live and test transactions. Use the code below:

hppSetting.setIsDebug(true);

License

See the LICENSE file.

acquired-sdk-android's People

Contributors

acquiredsupport avatar githusband avatar lxp916 avatar

Watchers

 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.