end2endPay API Integration
  1. Android SDK
end2endPay API Integration
  • end2endPay API Specification
  • Inline Popup
  • v1 - Hosted session redirect
  • Server-to-server
    • Payload details
    • Pay With Card
      POST
    • Validate OTP
      POST
    • Initiate Pay with Transfer
      POST
    • Status check (PWT/USSD)
      POST
    • Get banks list - USSD
      GET
    • Generate USSD Code
      POST
    • Transaction Status Query
      GET
  • Plugins
  • Flutter SDK
    • End2EndPay Flutter SDK
  • Android SDK
    • End2EndPay Android SDK
  1. Android SDK

End2EndPay Android SDK

A secure and easy-to-use Android SDK for integrating End2EndPay payment processing into your Jetpack Compose applications.
Features
Click on me
šŸ”’ Secure WebView Integration - Industry-standard security practices
šŸŽØ Jetpack Compose Native - Built specifically for modern Android development
⚔ Easy Integration - Get started with just a few lines of code
šŸ”„ Real-time Callbacks - Success, error, and cancellation handling
āœ… Input Validation - Built-in validation for all payment parameters
šŸ“± Responsive - Works seamlessly across different screen sizes
Requirements
Android SDK: 26 (Android 8.0) or higher
Target SDK: 36
Kotlin: 1.9+
Jetpack Compose: 1.5+
Installation

Step 1: Add JitPack Repository#

Add JitPack to your project's settings.gradle.kts:

Step 2: Add Dependency#

Add the SDK to your app's build.gradle.kts:
šŸ’”

šŸš€ Quick Start#

Basic Implementation#

šŸ’”

šŸ“– Detailed Usage#

Complete Example with Navigation#

Parameter Validation#

The SDK automatically validates all inputs:
ParameterValidation RuleExample
apiKeyCannot be blank"KEY-E2E-xxx"
accessTokenCannot be blank"E2E_AK_xxx"
amountMust be > 0 and ≤ 999,999,999.9999.99
currencyMust be 3-letter ISO code"USD", "EUR", "NGN"
referenceCannot be blank, max 255 chars"ORDER-12345"
payerEmailMust be valid email format"user@example.com"
If validation fails, the onError callback is triggered immediately with a descriptive message.

šŸ”§ API Reference#

End2EndPayWebView#

Parameters

Callback Details#

onSuccess
Triggered when payment is completed successfully
Receives JSON response as a string containing transaction details
Example response: {"transactionId": "abc123", "status": "completed"}
onError
Triggered when payment fails or validation errors occur
Receives error message describing what went wrong
Common errors: validation failures, network issues, payment error
onCancel
Triggered when user cancels the payment
Receives cancellation message
User can retry payment or navigate away
šŸ“Œ

šŸ”’ Security Features#

The SDK implements multiple security layers:
āœ… JavaScript execution is sandboxed within the WebView
āœ… File access is disabled (allowFileAccess = false)
āœ… Content access is disabled (allowContentAccess = false)
āœ… Database storage is disabled
āœ… Geolocation is disabled
āœ… All credentials are passed securely to the payment gateway
āœ… HTTPS-only communication with End2EndPay servers

Best Practices#

1.
Never hardcode credentials - Store API keys securely using:
Android Keystore
Encrypted SharedPreferences
BuildConfig fields (for non-production)
2.
Validate on your backend - Always verify payments server-side
3.
Use ProGuard/R8 - Obfuscate your production builds
šŸ’”

šŸŽØ Customization#

Custom Styling with Modifier
Handling Different Screen States

šŸ“± Sample App#

This repository includes a fully functional sample app demonstrating best practices.
Running the Sample
1.
Clone the repository:
cd end2endpay-android-sdk
2. Open the project in Android Studio
3. Update credentials in sample/src/.../PaymentScreen.kt:
4.
Run the sample module

Sample Features#

āœ… Home screen with payment overview
āœ… Payment flow with status tracking
āœ… Navigation between screens
āœ… Success/error/cancel handling
āœ… Material 3 design implementation

šŸ› Troubleshooting#

Common Issues#

1
WebView not loading
Solution: Ensure JavaScript is enabled and you have internet permission
2
Callbacks not firing
Solution: Check that JavaScript interface is properly initialized
3
Validation errors
Solution: Verify all parameters meet the validation requirements

Debug Logging#

Enable WebView logging in debug builds:
Previous
End2EndPay Flutter SDK
Built with