diff --git a/android/build.gradle b/android/build.gradle
index 34b69b5..63187c1 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -100,7 +100,7 @@ dependencies {
implementation "com.facebook.react:react-native:+"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
// implementation fileTree(dir: 'libs', include: ['*.aar'])
- implementation("com.paymob.sdk:Paymob-SDK:1.9.3"){
+ implementation("com.paymob.sdk:Paymob-SDK:1.9.5"){
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
exclude group: 'com.squareup.okio', module: 'okio'
}
diff --git a/android/libs/com/paymob/sdk/Paymob-SDK/1.9.3/Paymob-SDK-1.9.3.aar b/android/libs/com/paymob/sdk/Paymob-SDK/1.9.5/Paymob-SDK-1.9.5.aar
similarity index 54%
rename from android/libs/com/paymob/sdk/Paymob-SDK/1.9.3/Paymob-SDK-1.9.3.aar
rename to android/libs/com/paymob/sdk/Paymob-SDK/1.9.5/Paymob-SDK-1.9.5.aar
index 6eb46de..36c6bb7 100644
Binary files a/android/libs/com/paymob/sdk/Paymob-SDK/1.9.3/Paymob-SDK-1.9.3.aar and b/android/libs/com/paymob/sdk/Paymob-SDK/1.9.5/Paymob-SDK-1.9.5.aar differ
diff --git a/android/libs/com/paymob/sdk/Paymob-SDK/1.9.3/Paymob-SDK-1.9.3.pom b/android/libs/com/paymob/sdk/Paymob-SDK/1.9.5/Paymob-SDK-1.9.5.pom
similarity index 99%
rename from android/libs/com/paymob/sdk/Paymob-SDK/1.9.3/Paymob-SDK-1.9.3.pom
rename to android/libs/com/paymob/sdk/Paymob-SDK/1.9.5/Paymob-SDK-1.9.5.pom
index f9d6c36..7aee60b 100644
--- a/android/libs/com/paymob/sdk/Paymob-SDK/1.9.3/Paymob-SDK-1.9.3.pom
+++ b/android/libs/com/paymob/sdk/Paymob-SDK/1.9.5/Paymob-SDK-1.9.5.pom
@@ -3,7 +3,7 @@
4.0.0
com.paymob.sdk
Paymob-SDK
- 1.9.3
+ 1.9.5
aar
diff --git a/android/libs/com/paymob/sdk/Paymob-SDK/maven-metadata.xml b/android/libs/com/paymob/sdk/Paymob-SDK/maven-metadata.xml
index f4278ca..3a77e58 100644
--- a/android/libs/com/paymob/sdk/Paymob-SDK/maven-metadata.xml
+++ b/android/libs/com/paymob/sdk/Paymob-SDK/maven-metadata.xml
@@ -3,11 +3,11 @@
com.paymob.sdk
Paymob-SDK
- 1.9.3
- 1.9.3
+ 1.9.5
+ 1.9.5
- 1.9.3
+ 1.9.5
- 20260719143255
+ 20260818214641
diff --git a/android/src/main/java/com/paymobreactnative/PaymobReactnativeModule.kt b/android/src/main/java/com/paymobreactnative/PaymobReactnativeModule.kt
index a3a4b49..30617a0 100644
--- a/android/src/main/java/com/paymobreactnative/PaymobReactnativeModule.kt
+++ b/android/src/main/java/com/paymobreactnative/PaymobReactnativeModule.kt
@@ -10,6 +10,7 @@ import com.facebook.react.bridge.ReactMethod
import com.facebook.react.bridge.ReadableArray
import com.facebook.react.bridge.WritableMap
import com.paymob.paymob_sdk.PaymobSdk
+import com.paymob.paymob_sdk.FailureCallBackVersion
import com.paymob.paymob_sdk.domain.model.CreditCard
import com.paymob.paymob_sdk.domain.model.SavedCard
import com.paymob.paymob_sdk.ui.PaymobSdkListener
@@ -26,6 +27,7 @@ class PaymobReactnativeModule(reactContext: ReactApplicationContext) :
private var showSaveCard: Boolean? = null
private var showResultsPage: Boolean? = null
private var showTransactionResult: Boolean? = null
+ private var failureCallBackVersion: FailureCallBackVersion? = null
override fun getName(): String {
return "PaymobReactnative"
@@ -120,6 +122,15 @@ class PaymobReactnativeModule(reactContext: ReactApplicationContext) :
fun setKeyboardHandlingEnabled(isEnabled: Boolean) {
}
+ /**
+ * Sets the failure callback version used by the native SDK.
+ * Accepts values like "V1", "V2" (case-insensitive).
+ */
+ @ReactMethod
+ fun setFailureCallbackVersion(version: String) {
+ failureCallBackVersion = if (version.equals("v2", true)) FailureCallBackVersion.V2 else FailureCallBackVersion.V1
+ }
+
/**
* Presents the payment view controller with the specified parameters.
*
@@ -144,6 +155,7 @@ class PaymobReactnativeModule(reactContext: ReactApplicationContext) :
showSaveCard?.let { showSaveCard(it) }
showResultsPage?.let { showResultPage(it) }
showTransactionResult?.let { showTransactionResult(it) }
+ failureCallBackVersion?.let { setFailureCallbackVersion(it) }
}.build().start()
}
@@ -167,7 +179,7 @@ class PaymobReactnativeModule(reactContext: ReactApplicationContext) :
* Called when the payment process fails.
*/
override fun onFailure(msg: String) {
- emitTransactionStatus("Fail")
+ emitTransactionStatus("Fail", failureMessage = msg)
}
/**
@@ -199,7 +211,7 @@ class PaymobReactnativeModule(reactContext: ReactApplicationContext) :
* @param status The status of the transaction.
* @param payResponse A map containing the payment response data (optional).
*/
- private fun emitTransactionStatus(status: String, payResponse: HashMap? = null) {
+ private fun emitTransactionStatus(status: String, payResponse: HashMap? = null, failureMessage: String? = null) {
// Create a WritableMap to send to React Native
val statusMap: WritableMap = Arguments.createMap()
@@ -217,6 +229,9 @@ class PaymobReactnativeModule(reactContext: ReactApplicationContext) :
// If no payResponse, we can still send a null or empty details map
statusMap.putMap("details", Arguments.createMap())
}
+ if (failureMessage != null) {
+ statusMap.putString("message", failureMessage)
+ }
// Send the event with both status and details
sendEvent("onTransactionStatus", statusMap)
diff --git a/example/src/App.tsx b/example/src/App.tsx
index 339dc6a..e1c16ce 100644
--- a/example/src/App.tsx
+++ b/example/src/App.tsx
@@ -12,6 +12,7 @@ import {
} from 'react-native';
import Paymob, {
PaymentStatus,
+ FailureCallBackVersion,
type PaymentResponse,
} from 'paymob-reactnative';
import PaymobEmbeddedView from './PaymobEmbeddedView';
@@ -38,12 +39,12 @@ export default function App() {
switch (response.status) {
case PaymentStatus.SUCCESS:
requestAnimationFrame(() => {
- Alert.alert('Payment result', PaymentStatus.SUCCESS);
+ Alert.alert(PaymentStatus.SUCCESS, (response.details || 'Unknown'));
});
break;
case PaymentStatus.FAIL:
requestAnimationFrame(() => {
- Alert.alert('Payment result', PaymentStatus.FAIL);
+ Alert.alert(PaymentStatus.FAIL , (response.message || 'Unknown'));
});
break;
case PaymentStatus.CANCELLED:
@@ -225,8 +226,9 @@ export default function App() {