Security Best Practices
Follow these security guidelines to ensure your integration is secure and compliant with payment industry standards.
Overview
Follow these security guidelines to ensure your integration is secure and compliant with payment industry standards.
Credential Security
Never hardcode credentials
Environment Separation
Isolate dev and production
PIN Protection
Enable PIN pad shuffling
Location Validation
Detect mocked locations
Session Management
Handle expiry gracefully
Data Protection
Never log sensitive data
Credential Management
Best practices for managing auth tokens and credentials securely.
Use Auth Tokens
Prefer authCode over email/password in production. Tokens can be revoked without password changes.
Store Securely
Store credentials in Android Keystore or Encrypted SharedPreferences — never in plain SharedPreferences or code.
Rotate Regularly
Rotate auth tokens on a schedule. Use short-lived tokens where possible.
Never in Source Code
Do not put a token in your source code.
BuildConfig Fields for DEMO
A DEMO test token can be a BuildConfig field injected from your CI/CD pipeline. Never the production token: everything inside the APK can be extracted.
Production Token at Runtime
Get the production token from your own backend over HTTPS at runtime, then keep it in secure storage. You get SDK tokens from EdfaPay.
On docs.edfapay.com
Token security in the dashboard (disable, rotate): Token security notes.
Loading...Risk
Hardcoded credentials can be extracted from APK files. Always use secure storage mechanisms like Android Keystore or Encrypted SharedPreferences.
Environment Separation
Use Env.DEMO while you develop and test, and Env.PRODUCTION for live payments. DEMO never charges a card. Keep separate credentials for development and production. Env.SANDBOX is legacy; do not use it.
Loading...PIN Pad Security
Enable PIN pad shuffling to prevent shoulder surfing and improve security for PIN-based transactions.
Loading...Compliance
PIN pad shuffling is required for transactions involving PIN verification in many markets. Enable it by default for production builds.
Location Validation
A card payment needs the ACCESS_FINE_LOCATION permission (precise location). Without it the payment does not start and onError receives "Location permission required to pay". initiate() does not need it. Request the permission before the first payment.
Loading...Session Security
Handle session expiry gracefully and implement secure re-authentication flows.
Loading...Session Expiry
A session can expire or be refused by the server. Session loss reaches onError as EdfaError.Generic.Custom (code -1 or 401) with one of the session messages listed in Error Handling, Common Errors. When you get one, call initiate() again.
Device Security ChecksNew in v1.0.8
Utils.securityThreats() scans the device and returns the ids of the threats it found, for example ROOTED_DEVICE. It checks for an attached debugger, ADB, developer options, a debuggable app, root, an unlocked bootloader, a custom ROM, an emulator, hooking frameworks, a network proxy, a VPN, a Wi-Fi network it considers unsecured, a mock GPS location, automatic time turned off, missing hardware-backed key storage (TEE/StrongBox), NFC that is missing or turned off, and no internet connection. The SDK does not act on the result: your app decides what to do. You can also present the built-in Safe/Detected report screen, and switch checks on or off with a configuration from EdfaPay.
Remote on/off configuration
updateSecurityChecks(config) takes an encrypted configuration string that EdfaPay provides, in the same format as setPartnerConfig. Its content is {"enabled": bool, "checks": {THREAT: bool}}. enabled false turns every check off; a check missing from checks stays on, and only an explicit false turns it off. An invalid string throws an EdfaException. Utils.securityThreats() never throws; a check that fails with an error reports nothing.
Scan & report
securityThreats() runs the scan and returns the detected threat ids; showSecurityStatus() presents the report screen (pass the scan result to avoid re-scanning, or omit it to let the screen scan itself; in Java pass null). updateSecurityChecks() applies the on/off configuration from EdfaPay to the next scans.
Loading...Production Checklist
Verify each item before deploying your integration to production. Logs may contain sensitive data. Turn on enableLogs only on test devices, never in builds you share.
On docs.edfapay.com
The business go-live steps (SoftPOS tab) are in the Go-live checklist; this list covers the SDK integration.
| Item | Status |
|---|---|
| Remove hardcoded credentials | Required |
| Set environment to PRODUCTION | Required |
| enableLogs off in every build you share | Required |
| Enable PIN shuffle | Recommended |
| Location permission requested before the first payment | Required |
| Handle session expiry | Required |
| Test every flow on DEMO (never charges a card) | Required |
Network Security
Network practices for your app and your release build.
HTTPS Only
Use HTTPS for every call your app makes, including the call that fetches the SDK token. Never use HTTP endpoints.
ProGuard
Ensure proguard-rules.pro includes keep rule for com.edfapay.** classes.
Remote TCP Channel
RemoteChannel TCP socket is unencrypted — only use on isolated, trusted networks.
On this page
Downloads
Coming SoonSample apps, release bundles, and more content will be available here soon.