Skip to content

Tap-Payments/TapSamsungPayKit

Repository files navigation

TapSamsungPayKit

A standalone kit for handling SamsungPay

Platform Documentation SDK Version SDK Version

Screen.Recording.2023-10-23.at.1.50.41.PM.mov

Table of Contents


  1. Requirements

  2. Installation

  3. Setup

    1. TapSamsungPayKit Class Properties
    2. Setup Steps
  4. Usage Configure SDK with Required Data

  5. TapSamsungPay_Delegate

    1. OnTapToken Success Callback
    2. OnError Callback
    3. OnSamsungPay_Token_Success Callback
    4. OnReady Callback
  6. Additional_Configuration_ GooglePay

  7. Documentation

Requirements


To use the SDK the following requirements must be met:

  1. Android Studio 2022.3.1 or newer
  2. Android SDK Tools 33 or newer
  3. Android Platform Version: API 33: Android 13 revision 7 or later
  4. **Android targetSdkVersion: 33

Installation with JitPack


JitPack is a novel package repository for JVM and Android projects. It builds Git projects on demand and provides you with ready-to-use artifacts (jar, aar).

To integrate TapSamsungPaySDK into your project add it in your root build.gradle at the end of repositories:

	allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}

Step 2. Add the dependency

	dependencies {
	        implementation 'com.github.Tap-Payments:TapSamsungPayKit:0.0.'
	}

Setup


Get your Tap keys

You can always use the example keys within our example app, but we do recommend you to head to our onboarding page. You will need to register your package name to get your Tap Key that you will need to activate our TapSamsungPaySDK.

Setup Steps

With PayButton

For those, who would like to use PayButton.

  1. Place PayButton.
  2. Assign its TapDataConfiguration and TapSamsungPayDelegate.
  3. Implement TapDataConfiguration and TapSamsungPayDelegate.

SamsungPay

  1. Ask for the CSR from Tap team.

  2. From your SamsungPay Developer account: a. Go to ServiceManagement Screen Shot 2023-10-19 at 4 37 43 PM

    Screen Shot 2023-10-19 at 4 40 17 PM

    b. Click on create Service , fill up the details Screen Shot 2023-10-19 at 4 40 28 PM

    c. Once everything is done service will appear as below Screen Shot 2023-10-19 at 4 44 46 PM

    d. Now you will find the service id generated use this to pass to the TapSDK Screen Shot 2023-10-19 at 4 40 56 PM

TapSamsungPaySDK Class Properties

First of all, TapSamsungPaySDK should be set up. To set it up, add the following lines of code somewhere in your project and make sure they will be called before any usage of TapSamsungPaySDK.

Below is the list of properties in tapGooglePaySDK class you can manipulate. Make sure you do the setup before any usage of the SDK.

Kotlin: Here we need to make a Top level declaration

 private lateinit var tapConfiguration: TapConfiguration

Usage


Configure SDK With Required Data

TapSamsungPaySDK should be set up. To set it up, add the following lines of code somewhere in your project and make sure they will be called before any usage of tapGoooglePaySDK.

Kotlin:

/**
         * Required step.
         * Configure SDK with your choice from the given list.
         */
       

private fun initConfigurations() {

   tapConfiguration =
      TapConfiguration.Builder()
         .setOperator(
            Operator.Builder()
               .setPublicKey("pk_test_XXXXXXXXXX")
               .setHashString("XXXXXXX")
               .build()
         )
         .setMerchant(
            Merchant.Builder().setId("Merchant Id associated with Tap ")
               .setGatwayId("tappayments").build())
         .setOrders(
            OrderDetail.Builder().setAmount( "0.2".toDouble()).setCurrency( "USD")//**Required**//
               .setShipping(Shipping("tester"),  "0.1").toDouble().setTax(Tax( "test"),  "0.1".toDouble()) //Optional
               .setOrderNumber( "AMZ333") //**Optional**//
               .build()
         )
         .setScope(Scope.SAMSUNG_TOKEN or Scope.TAP_TOKEN)
          Acceptance(
             supportedSchemes = mutableListOf(SupportedSchemes.VISA.name,SupportedSchemes.MASTERCARD.name,SupportedSchemes.AMERICAN_EXPRESS.name),
          )
         .setTapCustomer(getTapCustomer()) //**Required**//
         .setTapInterface(
            TapInterface(
               Language.EN.name,
               Edges.curved,
               ThemeMode.DARK, ColorStyle.colored.name)
            ) //Optional
         .setPackageName("Package Id registered with samsungpay")//**Required**//
         .setServiceId("Service id generated from samsungpay portal")//**Required**//
         .build()

}

Pass the above data to TapConfigurations as below:

 TapConfiguration.configureSamsungPayWithTapConfiguration(tapConfiguration, this)

Configure SDK Data

TapConfiguration is the main interface for library from you application

Properties

Property Type Description
tapSamsungPayDelegate Activity Activity. it is used to notify Merchant application with all SDK Events

Methods

Property Type
setCurrency Set the transaction currency associated to your account. currency must be of type TapCurrency("currency_iso_code"). i.e new TapCurrency("USD")
setOrders Set details related to transaction the amount currency , shipping , taxes etc
setGatewayId Gateway id required to use TAP as PSP . Here it is tappayments
setGatewayMerchantID MerchantID available with TAP
### SDK Open Interfaces

SDK open Interfaces available for implementation through Merchant Project:

  1. TapSamsungPayDelegate
     fun onError(error: String?)
     fun onSamsungPayToken(token: String)
     fun onReady(readyStatus: String)
     fun onTapToken(token: Token)
     fun onCancel()

SDK Open ENUMs

SDK open Enums available for implementation through Merchant Project:

enum class Scope {
   TAP_TOKEN,
   SAMSUNG_TOKEN
}


enum class ColorStyle {
   colored,
   monochrome
}

enum class ThemeMode {
   DARK,
   LIGHT,
}
enum class Language {
   EN,
   AR,
}


enum class SupportedSchemes {
   AMERICAN_EXPRESS,
   MASTERCARD,
   VISA,

}

enum class SDKMODE {
   SANDBOX,
   PRODUCTION,
}


enum class Edges {
   flat,
   curved
}

TapSamsungPay Delegate

TapSamsungPay Delegate is an interface which you may want to implement to receive payment status updates and update your user interface accordingly when payment window closes. Below are listed down all available callbacks:

SamsungPay Token Success Callback

Notifies the receiver that samsungpay token has succeed.

Declaration

Kotlin:

-  fun onSamsungPayToken(token:String)

Arguments

token: Successful Token object.

TAP Token Success Callback

Notifies the receiver that token generated for TAP .

Declaration

Kotlin:

-  fun onTapToken(token: Token)

Arguments

token: Token object from TAP.

<a name=failed_callback">

Error Callback

Notifies the receiver that failed.

Declaration

Kotlin:

-   fun onError(error: String?)

Arguments

error: Failure object.

Ready Callback

Notifies the receiver is ready.

Declaration

Kotlin:

-   fun onReady(readyStatus: String)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors