Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# React Native plug-in for Mobile Payments SDK
# React Native plug-in for Mobile Payments SDK Update
## Disclaimer!!
This is a **modified fork** of [`mobile-payments-sdk-react-native`](https://github.com/Dayo-Akinyemi/mobile-payments-sdk-react-native) by [Dayo Akinyemi / Square].

[![npm version](https://badge.fury.io/js/mobile-payments-sdk-react-native.svg)](https://badge.fury.io/js/mobile-payments-sdk-react-native)
[![npm version](https://badge.fury.io/js/mobile-payments-sdk-react-native.svg)](https://badge.fury.io/js/mobile-payments-sdk-react-native)

Mobile Payments SDK for React Native supports the following SDK versions:

Expand All @@ -14,9 +16,9 @@ Before getting started, please review the Requirements and Limitations and Devic

## Installation
```sh
npm install mobile-payments-sdk-react-native
npm install square-mobile-payments-sdk-react-native
or
yarn add mobile-payments-sdk-react-native
yarn add square-mobile-payments-sdk-react-native
```

For usage and in-detail documentation, visit our [documentation](docs/) section.
Expand Down
18 changes: 3 additions & 15 deletions android/src/main/java/com/mobilepaymentssdkreactnative/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ fun ReadableMap.readPaymentParameters(): PaymentParameters {
// Required fields
val amountMoney = convertToMoney(getMap("amountMoney"))
val processingMode = convertToProcessingMode(getIntOrNull("processingMode"))
val idempotencyKey = getString("idempotencyKey")
requireNotNull(amountMoney) { "Amount money is required" }
requireNotNull(processingMode) { "processingMode is required" }
requireNotNull(idempotencyKey) { "idempotencyKey is required" }

// Optional fields
val acceptPartialAuthorization = getBooleanOrNull("acceptPartialAuthorization")
Expand All @@ -60,10 +62,9 @@ fun ReadableMap.readPaymentParameters(): PaymentParameters {
val statementDescription = getString("statementDescription")
val teamMemberId = getString("teamMemberId")
val tipMoney = convertToMoney(getMap("tipMoney"))
val idempotencyKey = getString("idempotencyKey")
val paymentAttemptId = getString("paymentAttemptId")

val builder = PaymentParameters.Builder(amountMoney, processingMode)
val builder = PaymentParameters.Builder(amountMoney,idempotencyKey)
acceptPartialAuthorization?.let { builder.acceptPartialAuthorization(it) }
appFeeMoney?.let { builder.appFeeMoney(it) }
autocomplete?.let { builder.autocomplete(it) }
Expand All @@ -77,8 +78,6 @@ fun ReadableMap.readPaymentParameters(): PaymentParameters {
statementDescription?.let { builder.statementDescription(it) }
teamMemberId?.let { builder.teamMemberId(it) }
tipMoney?.let { builder.tipMoney(it) }
idempotencyKey?.let { builder.idempotencyKey(it) }
paymentAttemptId?.let { builder.paymentAttemptId(it) }

return builder.build()
}
Expand Down Expand Up @@ -330,7 +329,6 @@ fun ReaderInfo.toReaderInfoMap(): WritableMap {
putString("id", id)
putString("model", model.toModelString())
putString("state", state.toStateString())
putString("status", status.toStatusString())
putString("serialNumber", serialNumber)
putString("name", name)
putMap("batteryStatus", batteryStatus?.toBatteryStatusMap())
Expand Down Expand Up @@ -380,16 +378,6 @@ fun ReaderInfo.State.toStateString(): String {
}
}

fun ReaderInfo.Status.toStatusString(): String {
return when (this) {
is ReaderInfo.Status.Ready -> "READY"
is ReaderInfo.Status.ConnectingToDevice -> "CONNECTING_TO_DEVICE"
is ReaderInfo.Status.ConnectingToSquare -> "CONNECTING_TO_SQUARE"
is ReaderInfo.Status.Faulty -> "FAULTY"
is ReaderInfo.Status.ReaderUnavailable -> "READER_UNAVAILABLE_${this.reason.name}"
}
}


fun ReaderChangedEvent.toChangedEventMap(): WritableMap {
return WritableNativeMap().apply {
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mobile-payments-sdk-react-native",
"version": "2025.6.1",
"name": "square-mobile-payments-sdk-react-native",
"version": "2025.7.4",
"description": "Mobile Payments SDK plug-in for React Native. Enables developers to build secure in-person payment solutions.",
"source": "./src/index.tsx",
"main": "./lib/commonjs/index.js",
Expand Down Expand Up @@ -41,7 +41,7 @@
"typecheck": "tsc",
"lint": "eslint \"**/*.{js,ts,tsx}\"",
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
"prepare": "bob build",
"prepare": "npx bob build",
"release": "release-it"
},
"keywords": [
Expand All @@ -54,14 +54,14 @@
],
"repository": {
"type": "git",
"url": "git+https://github.com/square/mobile-payments-sdk-react-native.git"
"url": "git+https://github.com/Dayo-Akinyemi/mobile-payments-sdk-react-native.git"
},
"author": "Block, Inc <mpx@squareup.com> (https://github.com/square/)",
"author": "Ajibola Philip<you@company.com> (https://github.com/DayoAkinyemi)",
"license": "Apache-2.0",
"bugs": {
"url": "https://developer.squareup.com/forums/"
},
"homepage": "https://github.com/square/mobile-payments-sdk-react-native#readme",
"homepage": "https://github.com/Dayo-Akinyemi/mobile-payments-sdk-react-native#readme",
"publishConfig": {
"registry": "https://registry.npmjs.org/"
},
Expand Down