Skip to content

seerbit/seerbit-java-api-library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 

Repository files navigation

seerbit-java-v1

A Seerbit API Library for Java (Version 1)

Features

The Library supports all APIs under the following services:

  • Payment via API (card and account)
  • Disputes
  • Refunds
  • Transaction Status

Getting Started

A full getting started guide for integrating SeerBit can be found at getting started docs.

Documentation

The documentation, installation guide, detailed description of the SeerBit API and all of its features is available on the documentation website

Requirements

  • Java 8 or higher
  • Maven

Installation

Maven

Add this dependency to your project's POM:

<dependency>
  <groupId>com.seerbit</groupId>
  <artifactId>seerbit-java-api</artifactId>
  <version>1.0</version>
</dependency>

Contributing

You can contribute to this repository so that anyone can benefit from it:

  • Improved features
  • Resolved bug fixes and issues

Examples

You can also check the src/main/java/com/seerbit/demo folder in this repository for more examples of usage.

Using the Library

Initiate Card Transaction

Instantiate a client and set the parameters.

    Seerbit seerbitApp = new SeerbitImpl();
    Client client = new Client();
    client.setAPIBase(seerbitApp.getApiBase());
    client.setEnvironment(EnvironmentEnum.LIVE.getEnvironment());
    client.setPublicKey("public_key");
    client.setPrivateKey("private_key");
    client.setTimeout(20);

To initiate a transaction request you need to perform a transaction authentication.

    TransactionAuthenticationImpl authService = new TransactionAuthenticationImpl(client);
    JsonObject response = authService.doAuth();

Then retrieve your token after authenticating and pass it to the CardService constructor along with your client object. You can then construct your payload and call the doAuthorize() method of the CardService class.

    String token = authService.getToken();
  
    CardService cardService = new CardServiceImpl(client, token);

    CardDetail cardDetail = new CardDetail();
    cardDetail.setCvv("100");
    cardDetail.setNumber("5123450000000008");
    cardDetail.setExpiryMonth("05");
    cardDetail.setExpiryYear("21");
    cardDetail.setPin("1234");

    Card card = new Card();
    card.setFullname("Sambo Chukwuma Adetutu");
    card.setPublicKey(client.getConfig().getPublicKey());
    card.setTransactionReference("trx00001");
    card.setEmail("sambo@example.com");
    card.setMobile("08012345678");
    card.setChannelType("account");
    card.setDeviceType("Nokia 3310");
    card.setSourceIP("127.0.0.20");
    card.setType("3DSECURE");
    card.setCurrency("NGN");
    card.setDescription("put a descriptive message here");
    card.setCountry("NG");
    card.setFee("1.00");
    card.setAmount("150.00");
    card.setClientAppCode("appl");
    card.setCallbackUrl("http://www.example.com");
    card.setRedirectUrl("http://www.example.com");
    card.setCardDetail(cardDetail);

    JsonObject json = cardService.doAuthorize(card);

Find more examples here.

Licence

GNU General Public License. For more information, see the LICENSE file.

Website