Android SDK
Outcome - Integrate Paymob's native Android SDK
Last Updated Date - June 1, 2026
Supported payment methods
- Cards
- Wallets
- Google Pay
- Bank Installments
- vaLU
- Souhoola
- Forsa
- Premium6
- Aman Installments
Manual installation
Download SDK files (.jar/.aar)
Download the SDK from this link and unzip the “Sdk package” folder.
Locate the SDK files in app/libs/ folder
Copy the SDK folder into the libs directory of your Android project.


Add the repository to settings.gradle.kts
Add required local Repositories as follows:
repositories {
maven {
url = rootProject.projectDir.toURI().resolve("libs") }
maven {
url = uri("https://jitpack.io")
}
}


Add a dependency in app/build.gradle.kts
implementation("com.paymob.sdk:Paymob-SDK:{{latest version}}")//Please change this version number to match the version number of the downloaded sdk

Enable data binding in app/build.gradle.kts
Add your data-binding feature in BaseAppModuleExtensions as follows:
android {
buildFeatures { dataBinding = true } }

Sync gradle project
Usage imports
import com.paymob.paymob_sdk.PaymobSdk
import com.paymob.paymob_sdk.domain.model.CreditCard
import com.paymob.paymob_sdk.domain.model.SavedCard
import com.paymob.paymob_sdk.ui.PaymobSdkListener
Implement Paymob Sdk listener interface
class MainActivity : AppCompatActivity(), PaymobSdkListener { override fun onCreate(savedInstanceState: Bundle?) {…}
override fun onSuccess() {
//If the Payment is successful }
override fun onFailure() {
//If The Payment is declined }
override fun onPending() {
//If The Payment is pending }
}
override fun onCancelled() {
//If the customer manually canceled the payment, we suggest using the Transaction Inquiry API in this case, as the customer could cancel it at different stages.
}
Canceled status available starting from version 1.9.3
You should configure the response callback URL for the integration ID in use to the appropriate URL listed below, based on the region. This is required in order to run the callback functions (onSuccess, onFailure, and onPending).
Egypt: https://accept.paymob.com/api/acceptance/post_pay
Oman: https://oman.paymob.com/api/acceptance/post_pay
Saudi Arabia: https://ksa.paymob.com/api/acceptance/post_pay
United Arab Emirates: https://uae.paymob.com/api/acceptance/post_pay
Normal Checkout Flow
Create a PaymobSdk instance
You can create the PaymobSdk instance using PaymobSdk.Builder()
val paymobsdk = PaymobSdk.Builder(
context = this@MainActivity,
clientSecret = “CLIENT_SECRET”,//Place Client Secret here
publicKey = “PUBLIC_KEY”,//Place Public Key here
paymobSdkListener = this
)
.build()
Client Secret
A unique, intention-specific token used to redirect the customer to Paymob’s Unified Checkout or to render Paymob’s Pixel component.
You can get a client secret by calling the Create Intention API request.
Public Key
To know how to get your public key, please check the Getting Integration Credentials page.
To pass the saved token to the SDK, you should pass the token as a string to the card_tokens array while calling the intention creation request

For generating a save card token to be used within a Moto transaction later, please refer to this link for generating a save card token.
Customize the SDK payment sheet (Optional)
You can set the SDK buttons' color and buttons' text color using this builder object, for example:
val paymobsdk = PaymobSdk.Builder(
context = this@MainActivity,
clientSecret = “CLIENT_SECRET”,//Place Client Secret here
publicKey = “PUBLIC_KEY”,//Place Public Key here
paymobSdkListener = this,
)
.setButtonBackgroundColor(Color.BLACK)//changes the color of button backgrounds throughout the SDK, and set by default to black
.setButtonTextColor(Color.WHITE)//changes the color of button texts throughout the SDK, and set by default to white
.showSaveCard(showSaveCard ?: true) //changes the ability for the sdk to save the card info or no
.saveCardByDefault(saveCardDefault ?: false) //changes the ability for the sdk if the save card checkbox is checked ot not
.build()
Finally: Run the SDK
You can start the SDK by calling
sdk.start()
Embedded Checkout Flow
Add PaymobCheckoutView to Layout
Add the SDK view to your layout XML file. This view will be responsible for rendering the payment UI inside your screen.
<com.paymob.paymob_sdk.ui.embedded.PaymobCheckoutView
android:id="@+id/paymob_checkout_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>Configure the Embedded Checkout View
After adding the SDK view, the final step is to configure the SDK view.
class MainActivity : AppCompatActivity(), PaymobSdkListener {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val paymobCheckoutView =
findViewById<PaymobCheckoutView>(R.id.paymob_checkout_view)
val uiCustomizationJson = ""
paymobCheckoutView.configure(
activity = this@MainActivity,
uiCustomization = uiCustomizationJson,
showAddNewCard = true,
showSaveCard = true,
saveCardByDefault = false,
payFromOutside = false,
paymobSdkListener = this
)
}
}
Set Payment Keys
Whenever you make any update to the intention via the API, you need to update the intention data inside the SDK.
paymobCheckoutView.setPaymentKeys(
publicKey = "PUBLIC_KEY",
clientSecret = "CLIENT_SECRET"
)
Client Secret
A unique, intention-specific token used to redirect the customer to Paymob’s Unified Checkout or to render Paymob’s Pixel component.
You can get a client secret by calling the Create Intention API request.
Public Key
To know how to get your public key, please check the Getting Integration Credentials page.
UI Customization (Optional)
You can customize the UI using a JSON configuration (All customization attributes are optional):
val fontId = R.id.my_font
val uiCustomizationJson = """
{
"Font_Family": $fontId,
"Font_Size_Label": "17",
"Font_Size_Input_Fields": "11",
"Font_Size_Payment_Button": "16",
"Font_Weight_Label": "500",
"Font_Weight_Input_Fields": "500",
"Font_Weight_Payment_Button": "700",
"Color_Border_Input_Fields": "#DBE1EA",
"Color_Disabled": "#00000080",
"Color_Error": "#FF0000",
"Color_Primary": "#144DFF",
"Color_Input_Fields": "#FFFFFF",
"Text_Color_For_Label": "#000000",
"Text_Color_For_Payment_Button": "#FFFFFF",
"Text_Color_For_Input_Fields": "#000000",
"Color_For_Text_Placeholder": "#C7C7CD",
"Payment_Button_Title": "Pay Now",
"Radius_Border": "30",
"Container_Padding": "40"
}
""".trimIndent()
paymobCheckoutView.configure(
activity = this@MainActivity,
uiCustomization = uiCustomizationJson,
paymobSdkListener = this
)
Trigger Payment from a Custom Button (Optional)
By default, the embedded component includes its own Pay button.
If the merchant wants to trigger payment from a custom button, follow these steps:
1
Enable the external trigger while configuring the Embedded Checkout View
paymobCheckoutView.configure(
activity = this@MainActivity,
uiCustomization = uiCustomizationJson,
showAddNewCard = true,
showSaveCard = true,
saveCardByDefault = false,
payFromOutside = true,
paymobSdkListener = this
)
2
Call the payment function
Inside the button click logic, call the PayFromOutside function:
paymobCheckoutView.PayFromOutside()
Test Credentials
To test the payment cycle, you need to use test credentials for Card and Wallet. Please check the Test Credentials page.
On this page
- Android SDK