├── .babelrc
├── .eslintignore
├── .eslintrc.js
├── .gitattributes
├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ ├── documentation.md
│ ├── feature_request.md
│ └── question.md
├── PULL_REQUEST_TEMPLATE.md
└── workflows
│ ├── main.yml
│ └── npm-publish-github-packages.yml
├── .gitignore
├── .npmignore
├── .npmrc
├── CHANGELOG.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── RNSquareInAppPayments.podspec
├── android
├── build.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── sqip
│ │ └── react
│ │ ├── CardEntryModule.java
│ │ ├── GooglePayModule.java
│ │ ├── SquareInAppPaymentsModule.java
│ │ ├── SquareInAppPaymentsPackage.java
│ │ └── internal
│ │ ├── ErrorHandlerUtils.java
│ │ ├── InAppPaymentsException.java
│ │ └── converter
│ │ ├── CardConverter.java
│ │ └── CardDetailsConverter.java
│ └── res
│ ├── values-en-rAU
│ └── strings.xml
│ ├── values-es-rUS
│ └── strings.xml
│ ├── values-es
│ └── strings.xml
│ ├── values-fr
│ └── strings.xml
│ ├── values-ja
│ └── strings.xml
│ └── values
│ ├── strings.xml
│ └── styles.xml
├── babel.config.js
├── docs
├── enable-applepay.md
├── enable-googlepay.md
├── get-started.md
├── reference.md
├── troubleshooting.md
└── versioning.md
├── index.js
├── ios
├── Converters
│ ├── SQIPCard+RNSQIPAdditions.h
│ ├── SQIPCard+RNSQIPAdditions.m
│ ├── SQIPCardDetails+RNSQIPAdditions.h
│ ├── SQIPCardDetails+RNSQIPAdditions.m
│ ├── UIColor+RNSQIPAdditions.h
│ ├── UIColor+RNSQIPAdditions.m
│ ├── UIFont+RNSQIPAdditions.h
│ └── UIFont+RNSQIPAdditions.m
├── RNSQIPApplePay.h
├── RNSQIPApplePay.m
├── RNSQIPBuyerVerification.h
├── RNSQIPBuyerVerification.m
├── RNSQIPCardEntry.h
├── RNSQIPCardEntry.m
├── RNSQIPErrorUtilities.h
├── RNSQIPErrorUtilities.m
├── RNSquareInAppPayments-Resources
│ ├── Base.lproj
│ │ └── Localizable.strings
│ ├── Info.plist
│ ├── en-AU.lproj
│ │ └── Localizable.strings
│ ├── en-CA.lproj
│ │ └── Localizable.strings
│ ├── en-GB.lproj
│ │ └── Localizable.strings
│ ├── en.lproj
│ │ └── Localizable.strings
│ ├── es.lproj
│ │ └── Localizable.strings
│ ├── fr-CA.lproj
│ │ └── Localizable.strings
│ └── ja.lproj
│ │ └── Localizable.strings
├── RNSquareInAppPayments.h
├── RNSquareInAppPayments.m
├── RNSquareInAppPayments.xcodeproj
│ └── project.pbxproj
└── RNSquareInAppPayments.xcworkspace
│ └── contents.xcworkspacedata
├── jest.config.js
├── package.json
├── react-native-in-app-payments-quickstart
├── .eslintrc.js
├── .gitignore
├── .prettierrc.js
├── .ruby-version
├── .watchmanconfig
├── App.tsx
├── Gemfile
├── Gemfile.lock
├── README.md
├── android
│ ├── app
│ │ ├── bin
│ │ │ └── src
│ │ │ │ └── main
│ │ │ │ └── res
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ │ └── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ ├── build.gradle
│ │ ├── debug.keystore
│ │ ├── proguard-rules.pro
│ │ └── src
│ │ │ ├── debug
│ │ │ └── AndroidManifest.xml
│ │ │ └── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java
│ │ │ └── sqip
│ │ │ │ └── react
│ │ │ │ └── example
│ │ │ │ ├── MainActivity.kt
│ │ │ │ └── MainApplication.kt
│ │ │ └── res
│ │ │ ├── drawable
│ │ │ └── card_entry_button.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ └── ic_launcher.xml
│ │ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_foreground.png
│ │ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_foreground.png
│ │ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_foreground.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_foreground.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_foreground.png
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── strings.xml
│ │ │ ├── styles.xml
│ │ │ └── themes.xml
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── settings.gradle
├── app.json
├── app
│ ├── ChargeCustomerCardError.js
│ ├── ChargeError.js
│ ├── Constants.js
│ ├── CreateCustomerCardError.js
│ ├── Utilities.tsx
│ ├── components
│ │ ├── AddressView.tsx
│ │ ├── CardsOnFileCardView.tsx
│ │ ├── CardsOnFileModal.tsx
│ │ ├── CardsOnFileTitleView.tsx
│ │ ├── CommonAlert.tsx
│ │ ├── DigitalWalletButton.tsx
│ │ ├── GreenButton.tsx
│ │ ├── OrderInformationDescriptionView.tsx
│ │ ├── OrderInformationTitleView.tsx
│ │ ├── OrderInformationView.tsx
│ │ ├── OrderModal.tsx
│ │ ├── OrderTitleView.tsx
│ │ └── PendingModal.tsx
│ ├── images
│ │ ├── applePayLogo.png
│ │ ├── applePayLogo@2x.png
│ │ ├── applePayLogo@3x.png
│ │ ├── btnClose.png
│ │ ├── btnClose@2x.png
│ │ ├── btnClose@3x.png
│ │ ├── failIcon.png
│ │ ├── googlePayLogo.png
│ │ ├── googlePayLogo@2x.png
│ │ ├── googlePayLogo@3x.png
│ │ ├── iconCookie.png
│ │ ├── iconCookie@2x.png
│ │ ├── iconCookie@3x.png
│ │ └── sucessIcon.png
│ ├── screens
│ │ └── HomeScreen.tsx
│ └── service
│ │ ├── Charge.tsx
│ │ ├── ChargeCustomerCard.tsx
│ │ └── CreateCustomerCard.tsx
├── babel.config.js
├── in-app-payments-sample-triscreen.png
├── index.js
├── ios
│ ├── .xcode.env
│ ├── Podfile
│ ├── Podfile.lock
│ ├── RNInAppPaymentsQuickstart.xcodeproj
│ │ ├── project.pbxproj
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── RNInAppPaymentsQuickstart.xcscheme
│ ├── RNInAppPaymentsQuickstart.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ └── WorkspaceSettings.xcsettings
│ ├── RNInAppPaymentsQuickstart
│ │ ├── AppDelegate.h
│ │ ├── AppDelegate.mm
│ │ ├── Base.lproj
│ │ │ └── LaunchScreen.xib
│ │ ├── Images.xcassets
│ │ │ ├── AppIcon.appiconset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── Icon1024.png
│ │ │ │ ├── Icon@2x.png
│ │ │ │ ├── Icon@3x.png
│ │ │ │ ├── IconiPad.png
│ │ │ │ ├── IconiPad@2x.png
│ │ │ │ └── IconiPadPro.png
│ │ │ └── Contents.json
│ │ ├── Info.plist
│ │ ├── LaunchScreen.storyboard
│ │ ├── PrivacyInfo.xcprivacy
│ │ ├── es.lproj
│ │ │ └── LaunchScreen.strings
│ │ ├── ja.lproj
│ │ │ ├── LaunchScreen.strings
│ │ │ └── LaunchScreen.xib
│ │ └── main.m
│ └── SquareInAppPaymentsSDK.framework
│ │ ├── CorePaymentCardResources.bundle
│ │ ├── CorePaymentCardResources-Info.plist
│ │ ├── Info.plist
│ │ └── en.lproj
│ │ │ └── InfoPlist.strings
│ │ ├── Headers
│ │ ├── PKPaymentRequest+Square.h
│ │ ├── SQIPApplePayNonceRequest.h
│ │ ├── SQIPApplePayNonceRequestError.h
│ │ ├── SQIPCard.h
│ │ ├── SQIPCardBrand.h
│ │ ├── SQIPCardDetails.h
│ │ ├── SQIPCardEntryViewController.h
│ │ ├── SQIPCardPrepaidType.h
│ │ ├── SQIPCardType.h
│ │ ├── SQIPErrorConstants.h
│ │ ├── SQIPInAppPaymentsSDK.h
│ │ ├── SQIPTheme.h
│ │ └── SquareInAppPaymentsSDK.h
│ │ ├── Info.plist
│ │ ├── Modules
│ │ └── module.modulemap
│ │ ├── SquareCoreResources.bundle
│ │ ├── Info.plist
│ │ ├── SquareCoreResources-Info.plist
│ │ └── en.lproj
│ │ │ └── InfoPlist.strings
│ │ ├── SquareInAppPaymentsSDK
│ │ ├── SquareInAppPaymentsSDKResources.bundle
│ │ ├── Assets.car
│ │ ├── Base.lproj
│ │ │ └── Localizable.strings
│ │ ├── Info.plist
│ │ ├── en-AU.lproj
│ │ │ └── Localizable.strings
│ │ ├── en-CA.lproj
│ │ │ └── Localizable.strings
│ │ ├── en-GB.lproj
│ │ │ └── Localizable.strings
│ │ ├── en.lproj
│ │ │ └── Localizable.strings
│ │ ├── es.lproj
│ │ │ └── Localizable.strings
│ │ ├── fr-CA.lproj
│ │ │ └── Localizable.strings
│ │ ├── ja.lproj
│ │ │ └── Localizable.strings
│ │ └── trustedcerts.plist
│ │ └── setup
├── jest.config.js
├── metro.config.js
├── package.json
├── take_a_payment.md
├── tsconfig.json
└── yarn.lock
├── src
├── ApplePay.ts
├── CardEntry.ts
├── Core.ts
├── ErrorCodes.ts
├── GooglePay.ts
├── Utilities.ts
├── __test__
│ └── Utilities.test.ts
└── models
│ ├── ApplePayConfig.ts
│ ├── Brand.ts
│ ├── BuyerVerificationSuccessCallback.ts
│ ├── CancelAndCompleteCallback.ts
│ ├── Card.ts
│ ├── CardDetails.ts
│ ├── CardEntryConfig.ts
│ ├── ColorType.ts
│ ├── ErrorDetails.ts
│ ├── FailureCallback.ts
│ ├── FontType.ts
│ ├── GooglePayConfig.ts
│ ├── GooglePayPriceStatus.ts
│ ├── NonceSuccessCallback.ts
│ ├── PaymentType.ts
│ ├── PrepaidType.ts
│ ├── ThemeType.ts
│ ├── Type.ts
│ └── VerificationResult.ts
├── tsconfig.json
└── yarn.lock
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | [
4 | "env",
5 | {
6 | "exclude": [
7 | "transform-es2015-classes"
8 | ]
9 | }
10 | ]
11 | ],
12 | "plugins": [
13 | "jest-hoist"
14 | ]
15 | }
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | react-native-in-app-payments-quickstart
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | parser: '@typescript-eslint/parser',
3 | parserOptions: {
4 | project: './tsconfig.json',
5 | createDefaultProgram: true,
6 | },
7 | extends: [
8 | 'airbnb-typescript',
9 | 'plugin:react-native/all',
10 | ],
11 | settings: {
12 | 'import/resolver': {
13 | node: {
14 | extensions: ['.js', '.jsx', '.ts', '.tsx'],
15 | },
16 | },
17 | },
18 | plugins: [
19 | 'react',
20 | 'react-native',
21 | ],
22 | env: {
23 | 'react-native/react-native': true,
24 | jest: true,
25 | },
26 | rules: {
27 | 'react-native/no-unused-styles': 2,
28 | 'react-native/split-platform-components': 2,
29 | 'react-native/no-inline-styles': 2,
30 | 'react-native/no-color-literals': 0,
31 | 'no-use-before-define': 0,
32 | 'react/jsx-filename-extension': 0,
33 | 'react/destructuring-assignment': 0,
34 | 'no-console': 0,
35 | 'react/forbid-prop-types': 0,
36 | 'class-methods-use-this': 0,
37 | },
38 | };
39 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Windows files should use crlf line endings
2 | # https://help.github.com/articles/dealing-with-line-endings/
3 | *.bat text eol=crlf
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: "\U0001F41B Issue report"
3 | about: I hit an error when I tried to use this plugin.
4 | title: ''
5 | labels: bug
6 | assignees: ''
7 |
8 | ---
9 |
10 | ### Describe the issue
11 |
21 |
22 | ### To Reproduce
23 |
36 |
37 | ### Expected behavior
38 |
43 |
44 |
45 | **Environment (please complete the following information):**
46 |
54 |
55 | ### Screenshots
56 |
57 |
58 | ### Additional context
59 |
60 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/documentation.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: "\U0001F4C3 Documentation Bug"
3 | about: You want to report something that is wrong or missing from the documentation.
4 | title: ''
5 | labels: documentation
6 | assignees: ''
7 |
8 | ---
9 |
10 | ### Describe the change you would like to see
11 |
13 |
14 | ### How would the suggested change make the documentation more useful?
15 |
17 |
18 | ### Additional context
19 |
21 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: "\U0001F680 Feature request"
3 | about: You have an idea that could make this plugin better
4 | title: ''
5 | labels: enhancement
6 | assignees: ''
7 |
8 | ---
9 |
10 | ### Describe the functionality you would like to see
11 |
13 |
14 | ### How would this feature make the plugin more useful?
15 |
17 |
18 | ### Additional context
19 |
20 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/question.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: "\U0001F914 Questions and Help"
3 | about: You have a quetion or need help using this plugin.
4 | title: ''
5 | labels: question
6 | assignees: ''
7 |
8 | ---
9 |
10 | ### Describe your question
11 |
13 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
8 |
9 | ## Summary
10 |
11 |
12 |
13 | ## Related issues
14 |
15 | Fix #
16 |
17 | ## Changelog
18 |
19 |
20 |
21 | * message
22 |
23 | ## Test Plan
24 |
25 |
--------------------------------------------------------------------------------
/.github/workflows/main.yml:
--------------------------------------------------------------------------------
1 | name: in-app-payment-react-native-plugin
2 | on: [push]
3 | jobs:
4 | install-and-test:
5 | runs-on: ubuntu-latest
6 | steps:
7 | - uses: actions/checkout@v2
8 | - uses: actions/setup-node@v2
9 | with:
10 | node-version: 18.x
11 | - run: |
12 | yarn && yarn lint && yarn test
13 | cd react-native-in-app-payments-quickstart && yarn && cd ..
14 |
15 | build-android:
16 | needs: install-and-test
17 | runs-on: ubuntu-latest
18 | steps:
19 | - name: Checkout repository
20 | uses: actions/checkout@v4
21 | - name: Set up JDK 17
22 | uses: actions/setup-java@v4
23 | with:
24 | distribution: 'temurin'
25 | java-version: '17'
26 | - name: Cache Gradle Wrapper
27 | uses: actions/cache@v4
28 | with:
29 | path: ~/.gradle/wrapper
30 | key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
31 | - name: Cache Gradle Dependencies
32 | uses: actions/cache@v4
33 | with:
34 | path: ~/.gradle/caches
35 | key: ${{ runner.os }}-gradle-caches-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
36 | restore-keys: |
37 | ${{ runner.os }}-gradle-caches-
38 | - name: Install npm dependencies
39 | uses: actions/checkout@v2
40 | - run: |
41 | cd react-native-in-app-payments-quickstart && yarn
42 | cd android && ./gradlew clean build
43 |
44 | build-ios:
45 | needs: install-and-test
46 | runs-on: macos-latest
47 | steps:
48 | - uses: actions/checkout@v2
49 | - name: Use Node.js
50 | uses: actions/setup-node@v3
51 | with:
52 | node-version: 18.x
53 | - run: |
54 | gem install cocoapods
55 | cd react-native-in-app-payments-quickstart
56 | yarn
57 | cd ios && pod install
58 | - name: Build iOS (debug)
59 | run: "xcodebuild \
60 | -workspace react-native-in-app-payments-quickstart/ios/RNInAppPaymentsQuickstart.xcworkspace \
61 | -scheme RNInAppPaymentsQuickstart \
62 | clean archive \
63 | -sdk iphoneos \
64 | -configuration Debug \
65 | -UseModernBuildSystem=NO \
66 | -archivePath $PWD/RNInAppPaymentsQuickstart \
67 | CODE_SIGNING_ALLOWED=NO \
68 | CODE_SIGNING_REQUIRED=NO \
69 | CODE_SIGN_IDENTITY=NO"
--------------------------------------------------------------------------------
/.github/workflows/npm-publish-github-packages.yml:
--------------------------------------------------------------------------------
1 | # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2 | # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3 |
4 | name: react-native-square-in-app-payments
5 |
6 | on:
7 | push:
8 | tags:
9 | # matches 'v{{version}}', e.g. v1.4.3
10 | - 'v[0-9]+.[0-9]+.[0-9]+'
11 |
12 | jobs:
13 | build:
14 | runs-on: ubuntu-latest
15 | permissions:
16 | contents: read
17 | id-token: write
18 | steps:
19 | - uses: actions/checkout@v4
20 | # Setup .npmrc file to publish to npm
21 | - uses: actions/setup-node@v4
22 | with:
23 | node-version: '20.x'
24 | registry-url: 'https://registry.npmjs.org'
25 | - run: npm i
26 | - run: npm pack
27 | - run: npm publish --provenance --access public
28 | env:
29 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # OSX
3 | #
4 | .DS_Store
5 |
6 | # node.js
7 | #
8 | node_modules/
9 | npm-debug.log
10 | yarn-error.log
11 |
12 |
13 | # Xcode
14 | #
15 | build/
16 | *.pbxuser
17 | !default.pbxuser
18 | *.mode1v3
19 | !default.mode1v3
20 | *.mode2v3
21 | !default.mode2v3
22 | *.perspectivev3
23 | !default.perspectivev3
24 | xcuserdata
25 | *.xccheckout
26 | *.moved-aside
27 | DerivedData
28 | *.hmap
29 | *.ipa
30 | *.xcuserstate
31 | project.xcworkspace
32 |
33 |
34 | # Android/IntelliJ
35 | #
36 | build/
37 | .idea
38 | .gradle
39 | local.properties
40 | *.iml
41 |
42 | # BUCK
43 | buck-out/
44 | \.buckd/
45 | *.keystore
46 | android/.settings/org.eclipse.buildship.core.prefs
47 | android/.project
48 | .vscode/settings.json
49 | android/.classpath
50 | android/gradle/wrapper/gradle-wrapper.properties
51 | android/gradlew
52 | android/gradlew.bat
53 | android/gradle/wrapper/gradle-wrapper.jar
54 | android/bin/
55 | .clang-format
56 | .vscode/launch.json
57 | coverage/
58 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | # Ignore sample code
2 | react-native-in-app-payments-quickstart/
--------------------------------------------------------------------------------
/.npmrc:
--------------------------------------------------------------------------------
1 | registry = "https://registry.npmjs.org/"
2 |
3 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## Changelog
2 |
3 | ### v1.7.6 Jun 03, 2024
4 |
5 | * Upgrade IAP SDK for Android `1.6.6` and for iOS `1.6.3`.
6 |
7 | ### v1.7.5 Oct 12, 2023
8 |
9 | * Upgrade IAP SDK for Android `1.6.5`.
10 |
11 | ### v1.7.4 Oct 05, 2023
12 |
13 | * Upgrade IAP SDK for iOS `1.6.2`.
14 |
15 | ### v1.7.3 April 05, 2023
16 |
17 | * Upgrade IAP SDK for Android `1.6.2` and for iOS `1.6.1`.
18 | * An important update to SquareBuyerVerificationSDK that mitigates the risk of declining 3-D Secure (3DS) payments for ios.
19 | * Various bug fixes.
20 |
21 | ### v1.7.2 May 23, 2022
22 |
23 | * Upgrade IAP SDK to `1.5.6`.
24 |
25 | ### v1.7.1 Feb 8, 2022
26 |
27 | * Upgrade IAP SDK to `1.5.5`.
28 | * Fxied iOS Xcode legacy build issue.
29 | * Support Typescript.
30 |
31 | ### v1.7.0 Oct 29, 2021
32 |
33 | * Upgrade IAP SDK to `1.5.4`.
34 | * Support IAP SDK version override with `$sqipVersion` for iOS or `ext.sqipVersion` for Android.
35 |
36 | ### v1.6.0 July 19, 2021
37 |
38 | * Downgrading IAP SDK to `1.4.9` to solve compatability issue with newer versions of the IAP SDK.
39 |
40 | ### v1.5.0 May 14, 2021
41 |
42 | * Added a new flow called [startBuyerVerificationFlow](docs/reference.md#startbuyerverificationflow) to support Strong Customer Authentication with a card-on-file card ID
43 | * Updated to IAP SDK `1.5.1`.
44 | * updated react native version to `0.64.0`.
45 |
46 | ### v1.4.0 July 10, 2020
47 |
48 | * Updated to IAP SDK `1.4.0`.
49 | * Added support for gift card payments.
50 |
51 | ### v1.3.1 January 8, 2020
52 |
53 | * Bump Nested HandleBar dependency from `4.2.0` to `4.5.3`.
54 |
55 | ### v1.3.0 November 25, 2019
56 |
57 | * Bump Square In-App Payments SDK dependency to `1.3.0`.
58 | * Add support for Strong Customer Authentication (SCA).
59 |
60 | ### v1.2.3 September 10, 2019
61 |
62 | * Bump Square In-App Payments SDK dependency to `1.2.0`.
63 | * Add support for Sandbox v2.
64 |
65 | ### v1.2.2 September 6, 2019
66 |
67 | * Upgraded to Android SDK 28. Supports AndroidX.
68 |
69 | ### v1.2.1 June 5, 2019
70 |
71 | * Added `paymentType` parameter to support apple pay pending amount configuration.
72 |
73 | ### v1.1.2 Mar 28, 2019
74 |
75 | * Support android In-App Payments SDK version override.
76 |
77 | ### v1.1.1 Mar 22, 2019
78 |
79 | * Small bug fixes - #3
80 |
81 | ### v1.1.0 Feb 27, 2019
82 |
83 | * Initial release.
84 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | Contributing
2 | ============
3 |
4 | If you would like to contribute code to this project you must sign the
5 | [Individual Contributor License Agreement (CLA)]. Your code cannot be accepted
6 | into the project until you sign the agreement.
7 |
8 | **DO NOT SUBMIT CHANGES THAT BREAK THE QUICK START SAMPLE APP**. If you are
9 | adding new features, confirm the functionality is compatible with the sample app
10 | (at minimum) or consider adding to the sample code to demonstrate the new
11 | feature (recommended).
12 |
13 | To contribute:
14 |
15 | 1. Fork this repository.
16 | 1. Follow existing coding conventions and styles to keep the code as readable
17 | as possible.
18 | 1. Comment your code so others can understand it easily.
19 | 1. Update the associated docs (README, reference, etc.) to reflect your changes
20 | as needed. If appropriate, you can add a new markdown page to the `docs`
21 | folder to document your changes.
22 | 1. Submit a pull request with your changes.
23 |
24 |
25 | [//]: # "Link anchor definitions"
26 | [Individual Contributor License Agreement (CLA)]: https://spreadsheets.google.com/spreadsheet/viewform?formkey=dDViT2xzUHAwRkI3X3k5Z0lQM091OGc6MQ&ndplr=1
--------------------------------------------------------------------------------
/RNSquareInAppPayments.podspec:
--------------------------------------------------------------------------------
1 |
2 | Pod::Spec.new do |s|
3 | s.name = "RNSquareInAppPayments"
4 | s.version = "1.6.3"
5 | s.summary = "React Native plugin for Square's In-App Payments SDK"
6 | s.description = <<-DESC
7 | An open source React Native plugin for calling Square’s native In-App Payments SDK to take in-app payments on iOS and Android.
8 | DESC
9 | s.homepage = "https://github.com/square/in-app-payments-react-native-plugin"
10 | s.license = { :file => 'LICENSE' }
11 | s.author = { 'Square, Inc.' => 'flutter-team@squareup.com' }
12 | s.platform = :ios, "12.0"
13 | s.source = { :path => 'ios' }
14 | s.source_files = "ios/**/*.{h,m}"
15 | s.public_header_files = 'ios/**/*.h'
16 | s.requires_arc = true
17 | s.resource_bundle = { "RNSquareInAppPayments-Resources" => ["ios/RNSquareInAppPayments-Resources/*.lproj/*.strings"] }
18 |
19 | s.dependency "React"
20 |
21 | if $sqipVersion
22 | s.dependency 'SquareInAppPaymentsSDK', $sqipVersion
23 | s.dependency 'SquareBuyerVerificationSDK', $sqipVersion
24 | else
25 | s.dependency 'SquareInAppPaymentsSDK', '1.6.3'
26 | s.dependency 'SquareBuyerVerificationSDK', '1.6.3'
27 | end
28 |
29 | end
30 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 |
2 | buildscript {
3 | repositories {
4 | google()
5 | mavenCentral()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:7.2.2'
10 | }
11 | }
12 |
13 | apply plugin: 'com.android.library'
14 |
15 | def MIN_IAP_SDK_VERSION = '1.6.6'
16 |
17 | android {
18 | compileSdkVersion 33
19 |
20 | defaultConfig {
21 | minSdkVersion 24
22 | targetSdkVersion 33
23 | versionCode 1
24 | versionName "1.0"
25 | }
26 | lintOptions {
27 | abortOnError false
28 | }
29 | compileOptions {
30 | sourceCompatibility = 1.8
31 | targetCompatibility = 1.8
32 | }
33 | }
34 |
35 | rootProject.allprojects {
36 | repositories {
37 | google()
38 | maven {
39 | url 'https://sdk.squareup.com/public/android'
40 | }
41 | }
42 | }
43 |
44 | dependencies {
45 | def sqipVersion = rootProject.hasProperty('sqipVersion') ? rootProject.sqipVersion : MIN_IAP_SDK_VERSION
46 | implementation 'com.facebook.react:react-native:+'
47 | implementation "com.squareup.sdk.in-app-payments:card-entry:$sqipVersion"
48 | implementation "com.squareup.sdk.in-app-payments:google-pay:$sqipVersion"
49 | implementation "com.squareup.sdk.in-app-payments:buyer-verification:$sqipVersion"
50 | implementation 'com.google.android.gms:play-services-wallet:16.0.1'
51 | }
52 |
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/android/src/main/java/sqip/react/SquareInAppPaymentsModule.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | package sqip.react;
17 |
18 | import android.os.Handler;
19 | import android.os.Looper;
20 | import com.facebook.react.bridge.Promise;
21 | import com.facebook.react.bridge.ReactApplicationContext;
22 | import com.facebook.react.bridge.ReactContextBaseJavaModule;
23 | import com.facebook.react.bridge.ReactMethod;
24 | import sqip.InAppPaymentsSdk;
25 |
26 | class SquareInAppPaymentsModule extends ReactContextBaseJavaModule {
27 |
28 | private final Handler mainLooperHandler;
29 |
30 | public SquareInAppPaymentsModule(ReactApplicationContext reactContext) {
31 | super(reactContext);
32 | mainLooperHandler = new Handler(Looper.getMainLooper());
33 | }
34 |
35 | @Override
36 | public String getName() {
37 | return "RNSquareInAppPayments";
38 | }
39 |
40 | @ReactMethod
41 | public void setApplicationId(final String applicationId, final Promise promise) {
42 | mainLooperHandler.post(new Runnable() {
43 | @Override
44 | public void run() {
45 | InAppPaymentsSdk.setSquareApplicationId(applicationId);
46 | promise.resolve(null);
47 | }
48 | });
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/android/src/main/java/sqip/react/SquareInAppPaymentsPackage.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | package sqip.react;
17 |
18 | import java.util.Arrays;
19 | import java.util.Collections;
20 | import java.util.List;
21 |
22 | import com.facebook.react.ReactPackage;
23 | import com.facebook.react.bridge.NativeModule;
24 | import com.facebook.react.bridge.ReactApplicationContext;
25 | import com.facebook.react.uimanager.ViewManager;
26 | public class SquareInAppPaymentsPackage implements ReactPackage {
27 | @Override
28 | public List createNativeModules(ReactApplicationContext reactContext) {
29 | return Arrays.asList(
30 | new SquareInAppPaymentsModule(reactContext),
31 | new CardEntryModule(reactContext),
32 | new GooglePayModule(reactContext)
33 | );
34 | }
35 |
36 | @Override
37 | public List createViewManagers(ReactApplicationContext reactContext) {
38 | return Collections.emptyList();
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/android/src/main/java/sqip/react/internal/ErrorHandlerUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | package sqip.react.internal;
17 |
18 | import com.facebook.react.bridge.WritableMap;
19 | import com.facebook.react.bridge.WritableNativeMap;
20 | import org.json.JSONException;
21 | import org.json.JSONObject;
22 | import sqip.react.R;
23 |
24 | final public class ErrorHandlerUtils {
25 | public static final String USAGE_ERROR = "USAGE_ERROR";
26 |
27 | public static String getPluginErrorMessage(String pluginErrorCode) {
28 | return String.format(String.valueOf(R.string.sqip_react_developer_error_message), pluginErrorCode);
29 | }
30 |
31 | public static WritableMap getCallbackErrorObject(String code, String message, String debugCode, String debugMessage) {
32 | WritableMap errorObject = new WritableNativeMap();
33 | errorObject.putString("code", code);
34 | errorObject.putString("message", message);
35 | errorObject.putString("debugCode", debugCode);
36 | errorObject.putString("debugMessage", debugMessage);
37 | return errorObject;
38 | }
39 |
40 | public static String createNativeModuleError(String nativeModuleErrorCode, String debugMessage) {
41 | return serializeErrorToJson(
42 | nativeModuleErrorCode,
43 | getPluginErrorMessage(nativeModuleErrorCode),
44 | debugMessage);
45 | }
46 |
47 | private static String serializeErrorToJson(String debugCode, String message, String debugMessage) {
48 | JSONObject errorData = new JSONObject();
49 | try {
50 | errorData.put("debugCode", debugCode);
51 | errorData.put("message", message);
52 | errorData.put("debugMessage", debugMessage);
53 | } catch (JSONException ex) {
54 | return "{ 'message': 'failed to serialize error'}";
55 | }
56 |
57 | return errorData.toString();
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/android/src/main/java/sqip/react/internal/InAppPaymentsException.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | package sqip.react.internal;
17 |
18 | public class InAppPaymentsException extends Exception {
19 | public InAppPaymentsException(String message) {
20 | super(message);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/android/src/main/java/sqip/react/internal/converter/CardDetailsConverter.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | package sqip.react.internal.converter;
17 |
18 | import com.facebook.react.bridge.WritableMap;
19 | import com.facebook.react.bridge.WritableNativeMap;
20 | import sqip.CardDetails;
21 |
22 | public final class CardDetailsConverter {
23 |
24 | private final CardConverter cardConverter;
25 |
26 | public CardDetailsConverter(CardConverter cardConverter) {
27 | this.cardConverter = cardConverter;
28 | }
29 |
30 | public WritableMap toMapObject(CardDetails cardDetails) {
31 | WritableMap mapToReturn = new WritableNativeMap();
32 | mapToReturn.putString("nonce", cardDetails.getNonce());
33 | mapToReturn.putMap("card", cardConverter.toMapObject(cardDetails.getCard()));
34 | return mapToReturn;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/android/src/main/res/values-en-rAU/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Something went wrong. Please contact the developer of this application and provide them with this error code: %1$s
4 |
5 |
--------------------------------------------------------------------------------
/android/src/main/res/values-es-rUS/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Se produjo un error. Contacte al desarrollador de esta aplicación y proporcióneles este código de error: %1$s
4 |
5 |
--------------------------------------------------------------------------------
/android/src/main/res/values-es/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Se produjo un error. Contacte al desarrollador de esta aplicación y proporcióneles este código de error: %1$s
4 |
5 |
--------------------------------------------------------------------------------
/android/src/main/res/values-fr/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Une erreur s’est produite. Veuillez contacter le développeur de cette application en indiquant le code d’erreur suivant : %1$s
4 |
5 |
--------------------------------------------------------------------------------
/android/src/main/res/values-ja/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 不具合が発生しました。アプリ開発者にご連絡のうえ、次のエラーコードをお知らせください:%1$s
4 |
5 |
--------------------------------------------------------------------------------
/android/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Something went wrong. Please contact the developer of this application and provide them with this error code: %1$s
4 |
5 |
--------------------------------------------------------------------------------
/android/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: ['module:metro-react-native-babel-preset'],
3 | };
4 |
--------------------------------------------------------------------------------
/docs/troubleshooting.md:
--------------------------------------------------------------------------------
1 | # Troubleshooting the In-App Payments SDK React Native Plugin
2 |
3 | Likely causes and solutions for common problems.
4 |
5 | ## I get bundling error when running quick start example
6 |
7 | ### The problem
8 |
9 | When you run the quick start example, the app launched and started loading javascript from bundling server.
10 | This bundling error **"tries to require `react-native`, but there are several files providing this module."** is thrown.
11 |
12 | ### Likely cause
13 |
14 | The quick start example links to the local in-app payments plugin, if the local plugin has a `node_modules` folder nested,
15 | package resolver will look into it and cause this ambiguous resolution error.
16 |
17 | ### Solution
18 |
19 | 1. Remove the nested `node_modules`
20 |
21 | ```bash
22 | cd /PATH/TO/LOCAL/react-native-in-app-payments-quickstart
23 | rm -rf node_modules/react-native-square-in-app-payments/node_modules/
24 | ```
25 |
26 | 1. Restart the bundling server and run the app again.
27 |
28 | ---
29 |
30 |
31 | ## Card Entry UI won't close when I hot reload the app
32 |
33 | ### The problem
34 |
35 | You open your app and launch the card entry UI, then you reload the app by "cmd+R" (iOS) or "R+R" (Android), clicking "cancel" doesn't close the card entry.
36 |
37 | ### Likely cause
38 |
39 | The hot reload doesn't work well with card entry UI.
40 |
41 | ### Solution
42 |
43 | You have to kill the app and launch the app again.
44 | To prevent this from happening, please always close the card entry UI before reloading.
45 |
46 | ---
47 |
48 |
49 | ## I get thre Error ":CFBundleIdentifier", Does Not Exist
50 |
51 | ### The problem
52 |
53 | Your iOS configuration files are missing or not correctly configured.
54 |
55 | ### Solution
56 |
57 | There is a [stackoverflow question](https://stackoverflow.com/questions/37461703/print-entry-cfbundleidentifier-does-not-exist) that adresses this problem.
58 |
--------------------------------------------------------------------------------
/docs/versioning.md:
--------------------------------------------------------------------------------
1 | # Override the Native In-App Payments SDK Dependency Version
2 |
3 | The React Native Plugin for In-App Payments SDK by default loads a specific version of iOS and Android
4 | In-App Payments SDK.
5 |
6 | You can override the default In-App Payments SDK versions by following this guidance.
7 |
8 | ## iOS
9 |
10 | 1. Open the `ios/Podfile` file, add the `$sqipVersion` variable and specify your desired version.
11 |
12 | ```ruby
13 | # Uncomment this line to define a global platform for your project
14 | platform :ios, '12.0'
15 |
16 | # specify the version of SquareInAppPaymentsSDK
17 | $sqipVersion = '1.7.1'
18 | ```
19 |
20 | 2. Remove the `ios/Podfile.lock` and build your project again.
21 | ```bash
22 | cd ios
23 | rm Podfile.lock
24 | pod install
25 | ```
26 | 3. Add build phase to setup the SquareInAppPaymentsSDK and/or SquareBuyerVerificationSDK framework
27 | After adding the framework using any of the above methods, follow the below instructions to complete the setup.
28 |
29 | On your application targets’ Build Phases settings tab, click the + icon and choose New Run Script Phase. Create a Run Script in which you specify your shell (ex: /bin/sh), add the following contents to the script area below the shell:
30 | ```bash
31 | FRAMEWORKS="${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}"
32 | "${FRAMEWORKS}/SquareInAppPaymentsSDK.framework/setup"
33 | ```
34 |
35 | Note : If you are using SquareBuyerVerificationSDK earlier than version 1.6.2 for iOS, please upgrade to 1.6.2 so that the SDK can process 3DS-enabled payments. The SDK will decline 3DS-enabled payments made after March 31, 2023 if the SDK version is earlier than 1.6.2.
36 |
37 |
38 | ## Android
39 |
40 | 1. Open the `android/build.gradle` file, add the `sqipVersion` variable and specify your desired version.
41 | ```gradle
42 | allprojects {
43 | repositories {
44 | google()
45 | jcenter()
46 | }
47 | }
48 |
49 | // add the override here
50 | ext {
51 | sqipVersion = '1.7.1'
52 | }
53 | ```
54 |
55 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | import SQIPCore from './src/Core';
17 | import SQIPCardEntry from './src/CardEntry';
18 | import SQIPApplePay from './src/ApplePay';
19 | import SQIPGooglePay from './src/GooglePay';
20 | import SQIPErrorCodes from './src/ErrorCodes';
21 |
22 | export {
23 | SQIPCore,
24 | SQIPCardEntry,
25 | SQIPApplePay,
26 | SQIPGooglePay,
27 | SQIPErrorCodes,
28 | };
29 |
--------------------------------------------------------------------------------
/ios/Converters/SQIPCard+RNSQIPAdditions.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | @import SquareInAppPaymentsSDK;
18 |
19 |
20 | @interface SQIPCard (RNSQIPAdditions)
21 |
22 | - (NSDictionary *)jsonDictionary;
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/ios/Converters/SQIPCard+RNSQIPAdditions.m:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | #import "SQIPCard+RNSQIPAdditions.h"
18 |
19 |
20 | @implementation SQIPCard (RNSQIPAdditions)
21 |
22 | - (NSDictionary *)jsonDictionary
23 | {
24 | return @{
25 | @"brand" : [self _stringForBrand:self.brand],
26 | @"lastFourDigits" : self.lastFourDigits,
27 | @"expirationMonth" : @(self.expirationMonth),
28 | @"expirationYear" : @(self.expirationYear),
29 | @"postalCode" : self.postalCode ?: [NSNull null],
30 | @"type" : [self _stringForCardType:self.type],
31 | @"prepaidType" : [self _stringForCardPrepaidType:self.prepaidType],
32 | };
33 | }
34 |
35 | #pragma mark - Private Methods
36 | - (NSString *)_stringForBrand:(SQIPCardBrand)brand
37 | {
38 | NSString *result = nil;
39 | switch (brand) {
40 | case SQIPCardBrandOtherBrand:
41 | result = @"OTHER_BRAND";
42 | break;
43 | case SQIPCardBrandVisa:
44 | result = @"VISA";
45 | break;
46 | case SQIPCardBrandMastercard:
47 | result = @"MASTERCARD";
48 | break;
49 | case SQIPCardBrandAmericanExpress:
50 | result = @"AMERICAN_EXPRESS";
51 | break;
52 | case SQIPCardBrandDiscover:
53 | result = @"DISCOVER";
54 | break;
55 | case SQIPCardBrandDiscoverDiners:
56 | result = @"DISCOVER_DINERS";
57 | break;
58 | case SQIPCardBrandJCB:
59 | result = @"JCB";
60 | break;
61 | case SQIPCardBrandChinaUnionPay:
62 | result = @"CHINA_UNION_PAY";
63 | break;
64 | case SQIPCardBrandSquareGiftCard:
65 | result = @"SQUARE_GIFT_CARD";
66 | break;
67 | }
68 | return result;
69 | }
70 |
71 | - (NSString *)_stringForCardType:(SQIPCardType)cardType
72 | {
73 | NSString *result = nil;
74 | switch (cardType) {
75 | case SQIPCardTypeDebit:
76 | result = @"DEBIT";
77 | break;
78 | case SQIPCardTypeCredit:
79 | result = @"CREDIT";
80 | break;
81 | case SQIPCardTypeUnknown:
82 | result = @"UNKNOWN";
83 | break;
84 | }
85 | return result;
86 | }
87 |
88 | - (NSString *)_stringForCardPrepaidType:(SQIPCardPrepaidType)cardPrepaidType
89 | {
90 | NSString *result = nil;
91 | switch (cardPrepaidType) {
92 | case SQIPCardPrepaidTypePrepaid:
93 | result = @"PREPAID";
94 | break;
95 | case SQIPCardPrepaidTypeNotPrepaid:
96 | result = @"NOT_PREPAID";
97 | break;
98 | case SQIPCardPrepaidTypeUnknown:
99 | result = @"UNKNOWN";
100 | break;
101 | }
102 | return result;
103 | }
104 |
105 | @end
106 |
--------------------------------------------------------------------------------
/ios/Converters/SQIPCardDetails+RNSQIPAdditions.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | @import SquareInAppPaymentsSDK;
18 |
19 |
20 | @interface SQIPCardDetails (RNSQIPAdditions)
21 |
22 | - (NSDictionary *)jsonDictionary;
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/ios/Converters/SQIPCardDetails+RNSQIPAdditions.m:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | #import "SQIPCardDetails+RNSQIPAdditions.h"
18 | #import "SQIPCard+RNSQIPAdditions.h"
19 |
20 |
21 | @implementation SQIPCardDetails (RNSQIPAdditions)
22 |
23 | - (NSDictionary *)jsonDictionary
24 | {
25 | return @{
26 | @"nonce" : self.nonce,
27 | @"card" : [self.card jsonDictionary],
28 | };
29 | }
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/ios/Converters/UIColor+RNSQIPAdditions.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | #if __has_include()
18 | #import
19 | #else
20 | #import "UIKit.h"
21 | #endif
22 |
23 |
24 | @interface UIColor (RNSQIPAdditions)
25 |
26 | - (UIColor *)fromJsonDictionary:(NSDictionary *)fontDictionary;
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/ios/Converters/UIColor+RNSQIPAdditions.m:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | #import "UIColor+RNSQIPAdditions.h"
18 |
19 |
20 | @implementation UIColor (RNSQIPAdditions)
21 |
22 | - (UIColor *)fromJsonDictionary:(NSDictionary *)fontDictionary;
23 | {
24 | NSParameterAssert(fontDictionary[@"r"]);
25 | NSParameterAssert(fontDictionary[@"g"]);
26 | NSParameterAssert(fontDictionary[@"b"]);
27 |
28 | CGFloat red = [fontDictionary[@"r"] floatValue] / 255;
29 | CGFloat green = [fontDictionary[@"g"] floatValue] / 255;
30 | CGFloat blue = [fontDictionary[@"b"] floatValue] / 255;
31 | CGFloat alpha = fontDictionary[@"a"] ? [fontDictionary[@"a"] floatValue] : 1.0;
32 |
33 | return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
34 | }
35 |
36 | @end
37 |
--------------------------------------------------------------------------------
/ios/Converters/UIFont+RNSQIPAdditions.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | #if __has_include()
18 | #import
19 | #else
20 | #import "UIKit.h"
21 | #endif
22 |
23 |
24 | @interface UIFont (RNSQIPAdditions)
25 |
26 | - (UIFont *)fromJsonDictionary:(NSDictionary *)fontDictionary;
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/ios/Converters/UIFont+RNSQIPAdditions.m:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | #import "UIFont+RNSQIPAdditions.h"
18 |
19 |
20 | @implementation UIFont (RNSQIPAdditions)
21 |
22 | - (UIFont *)fromJsonDictionary:(NSDictionary *)fontDictionary;
23 | {
24 | NSParameterAssert(fontDictionary[@"size"]);
25 | NSString *fontName = fontDictionary[@"name"] ?: self.fontName;
26 |
27 | return [UIFont fontWithName:fontName size:[fontDictionary[@"size"] floatValue]];
28 | }
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/ios/RNSQIPApplePay.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | #if __has_include()
18 | #import
19 | #import
20 | #else
21 | #import "RCTBridgeModule.h"
22 | #import "RCTEventEmitter.h"
23 | #endif
24 | @import SquareInAppPaymentsSDK;
25 |
26 |
27 | @interface RNSQIPApplePay : RCTEventEmitter
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/ios/RNSQIPBuyerVerification.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | #if __has_include()
18 | #import
19 | #import
20 | #else
21 | #import "RCTBridgeModule.h"
22 | #import "RCTEventEmitter.h"
23 | #endif
24 |
25 | @import SquareInAppPaymentsSDK;
26 | @import SquareBuyerVerificationSDK;
27 |
28 | @interface RNSQIPBuyerVerification : NSObject
29 |
30 | + (SQIPCurrency)currencyForCurrencyCode:(nonnull NSString *)currencyCode;
31 | + (SQIPCountry)countryForCountryCode:(nonnull NSString *)countryCode;
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/ios/RNSQIPCardEntry.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | #if __has_include()
18 | #import
19 | #import
20 | #else
21 | #import "RCTBridgeModule.h"
22 | #import "RCTEventEmitter.h"
23 | #endif
24 |
25 | @import SquareInAppPaymentsSDK;
26 | @import SquareBuyerVerificationSDK;
27 |
28 |
29 | @interface RNSQIPCardEntry : RCTEventEmitter
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/ios/RNSQIPErrorUtilities.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | #if __has_include()
18 | #import
19 | #else
20 | #import "Foundation.h"
21 | #endif
22 |
23 | extern NSString *const RNSQIPUsageError;
24 | extern NSInteger const RNSQIPCardEntryErrorCode;
25 | extern NSInteger const RNSQIPApplePayErrorCode;
26 |
27 |
28 | @interface RNSQIPErrorUtilities : NSObject
29 |
30 | + (NSDictionary *)callbackErrorObject:(NSString *)code message:(NSString *)message debugCode:(NSString *)debugCode debugMessage:(NSString *)debugMessage;
31 | + (NSString *)createNativeModuleError:(NSString *)nativeModuleErrorCode debugMessage:(NSString *)debugMessage;
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/ios/RNSQIPErrorUtilities.m:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | #import "RNSQIPErrorUtilities.h"
18 |
19 | NSString *const RNSQIPUsageError = @"USAGE_ERROR";
20 | NSInteger const RNSQIPCardEntryErrorCode = 0;
21 | NSInteger const RNSQIPApplePayErrorCode = 1;
22 |
23 |
24 | @implementation RNSQIPErrorUtilities
25 |
26 | + (NSDictionary *)callbackErrorObject:(NSString *)code message:(NSString *)message debugCode:(NSString *)debugCode debugMessage:(NSString *)debugMessage
27 | {
28 | return @{
29 | @"code" : code,
30 | @"message" : message,
31 | @"debugCode" : debugCode,
32 | @"debugMessage" : debugMessage,
33 | };
34 | }
35 |
36 | + (NSString *)createNativeModuleError:(NSString *)nativeModuleErrorCode debugMessage:(NSString *)debugMessage
37 | {
38 | NSString *bundlePath = [[NSBundle bundleForClass:RNSQIPErrorUtilities.self] pathForResource:@"RNSquareInAppPayments-Resources" ofType:@"bundle"];
39 | NSBundle *bundle = [NSBundle bundleWithPath:bundlePath];
40 | NSString *localizedErrorMessage = bundle ?
41 | NSLocalizedStringWithDefaultValue(@"SQIPUnexpectedErrorMessage", nil, bundle, @"Something went wrong. Please contact the developer of this application and provide them with this error code: %@", @"Error message shown when an unexpected error occurs") :
42 | @"Something went wrong. Please contact the developer of this application and provide them with this error code: %@";
43 |
44 | return [self serializeErrorToJson:nativeModuleErrorCode
45 | message:[NSString stringWithFormat:localizedErrorMessage, nativeModuleErrorCode]
46 | debugMessage:debugMessage];
47 | }
48 |
49 | + (NSString *)serializeErrorToJson:(NSString *)debugCode message:(NSString *)message debugMessage:(NSString *)debugMessage
50 | {
51 | NSMutableDictionary *errObject = [[NSMutableDictionary alloc] init];
52 | errObject[@"debugCode"] = debugCode;
53 | errObject[@"message"] = message;
54 | errObject[@"debugMessage"] = debugMessage;
55 | NSError *writeError = nil;
56 | NSData *jsonData = [NSJSONSerialization dataWithJSONObject:errObject options:NSJSONWritingPrettyPrinted error:&writeError];
57 | if (jsonData) {
58 | return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
59 | } else {
60 | return [NSString stringWithFormat:@"{'message': '%@'}",
61 | @"failed to serialize error"];
62 | }
63 | }
64 |
65 | @end
66 |
--------------------------------------------------------------------------------
/ios/RNSquareInAppPayments-Resources/Base.lproj/Localizable.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/ios/RNSquareInAppPayments-Resources/Base.lproj/Localizable.strings
--------------------------------------------------------------------------------
/ios/RNSquareInAppPayments-Resources/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleIdentifier
8 | $(PRODUCT_BUNDLE_IDENTIFIER)
9 | CFBundleInfoDictionaryVersion
10 | 6.0
11 | CFBundleName
12 | $(PRODUCT_NAME)
13 | CFBundlePackageType
14 | BNDL
15 | CFBundleShortVersionString
16 | 1.0
17 | CFBundleVersion
18 | 1
19 | NSHumanReadableCopyright
20 | Copyright 2022 Square Inc. All rights reserved.
21 | NSPrincipalClass
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/ios/RNSquareInAppPayments-Resources/en-AU.lproj/Localizable.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/ios/RNSquareInAppPayments-Resources/en-AU.lproj/Localizable.strings
--------------------------------------------------------------------------------
/ios/RNSquareInAppPayments-Resources/en-CA.lproj/Localizable.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/ios/RNSquareInAppPayments-Resources/en-CA.lproj/Localizable.strings
--------------------------------------------------------------------------------
/ios/RNSquareInAppPayments-Resources/en-GB.lproj/Localizable.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/ios/RNSquareInAppPayments-Resources/en-GB.lproj/Localizable.strings
--------------------------------------------------------------------------------
/ios/RNSquareInAppPayments-Resources/en.lproj/Localizable.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/ios/RNSquareInAppPayments-Resources/en.lproj/Localizable.strings
--------------------------------------------------------------------------------
/ios/RNSquareInAppPayments-Resources/es.lproj/Localizable.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/ios/RNSquareInAppPayments-Resources/es.lproj/Localizable.strings
--------------------------------------------------------------------------------
/ios/RNSquareInAppPayments-Resources/fr-CA.lproj/Localizable.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/ios/RNSquareInAppPayments-Resources/fr-CA.lproj/Localizable.strings
--------------------------------------------------------------------------------
/ios/RNSquareInAppPayments-Resources/ja.lproj/Localizable.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/ios/RNSquareInAppPayments-Resources/ja.lproj/Localizable.strings
--------------------------------------------------------------------------------
/ios/RNSquareInAppPayments.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | #if __has_include("RCTBridgeModule.h")
18 | #import "RCTBridgeModule.h"
19 | #else
20 | #import
21 | #endif
22 |
23 | @import SquareInAppPaymentsSDK;
24 | @import SquareBuyerVerificationSDK;
25 |
26 |
27 | @interface RNSquareInAppPayments : NSObject
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/ios/RNSquareInAppPayments.m:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | #import "RNSquareInAppPayments.h"
18 |
19 |
20 | @implementation RNSquareInAppPayments
21 |
22 | - (dispatch_queue_t)methodQueue
23 | {
24 | return dispatch_get_main_queue();
25 | }
26 |
27 | RCT_EXPORT_MODULE();
28 |
29 | RCT_REMAP_METHOD(setApplicationId,
30 | applicationId
31 | : (NSString *)applicationId
32 | setApplicationIdWithResolver
33 | : (RCTPromiseResolveBlock)resolve
34 | rejecter
35 | : (RCTPromiseRejectBlock)reject)
36 | {
37 | dispatch_async([self methodQueue], ^{
38 | SQIPInAppPaymentsSDK.squareApplicationID = applicationId;
39 | resolve([NSNull null]);
40 | });
41 | }
42 |
43 | @end
44 |
--------------------------------------------------------------------------------
/ios/RNSquareInAppPayments.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 |
3 |
5 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | preset: 'react-native',
3 | moduleFileExtensions: [
4 | 'ts',
5 | 'tsx',
6 | 'js',
7 | ],
8 | transform: {
9 | '^.+\\.(js)$': '/node_modules/babel-jest',
10 | '\\.(ts|tsx)$': '/node_modules/ts-jest',
11 | },
12 | testRegex: '(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$',
13 | testPathIgnorePatterns: [
14 | '\\.snap$',
15 | '/node_modules/',
16 | ],
17 | testEnvironment: 'node',
18 | };
19 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-native-square-in-app-payments",
3 | "version": "1.7.6",
4 | "description": "An open source React Native plugin for calling Square’s native In-App Payments SDK to take in-app payments on iOS and Android.",
5 | "homepage": "https://github.com/square/in-app-payments-react-native-plugin",
6 | "repository": {
7 | "type": "git",
8 | "url": "https://github.com/square/in-app-payments-react-native-plugin"
9 | },
10 | "main": "index.js",
11 | "scripts": {
12 | "lint": "eslint ./ --ext .js,.ts",
13 | "test": "jest",
14 | "test-coverage": "jest --collectCoverage"
15 | },
16 | "keywords": [
17 | "react-native",
18 | "in-app-payments",
19 | "square",
20 | "payments"
21 | ],
22 | "author": "Square, Inc.",
23 | "license": "Apache-2.0",
24 | "devDependencies": {
25 | "@types/jest": "^26.0.23",
26 | "@types/node": "^17.0.23",
27 | "@types/react": "^18.2.6",
28 | "@types/react-native": "^0.72.0",
29 | "@types/react-test-renderer": "^18.2.0",
30 | "@typescript-eslint/eslint-plugin": "^4.29.2",
31 | "babel-eslint": "^10.1.0",
32 | "babel-jest": "27.0.1",
33 | "babel-plugin-module-resolver": "^4.1.0",
34 | "eslint": "^7.28.0",
35 | "eslint-config-airbnb-typescript": "^12.3.1",
36 | "eslint-plugin-import": "^2.23.4",
37 | "eslint-plugin-jsx-a11y": "^6.4.1",
38 | "eslint-plugin-react": "^7.24.0",
39 | "eslint-plugin-react-native": "^3.11.0",
40 | "jest": "^27.0.6",
41 | "metro-react-native-babel-preset": "0.56.0",
42 | "react": "18.2.0",
43 | "react-native": "0.74.1",
44 | "react-test-renderer": "18.2.0",
45 | "ts-jest": "^27.0.3",
46 | "typescript": "^4.3.5"
47 | },
48 | "peerDependencies": {
49 | "react-native": ">= 0.57.8"
50 | },
51 | "jest": {
52 | "preset": "react-native",
53 | "transform": {
54 | "^.+\\.js$": "/node_modules/react-native/jest/preprocessor.js"
55 | },
56 | "modulePathIgnorePatterns": [
57 | "react-native-in-app-payments-quickstart"
58 | ]
59 | },
60 | "resolutions": {
61 | "**/**/handlebars": "4.5.3",
62 | "**/**/logkitty": "^0.7.1",
63 | "**/**/minimist": "^0.2.1"
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | parser: 'babel-eslint',
3 | root: true,
4 | extends: [
5 | 'airbnb',
6 | 'plugin:react-native/all',
7 | ],
8 | settings: {
9 | 'import/resolver': {
10 | node: {
11 | extensions: ['.js', '.jsx', '.ts', '.tsx']
12 | },
13 | },
14 | },
15 | plugins: [
16 | 'react',
17 | 'react-native',
18 | ],
19 | env: {
20 | 'react-native/react-native': true,
21 | },
22 | rules: {
23 | 'react-native/no-unused-styles': 2,
24 | 'react-native/split-platform-components': 2,
25 | 'react-native/no-inline-styles': 2,
26 | 'react-native/no-color-literals': 0,
27 | 'no-use-before-define': 0,
28 | 'react/jsx-filename-extension': 0,
29 | 'react/destructuring-assignment': 0,
30 | 'no-console': 0,
31 | 'react/forbid-prop-types': 0,
32 | 'class-methods-use-this': 0,
33 | 'import/no-extraneous-dependencies': 0,
34 | 'import/extensions': 0,
35 | 'import/no-unresolved': 2,
36 | },
37 | };
38 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/.gitignore:
--------------------------------------------------------------------------------
1 | # OSX
2 | #
3 | .DS_Store
4 |
5 | # Xcode
6 | #
7 | build/
8 | *.pbxuser
9 | !default.pbxuser
10 | *.mode1v3
11 | !default.mode1v3
12 | *.mode2v3
13 | !default.mode2v3
14 | *.perspectivev3
15 | !default.perspectivev3
16 | xcuserdata
17 | *.xccheckout
18 | *.moved-aside
19 | DerivedData
20 | *.hmap
21 | *.ipa
22 | *.xcuserstate
23 | **/.xcode.env.local
24 |
25 | # Android/IntelliJ
26 | #
27 | build/
28 | .idea
29 | .gradle
30 | local.properties
31 | *.iml
32 | *.hprof
33 | .cxx/
34 | *.keystore
35 | !debug.keystore
36 |
37 | # node.js
38 | #
39 | node_modules/
40 | npm-debug.log
41 | yarn-error.log
42 |
43 | # fastlane
44 | #
45 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
46 | # screenshots whenever they are needed.
47 | # For more information about the recommended setup visit:
48 | # https://docs.fastlane.tools/best-practices/source-control/
49 |
50 | **/fastlane/report.xml
51 | **/fastlane/Preview.html
52 | **/fastlane/screenshots
53 | **/fastlane/test_output
54 |
55 | # Bundle artifact
56 | *.jsbundle
57 |
58 | # Ruby / CocoaPods
59 | **/Pods/
60 | /vendor/bundle/
61 |
62 | # Temporary files created by Metro to check the health of the file watcher
63 | .metro-health-check*
64 |
65 | # testing
66 | /coverage
67 |
68 | # Yarn
69 | .yarn/*
70 | !.yarn/patches
71 | !.yarn/plugins
72 | !.yarn/releases
73 | !.yarn/sdks
74 | !.yarn/versions
75 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/.prettierrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | bracketSpacing: false,
3 | jsxBracketSameLine: true,
4 | singleQuote: true,
5 | trailingComma: 'all',
6 | arrowParens: 'avoid',
7 | };
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/.ruby-version:
--------------------------------------------------------------------------------
1 | 2.7.4
2 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/.watchmanconfig:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/App.tsx:
--------------------------------------------------------------------------------
1 | /*Copyright 2022 Square Inc.
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 | */
15 | import 'react-native-gesture-handler';
16 | import {createSwitchNavigator, createAppContainer} from 'react-navigation';
17 | import HomeScreen from './app/screens/HomeScreen';
18 |
19 | const RootStack = createSwitchNavigator(
20 | {
21 | Home: {screen: HomeScreen},
22 | },
23 | {
24 | initialRouteName: 'Home',
25 | },
26 | );
27 |
28 | const App = createAppContainer(RootStack);
29 |
30 | export default App;
31 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/Gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 |
3 | # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4 | ruby '2.7.4'
5 |
6 | gem 'cocoapods', '~> 1.11', '>= 1.11.2'
7 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/Gemfile.lock:
--------------------------------------------------------------------------------
1 | GEM
2 | remote: https://rubygems.org/
3 | specs:
4 | CFPropertyList (3.0.5)
5 | rexml
6 | activesupport (6.1.5)
7 | concurrent-ruby (~> 1.0, >= 1.0.2)
8 | i18n (>= 1.6, < 2)
9 | minitest (>= 5.1)
10 | tzinfo (~> 2.0)
11 | zeitwerk (~> 2.3)
12 | addressable (2.8.0)
13 | public_suffix (>= 2.0.2, < 5.0)
14 | algoliasearch (1.27.5)
15 | httpclient (~> 2.8, >= 2.8.3)
16 | json (>= 1.5.1)
17 | atomos (0.1.3)
18 | claide (1.1.0)
19 | cocoapods (1.11.3)
20 | addressable (~> 2.8)
21 | claide (>= 1.0.2, < 2.0)
22 | cocoapods-core (= 1.11.3)
23 | cocoapods-deintegrate (>= 1.0.3, < 2.0)
24 | cocoapods-downloader (>= 1.4.0, < 2.0)
25 | cocoapods-plugins (>= 1.0.0, < 2.0)
26 | cocoapods-search (>= 1.0.0, < 2.0)
27 | cocoapods-trunk (>= 1.4.0, < 2.0)
28 | cocoapods-try (>= 1.1.0, < 2.0)
29 | colored2 (~> 3.1)
30 | escape (~> 0.0.4)
31 | fourflusher (>= 2.3.0, < 3.0)
32 | gh_inspector (~> 1.0)
33 | molinillo (~> 0.8.0)
34 | nap (~> 1.0)
35 | ruby-macho (>= 1.0, < 3.0)
36 | xcodeproj (>= 1.21.0, < 2.0)
37 | cocoapods-core (1.11.3)
38 | activesupport (>= 5.0, < 7)
39 | addressable (~> 2.8)
40 | algoliasearch (~> 1.0)
41 | concurrent-ruby (~> 1.1)
42 | fuzzy_match (~> 2.0.4)
43 | nap (~> 1.0)
44 | netrc (~> 0.11)
45 | public_suffix (~> 4.0)
46 | typhoeus (~> 1.0)
47 | cocoapods-deintegrate (1.0.5)
48 | cocoapods-downloader (1.6.2)
49 | cocoapods-plugins (1.0.0)
50 | nap
51 | cocoapods-search (1.0.1)
52 | cocoapods-trunk (1.6.0)
53 | nap (>= 0.8, < 2.0)
54 | netrc (~> 0.11)
55 | cocoapods-try (1.2.0)
56 | colored2 (3.1.2)
57 | concurrent-ruby (1.1.10)
58 | escape (0.0.4)
59 | ethon (0.15.0)
60 | ffi (>= 1.15.0)
61 | ffi (1.15.5)
62 | fourflusher (2.3.1)
63 | fuzzy_match (2.0.4)
64 | gh_inspector (1.1.3)
65 | httpclient (2.8.3)
66 | i18n (1.10.0)
67 | concurrent-ruby (~> 1.0)
68 | json (2.6.1)
69 | minitest (5.15.0)
70 | molinillo (0.8.0)
71 | nanaimo (0.3.0)
72 | nap (1.1.0)
73 | netrc (0.11.0)
74 | public_suffix (4.0.6)
75 | rexml (3.2.5)
76 | ruby-macho (2.5.1)
77 | typhoeus (1.4.0)
78 | ethon (>= 0.9.0)
79 | tzinfo (2.0.4)
80 | concurrent-ruby (~> 1.0)
81 | xcodeproj (1.21.0)
82 | CFPropertyList (>= 2.3.3, < 4.0)
83 | atomos (~> 0.1.3)
84 | claide (>= 1.0.2, < 2.0)
85 | colored2 (~> 3.1)
86 | nanaimo (~> 0.3.0)
87 | rexml (~> 3.2.4)
88 | zeitwerk (2.5.4)
89 |
90 | PLATFORMS
91 | ruby
92 |
93 | DEPENDENCIES
94 | cocoapods (~> 1.11, >= 1.11.2)
95 |
96 | RUBY VERSION
97 | ruby 2.7.4p191
98 |
99 | BUNDLED WITH
100 | 2.2.27
101 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/app/bin/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/android/app/bin/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/app/bin/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/android/app/bin/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/app/bin/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/android/app/bin/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/app/bin/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/android/app/bin/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/app/bin/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/android/app/bin/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/app/bin/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/android/app/bin/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/app/bin/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/android/app/bin/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/app/bin/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/android/app/bin/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/app/bin/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/android/app/bin/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/app/bin/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/android/app/bin/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/app/debug.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/android/app/debug.keystore
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
12 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/app/src/main/java/sqip/react/example/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package sqip.react.example;
2 |
3 | import com.facebook.react.ReactActivity;
4 | import com.facebook.react.ReactActivityDelegate;
5 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled;
6 | import com.facebook.react.defaults.DefaultReactActivityDelegate;
7 |
8 | class MainActivity : ReactActivity() {
9 |
10 | /**
11 | * Returns the name of the main component registered from JavaScript. This is used to schedule
12 | * rendering of the component.
13 | */
14 | override fun getMainComponentName(): String = "RNInAppPaymentsQuickstart"
15 |
16 | /**
17 | * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
18 | * which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
19 | */
20 | override fun createReactActivityDelegate(): ReactActivityDelegate =
21 | DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
22 | }
23 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/app/src/main/java/sqip/react/example/MainApplication.kt:
--------------------------------------------------------------------------------
1 | package sqip.react.example;
2 |
3 | import android.app.Application;
4 | import com.facebook.react.PackageList;
5 | import com.facebook.react.ReactApplication;
6 | import com.facebook.react.ReactHost;
7 | import com.facebook.react.ReactNativeHost;
8 | import com.facebook.react.ReactPackage;
9 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load;
10 | import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost;
11 | import com.facebook.react.defaults.DefaultReactNativeHost;
12 | import com.facebook.soloader.SoLoader;
13 | import com.rndiffapp.BuildConfig
14 |
15 | class MainApplication : Application(), ReactApplication {
16 |
17 | override val reactNativeHost: ReactNativeHost =
18 | object : DefaultReactNativeHost(this) {
19 | override fun getPackages(): List =
20 | PackageList(this).packages.apply {
21 | // Packages that cannot be autolinked yet can be added manually here, for example:
22 | // add(MyReactNativePackage())
23 | }
24 |
25 | override fun getJSMainModuleName(): String = "index"
26 |
27 | override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
28 |
29 | override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
30 | override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
31 | }
32 |
33 | override val reactHost: ReactHost
34 | get() = getDefaultReactHost(applicationContext, reactNativeHost)
35 |
36 | override fun onCreate() {
37 | super.onCreate()
38 | SoLoader.init(this, false)
39 | if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
40 | // If you opted-in for the New Architecture, we load the native entry point for this app.
41 | load()
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/app/src/main/res/drawable/card_entry_button.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 | -
9 |
10 |
11 |
12 |
13 | -
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | @color/jungleGreen
4 | @color/jungleGreen
5 | @color/surfieGreen
6 |
7 | @color/white
8 | @color/jungleGreen
9 | @color/porcelain
10 | @color/surfieGreen
11 | @color/amethyst
12 | #BE4DCA
13 | #DADADA
14 | #ECEFF0
15 | #FFFFFF
16 | #24988D
17 | #128176
18 |
19 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | React 🍪
3 | Pay 🍪
4 |
5 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
13 |
14 |
17 |
18 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext {
3 | buildToolsVersion = "34.0.0"
4 | minSdkVersion = 24
5 | compileSdkVersion = 34
6 | targetSdkVersion = 34
7 | ndkVersion = "26.1.10909125"
8 | kotlinVersion = "1.9.22"
9 | }
10 | repositories {
11 | google()
12 | mavenCentral()
13 | }
14 | dependencies {
15 | classpath("com.android.tools.build:gradle")
16 | classpath("com.facebook.react:react-native-gradle-plugin")
17 | classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
18 | }
19 | }
20 |
21 | apply plugin: "com.facebook.react.rootproject"
22 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
13 | org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
19 |
20 | # AndroidX package structure to make it clearer which packages are bundled with the
21 | # Android operating system, and which are packaged with your app's APK
22 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
23 | android.useAndroidX=true
24 | # Automatically convert third-party libraries to use AndroidX
25 | android.enableJetifier=true
26 |
27 | # Use this property to specify which architecture you want to build.
28 | # You can also override it from the CLI using
29 | # ./gradlew -PreactNativeArchitectures=x86_64
30 | reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
31 |
32 | # Use this property to enable support to the new architecture.
33 | # This will allow you to use TurboModules and the Fabric render in
34 | # your application. You should enable this flag either if you want
35 | # to write custom TurboModules/Fabric components OR use libraries that
36 | # are providing them.
37 | newArchEnabled=false
38 |
39 | # Use this property to enable or disable the Hermes JS engine.
40 | # If set to false, you will be using JSC instead.
41 | hermesEnabled=true
42 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%"=="" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%"=="" set DIRNAME=.
29 | @rem This is normally unused
30 | set APP_BASE_NAME=%~n0
31 | set APP_HOME=%DIRNAME%
32 |
33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
35 |
36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
38 |
39 | @rem Find java.exe
40 | if defined JAVA_HOME goto findJavaFromJavaHome
41 |
42 | set JAVA_EXE=java.exe
43 | %JAVA_EXE% -version >NUL 2>&1
44 | if %ERRORLEVEL% equ 0 goto execute
45 |
46 | echo. 1>&2
47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
48 | echo. 1>&2
49 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
50 | echo location of your Java installation. 1>&2
51 |
52 | goto fail
53 |
54 | :findJavaFromJavaHome
55 | set JAVA_HOME=%JAVA_HOME:"=%
56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
57 |
58 | if exist "%JAVA_EXE%" goto execute
59 |
60 | echo. 1>&2
61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
62 | echo. 1>&2
63 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
64 | echo location of your Java installation. 1>&2
65 |
66 | goto fail
67 |
68 | :execute
69 | @rem Setup the command line
70 |
71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
72 |
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if %ERRORLEVEL% equ 0 goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | set EXIT_CODE=%ERRORLEVEL%
85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87 | exit /b %EXIT_CODE%
88 |
89 | :mainEnd
90 | if "%OS%"=="Windows_NT" endlocal
91 |
92 | :omega
93 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'RNInAppPaymentsQuickstart'
2 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
3 | include ':app'
4 | includeBuild('../node_modules/@react-native/gradle-plugin')
5 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "RNInAppPaymentsQuickstart",
3 | "displayName": "React 🍪"
4 | }
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/ChargeCustomerCardError.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | export default class ChargeCustomerCardError extends Error {
17 | constructor(message) {
18 | super(message);
19 | this.name = 'ChargeCustomerCardError';
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/ChargeError.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | export default class ChargeError extends Error {
17 | constructor(message) {
18 | super(message);
19 | this.name = 'ChargeError';
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/Constants.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | const SQUARE_APP_ID = 'REPLACE_ME';
17 | const SQUARE_LOCATION_ID = 'REPLACE_ME';
18 | // Make sure to remove trailing `/` since the CHARGE_SERVER_URL puts it
19 | const CHARGE_SERVER_HOST = 'REPLACE_ME';
20 | const CHARGE_SERVER_URL = `${CHARGE_SERVER_HOST}/chargeForCookie`;
21 | const GOOGLE_PAY_LOCATION_ID = 'REPLACE_ME';
22 | const APPLE_PAY_MERCHANT_ID = 'REPLACE_ME';
23 | // constants require for card on file transactions
24 | const CREATE_CUSTOMER_CARD_SERVER_URL = `${CHARGE_SERVER_HOST}/createCustomerCard`;
25 | const CHARGE_CUSTOMER_CARD_SERVER_URL = `${CHARGE_SERVER_HOST}/chargeCustomerCard`;
26 | const CUSTOMER_ID = 'REPLACE_ME';
27 |
28 | module.exports = {
29 | SQUARE_APP_ID,
30 | SQUARE_LOCATION_ID,
31 | CHARGE_SERVER_HOST,
32 | CHARGE_SERVER_URL,
33 | GOOGLE_PAY_LOCATION_ID,
34 | APPLE_PAY_MERCHANT_ID,
35 | CUSTOMER_ID,
36 | CREATE_CUSTOMER_CARD_SERVER_URL,
37 | CHARGE_CUSTOMER_CARD_SERVER_URL,
38 | };
39 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/CreateCustomerCardError.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | export default class CreateCustomerCardError extends Error {
17 | constructor(message) {
18 | super(message);
19 | this.name = 'CreateCustomerCardError';
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/Utilities.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | /* eslint no-bitwise: ["error", { "allow": ["|", "&"] }] */
17 | import {Alert} from 'react-native';
18 |
19 | export function uuidv4() {
20 | return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
21 | const r = (Math.random() * 16) | 0;
22 | const v = c === 'x' ? r : (r & 0x3) | 0x8;
23 | return v.toString(16);
24 | });
25 | }
26 |
27 | export function printCurlCommand(
28 | nonce: string,
29 | appId: string,
30 | verificationToken = undefined,
31 | ) {
32 | // set host url based on application id
33 | // production: https://connect.squareup.com
34 | // sandbox: https://connect.squareupsandbox.com
35 | const hostUrl = appId.startsWith('sandbox')
36 | ? 'https://connect.squareupsandbox.com'
37 | : 'https://connect.squareup.com';
38 | const uuid = uuidv4();
39 | if (verificationToken === undefined) {
40 | console.log(`Run this curl command to charge the nonce:
41 | curl --request POST ${hostUrl}/v2/payments \\
42 | --header "Content-Type: application/json" \\
43 | --header "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
44 | --header "Accept: application/json" \\
45 | --data '{
46 | "idempotency_key": "${uuid}",
47 | "amount_money": {
48 | "amount": 100,
49 | "currency": "USD"},
50 | "source_id": "${nonce}"
51 | }'`);
52 | } else {
53 | console.log(`Run this curl command to charge the nonce:
54 | curl --request POST ${hostUrl}/v2/payments \\
55 | --header "Content-Type: application/json" \\
56 | --header "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
57 | --header "Accept: application/json" \\
58 | --data '{
59 | "idempotency_key": "${uuid}",
60 | "amount_money": {
61 | "amount": 100,
62 | "currency": "USD"},
63 | "source_id": "${nonce}",
64 | "verification_token": "${verificationToken}"
65 | }'`);
66 | }
67 | }
68 |
69 | export async function showAlert(
70 | title: string,
71 | message = '',
72 | onPress = () => {},
73 | ) {
74 | Alert.alert(
75 | title,
76 | message,
77 | [
78 | {
79 | text: 'OK',
80 | onPress: onPress,
81 | },
82 | ],
83 | {cancelable: false},
84 | );
85 | }
86 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/components/AddressView.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | import React from 'react';
17 | import {Text, StyleSheet} from 'react-native';
18 | import PropTypes from 'prop-types';
19 |
20 | AddressView.propTypes = {
21 | address: PropTypes.string.isRequired,
22 | };
23 |
24 | export default function AddressView({address}: {address: string}) {
25 | return {address};
26 | }
27 |
28 | const styles = StyleSheet.create({
29 | address: {
30 | color: '#7B7B7B',
31 | fontSize: 15,
32 | marginTop: 4,
33 | },
34 | });
35 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/components/CardsOnFileCardView.tsx:
--------------------------------------------------------------------------------
1 | /* eslint-disable jsx-a11y/accessible-emoji */
2 | /*
3 | Copyright 2022 Square Inc.
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | import React from 'react';
18 | import {Text, View, StyleSheet, TouchableOpacity, Alert} from 'react-native';
19 | import PropTypes from 'prop-types';
20 |
21 | CardsOnFileCardView.propTypes = {
22 | cardOnFile: PropTypes.object.isRequired,
23 | onSelectCardOnFile: PropTypes.func.isRequired,
24 | };
25 |
26 | interface CardOnFile {
27 | card_brand: string;
28 | last_4: string;
29 | exp_month: string;
30 | exp_year: string;
31 | }
32 |
33 | function showConfirmation(cardOnFile: CardOnFile, onConfirm: () => void) {
34 | Alert.alert(
35 | 'Confirm',
36 | `Purchase a cookie for $1 using your ${cardOnFile.card_brand} ${cardOnFile.last_4} card`,
37 | [
38 | {
39 | text: 'Cancel',
40 | style: 'cancel',
41 | },
42 | {
43 | text: 'Purchase',
44 | onPress: () => onConfirm(),
45 | },
46 | ],
47 | );
48 | }
49 |
50 | export default function CardsOnFileCardView(
51 | {cardOnFile}: {cardOnFile: CardOnFile},
52 | {onSelectCardOnFile}: {onSelectCardOnFile: () => void},
53 | ) {
54 | return (
55 | <>
56 |
57 | 💳
58 |
59 |
60 |
61 | {cardOnFile.card_brand}
62 | {cardOnFile.last_4}
63 |
64 |
65 | expires
66 | {cardOnFile.exp_month}/{cardOnFile.exp_year}
67 |
68 |
69 |
70 | showConfirmation(cardOnFile, onSelectCardOnFile)}
72 | style={styles.button}>
73 | Pay
74 |
75 |
76 | >
77 | );
78 | }
79 |
80 | const styles = StyleSheet.create({
81 | button: {
82 | alignItems: 'center',
83 | backgroundColor: '#24988D',
84 | borderRadius: 8,
85 | justifyContent: 'center',
86 | minHeight: 30,
87 | },
88 | buttonColumn: {
89 | flex: 1,
90 | flexDirection: 'column',
91 | },
92 | buttonText: {
93 | color: '#FFFFFF',
94 | fontSize: 14,
95 | },
96 | cardInfo: {
97 | color: '#0a0a0a',
98 | },
99 | descriptionColumn: {
100 | flex: 2,
101 | flexDirection: 'column',
102 | },
103 | muted: {
104 | color: '#7B7B7B',
105 | },
106 | titleColumn: {
107 | flex: 0,
108 | flexDirection: 'column',
109 | },
110 | titleText: {
111 | color: '#24988D',
112 | fontSize: 16,
113 | marginRight: '5%',
114 | },
115 | });
116 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/components/CardsOnFileModal.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | import React from 'react';
17 | import {View, StyleSheet, Text} from 'react-native';
18 |
19 | import CardsOnFileTitleView from './CardsOnFileTitleView';
20 | import CardsOnFileCardView from './CardsOnFileCardView';
21 | import GreenButton from './GreenButton';
22 |
23 | interface Props {
24 | onCloseCardsOnFileScreen: () => void;
25 | onShowCustomerCardEntry: () => void;
26 | onSelectCardOnFile: () => void;
27 | cardsOnFile: any;
28 | }
29 |
30 | interface CardOnFile {
31 | id: string;
32 | card_brand: string;
33 | last_4: string;
34 | exp_month: string;
35 | exp_year: string;
36 | }
37 |
38 | const CardsOnFileModal: React.FC = ({
39 | onCloseCardsOnFileScreen,
40 | onShowCustomerCardEntry,
41 | onSelectCardOnFile,
42 | cardsOnFile,
43 | }) => {
44 | return (
45 |
46 | onCloseCardsOnFileScreen()}
48 | />
49 |
50 | {cardsOnFile.length === 0 ? (
51 |
52 | {'No cards on file found.' +
53 | 'Please tap the button to add a card that you can use for future transactions.'}
54 |
55 | ) : (
56 | cardsOnFile.map((cardOnFile: CardOnFile) => (
57 |
58 |
59 | onSelectCardOnFile.bind(cardOnFile)}
63 | />
64 |
65 |
66 |
67 | ))
68 | )}
69 |
70 |
71 | onShowCustomerCardEntry()}
73 | text="Add card"
74 | />
75 |
76 |
77 | );
78 | };
79 |
80 | export default CardsOnFileModal;
81 |
82 | const styles = StyleSheet.create({
83 | bodyContent: {
84 | marginLeft: '10%',
85 | marginRight: '10%',
86 | marginTop: '3%',
87 | },
88 | buttonRow: {
89 | alignItems: 'center',
90 | flexDirection: 'row',
91 | justifyContent: 'center',
92 | marginBottom: '6%',
93 | width: '100%',
94 | },
95 | container: {
96 | width: '100%',
97 | },
98 | horizontalLine: {
99 | borderBottomColor: '#D8D8D8',
100 | borderBottomWidth: 1,
101 | marginBottom: '3%',
102 | marginTop: '3%',
103 | },
104 | noCardsText: {
105 | color: '#7B7B7B',
106 | fontSize: 12,
107 | marginBottom: '3%',
108 | minHeight: 50,
109 | },
110 | row: {
111 | flexDirection: 'row',
112 | width: '100%',
113 | },
114 | });
115 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/components/CardsOnFileTitleView.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | /* eslint no-undef: */
17 | import React from 'react';
18 | import {Text, View, StyleSheet, TouchableHighlight, Image} from 'react-native';
19 | import PropTypes from 'prop-types';
20 |
21 | const closeButton = require('../images/btnClose.png');
22 |
23 | CardsOnFileTitleView.propTypes = {
24 | onCloseCardsOnFileScreen: PropTypes.func.isRequired,
25 | };
26 |
27 | export default function CardsOnFileTitleView({
28 | onCloseCardsOnFileScreen,
29 | }: {
30 | onCloseCardsOnFileScreen: () => void;
31 | }) {
32 | return (
33 |
34 | onCloseCardsOnFileScreen()}>
38 |
39 |
40 | My Saved Cards
41 |
42 | );
43 | }
44 |
45 | const styles = StyleSheet.create({
46 | closeButton: {
47 | zIndex: 1,
48 | },
49 | container: {
50 | alignItems: 'center',
51 | flexDirection: 'row',
52 | position: 'relative',
53 | },
54 | title: {
55 | color: '#000000',
56 | fontSize: 18,
57 | fontWeight: 'bold',
58 | position: 'absolute',
59 | textAlign: 'center',
60 | width: '100%',
61 | zIndex: 0,
62 | },
63 | });
64 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/components/CommonAlert.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | import React from 'react';
17 | import { Text, StyleSheet, Image, View, Modal, TouchableOpacity } from 'react-native';
18 | import PropTypes from 'prop-types';
19 |
20 | const FailIcon = require('../images/failIcon.png');
21 | const SuccessIcon = require('../images/sucessIcon.png');
22 |
23 | CommonAlert.propTypes = {
24 | title: PropTypes.string.isRequired,
25 | description: PropTypes.string.isRequired,
26 | };
27 |
28 | export default function CommonAlert({ title, description, status, isVisible, onDialogClick }: { title: string, description: string, status: boolean, isVisible: boolean, onDialogClick: Function }) {
29 | return (
30 | onDialogClick()}>
37 | onDialogClick()}
38 | style={{
39 | flex: 1,
40 | justifyContent: 'center',
41 | backgroundColor: 'rgba(0,0,0,0.5)',
42 | }}>
43 |
44 |
47 | {title}
48 | {description}
49 |
50 |
51 |
52 | );
53 | }
54 |
55 | const styles = StyleSheet.create({
56 | container: {
57 | backgroundColor: '#EEEEEE',
58 | alignItems: 'center',
59 | borderRadius: 20,
60 | marginHorizontal: 30,
61 | padding: 15
62 | },
63 | icon: {
64 | width: 80,
65 | height: 80,
66 | },
67 | title: {
68 | fontSize: 20,
69 | textAlign: 'center',
70 | marginTop: 10,
71 | color: "#000",
72 | },
73 | description: {
74 | marginTop: 10,
75 | textAlign: 'center',
76 | color: "gray",
77 | fontSize: 15,
78 | margin: 30,
79 | },
80 | buttonContainer: {
81 | height: 45,
82 | flexDirection: 'row',
83 | justifyContent: 'center',
84 | alignItems: 'center',
85 | marginBottom: 20,
86 | width: 250,
87 | borderRadius: 30,
88 | },
89 | loginButton: {
90 | backgroundColor: "#3498db",
91 | },
92 | buttonText: {
93 | color: "#FFFFFF",
94 | fontSize: 20,
95 | }
96 | });
97 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/components/DigitalWalletButton.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | import React from 'react';
17 | import { Image, StyleSheet, TouchableOpacity, Platform } from 'react-native';
18 | import PropTypes from 'prop-types';
19 |
20 | const googlePayLogo = require('../images/applePayLogo.png');
21 | const applePayLogo = require('../images/googlePayLogo.png');
22 |
23 | DigitalWalletButton.propTypes = {
24 | onPress: PropTypes.func.isRequired,
25 | };
26 |
27 | export default function DigitalWalletButton({ onPress }: { onPress: () => void }) {
28 | const imageSource = Platform.OS === 'ios' ? googlePayLogo : applePayLogo;
29 | return (
30 | onPress()} style={styles.button}>
31 |
33 |
34 | );
35 | }
36 |
37 | const styles = StyleSheet.create({
38 | button: {
39 | alignItems: 'center',
40 | backgroundColor: '#000000',
41 | borderRadius: 15,
42 | justifyContent: 'center',
43 | marginLeft: '3%',
44 | minHeight: 45,
45 | width: '36%',
46 | },
47 | });
48 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/components/GreenButton.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | import React from 'react';
17 | import {Text, StyleSheet, TouchableOpacity} from 'react-native';
18 |
19 | interface GreenButton {
20 | onPress: () => void;
21 | text: string;
22 | }
23 |
24 | const GreenButton: React.FC = ({onPress, text}) => {
25 | return (
26 | onPress()} style={styles.button}>
27 | {text}
28 |
29 | );
30 | };
31 |
32 | export default GreenButton;
33 |
34 | const styles = StyleSheet.create({
35 | button: {
36 | alignItems: 'center',
37 | backgroundColor: '#24988D',
38 | borderRadius: 15,
39 | justifyContent: 'center',
40 | marginLeft: '3%',
41 | minHeight: 45,
42 | width: '36%',
43 | },
44 | buttonText: {
45 | color: '#FFFFFF',
46 | fontSize: 14,
47 | },
48 | });
49 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/components/OrderInformationDescriptionView.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | import React from 'react';
17 | import {Text, StyleSheet} from 'react-native';
18 | import PropTypes from 'prop-types';
19 |
20 | OrderInformationDescriptionView.propTypes = {
21 | description: PropTypes.string.isRequired,
22 | };
23 |
24 | export default function OrderInformationDescriptionView({
25 | description,
26 | }: {
27 | description: string;
28 | }) {
29 | return {description};
30 | }
31 |
32 | const styles = StyleSheet.create({
33 | description: {
34 | color: '#000000',
35 | fontSize: 16,
36 | fontWeight: 'bold',
37 | },
38 | });
39 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/components/OrderInformationTitleView.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | import React from 'react';
17 | import { Text, StyleSheet } from 'react-native';
18 | import PropTypes from 'prop-types';
19 |
20 | OrderInformationTitleView.propTypes = {
21 | title: PropTypes.string.isRequired,
22 | };
23 |
24 | export default function OrderInformationTitleView({ title }: { title: string }) {
25 | return {title};
26 | }
27 |
28 | const styles = StyleSheet.create({
29 | title: {
30 | color: '#24988D',
31 | fontSize: 16,
32 | fontWeight: 'bold'
33 | },
34 | });
35 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/components/OrderInformationView.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | import React from 'react';
17 | import {Text, View, StyleSheet} from 'react-native';
18 | import PropTypes from 'prop-types';
19 |
20 | OrderInformationView.propTypes = {
21 | title: PropTypes.string.isRequired,
22 | description: PropTypes.string.isRequired,
23 | };
24 |
25 | export default function OrderInformationView(
26 | {title}: {title: string},
27 | {description}: {description: string},
28 | ) {
29 | return (
30 |
31 | {title}
32 | {description}
33 |
34 | );
35 | }
36 |
37 | const styles = StyleSheet.create({
38 | container: {
39 | alignItems: 'center',
40 | borderColor: '#000000',
41 | borderWidth: 2,
42 | flexDirection: 'row',
43 | justifyContent: 'space-between',
44 | marginLeft: '10%',
45 | marginRight: '10%',
46 | width: '80%',
47 | },
48 | description: {
49 | borderColor: '#123456',
50 | borderWidth: 2,
51 | flex: 1,
52 | },
53 | title: {
54 | flex: 1,
55 | fontSize: 18,
56 | },
57 | });
58 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/components/OrderTitleView.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | /* eslint no-undef: */
17 | import React from 'react';
18 | import { Text, View, StyleSheet, TouchableHighlight, Image } from 'react-native';
19 | import PropTypes from 'prop-types';
20 |
21 | const closeButton = require('../images/btnClose.png');
22 |
23 | OrderTitleView.propTypes = {
24 | onCloseOrderScreen: PropTypes.func.isRequired,
25 | };
26 |
27 | export default function OrderTitleView({
28 | onCloseOrderScreen,
29 | }: {
30 | onCloseOrderScreen: () => void;
31 | }) {
32 | return (
33 |
34 | Place your order
35 | onCloseOrderScreen()}>
39 |
40 |
41 |
42 | );
43 | }
44 |
45 | const styles = StyleSheet.create({
46 | closeButton: {
47 | },
48 | container: {
49 | width: '185%',
50 | backgroundColor: '#24988D',
51 | alignItems :'center',
52 | justifyContent :'center',
53 | flexDirection: 'row',
54 | marginBottom : '2%',
55 | },
56 | title: {
57 | position :'absolute',
58 | color: '#ffffff',
59 | fontSize: 18,
60 | fontWeight :'bold',
61 | textAlign: 'center',
62 | },
63 | });
64 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/components/PendingModal.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | import React from 'react';
17 | import {View, StyleSheet, Text, ActivityIndicator} from 'react-native';
18 |
19 | export default function PendingModal() {
20 | return (
21 |
22 |
23 | Processing...
24 |
25 |
26 |
27 |
28 |
29 | );
30 | }
31 |
32 | const styles = StyleSheet.create({
33 | activityContainer: {
34 | height: '10%',
35 | margin: '10%',
36 | },
37 | container: {
38 | width: '100%',
39 | },
40 | title: {
41 | color: '#000000',
42 | fontSize: 18,
43 | fontWeight: 'bold',
44 | },
45 | titleContainer: {
46 | alignItems: 'center',
47 | flexDirection: 'row',
48 | justifyContent: 'center',
49 | margin: '3%',
50 | },
51 | });
52 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/images/applePayLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/app/images/applePayLogo.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/images/applePayLogo@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/app/images/applePayLogo@2x.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/images/applePayLogo@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/app/images/applePayLogo@3x.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/images/btnClose.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/app/images/btnClose.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/images/btnClose@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/app/images/btnClose@2x.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/images/btnClose@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/app/images/btnClose@3x.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/images/failIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/app/images/failIcon.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/images/googlePayLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/app/images/googlePayLogo.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/images/googlePayLogo@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/app/images/googlePayLogo@2x.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/images/googlePayLogo@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/app/images/googlePayLogo@3x.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/images/iconCookie.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/app/images/iconCookie.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/images/iconCookie@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/app/images/iconCookie@2x.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/images/iconCookie@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/app/images/iconCookie@3x.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/images/sucessIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/app/images/sucessIcon.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/service/Charge.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | import {CHARGE_SERVER_URL} from '../Constants';
17 | import ChargeError from '../ChargeError';
18 |
19 | export default async function chargeCardNonce(
20 | nonce: string,
21 | verificationToken = undefined,
22 | ) {
23 | let body;
24 | if (verificationToken === undefined) {
25 | body = JSON.stringify({
26 | nonce,
27 | });
28 | } else {
29 | body = JSON.stringify({
30 | nonce,
31 | verificationToken,
32 | });
33 | }
34 | const response = await fetch(CHARGE_SERVER_URL, {
35 | method: 'POST',
36 | headers: {
37 | Accept: 'application/json',
38 | 'Content-Type': 'application/json',
39 | },
40 | body,
41 | });
42 |
43 | try {
44 | const responseJson = await response.json();
45 | if (responseJson.errorMessage != null) {
46 | throw new ChargeError(responseJson.errorMessage);
47 | }
48 | } catch (error: any) {
49 | throw new ChargeError(error.message);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/service/ChargeCustomerCard.tsx:
--------------------------------------------------------------------------------
1 | /* eslint-disable camelcase */
2 | /*
3 | Copyright 2022 Square Inc.
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | import {CHARGE_CUSTOMER_CARD_SERVER_URL} from '../Constants';
18 | import ChargeCustomerCardError from '../ChargeCustomerCardError';
19 |
20 | export default async function chargeCustomerCard(
21 | customer_id: string,
22 | customer_card_id: string,
23 | ) {
24 | const response = await fetch(CHARGE_CUSTOMER_CARD_SERVER_URL, {
25 | method: 'POST',
26 | headers: {
27 | Accept: 'application/json',
28 | 'Content-Type': 'application/json',
29 | },
30 | body: JSON.stringify({
31 | customer_id,
32 | customer_card_id,
33 | }),
34 | });
35 |
36 | try {
37 | const responseJson = await response.json();
38 | if (responseJson.errorMessage != null) {
39 | throw new ChargeCustomerCardError(responseJson.errorMessage);
40 | }
41 | return responseJson;
42 | } catch (error: any) {
43 | throw new ChargeCustomerCardError(error.message);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/app/service/CreateCustomerCard.tsx:
--------------------------------------------------------------------------------
1 | /* eslint-disable camelcase */
2 | /*
3 | Copyright 2022 Square Inc.
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | import {CREATE_CUSTOMER_CARD_SERVER_URL} from '../Constants';
18 | import CreateCustomerCardError from '../CreateCustomerCardError';
19 |
20 | export default async function createCustomerCard(
21 | customer_id: string,
22 | nonce: string,
23 | ) {
24 | const response = await fetch(CREATE_CUSTOMER_CARD_SERVER_URL, {
25 | method: 'POST',
26 | headers: {
27 | Accept: 'application/json',
28 | 'Content-Type': 'application/json',
29 | },
30 | body: JSON.stringify({
31 | customer_id,
32 | nonce,
33 | }),
34 | });
35 |
36 | try {
37 | const responseJson = await response.json();
38 | if (responseJson.errorMessage != null) {
39 | throw new CreateCustomerCardError(responseJson.errorMessage);
40 | }
41 | return responseJson;
42 | } catch (error: any) {
43 | throw new CreateCustomerCardError(error.message);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: ['module:@react-native/babel-preset'],
3 | };
4 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/in-app-payments-sample-triscreen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/in-app-payments-sample-triscreen.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | import { AppRegistry, LogBox } from 'react-native';
18 | import App from './App';
19 | import { name as appName } from './app.json';
20 |
21 | AppRegistry.registerComponent(appName, () => App);
22 |
23 | /* We are getting warnings due to the newest version of react-native.
24 | A lot of libraries still haven't released a new version to handle
25 | these errors (or warnings in some cases).
26 | so we can hide the warning for now with this logBox. */
27 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/.xcode.env:
--------------------------------------------------------------------------------
1 | export NODE_BINARY=$(command -v node)
2 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/Podfile:
--------------------------------------------------------------------------------
1 | platform :ios, '14.1'
2 |
3 | # Resolve react_native_pods.rb with node to allow for hoisting
4 | require Pod::Executable.execute_command('node', ['-p',
5 | 'require.resolve(
6 | "react-native/scripts/react_native_pods.rb",
7 | {paths: [process.argv[1]]},
8 | )', __dir__]).strip
9 |
10 | prepare_react_native_project!
11 |
12 | linkage = ENV['USE_FRAMEWORKS']
13 | if linkage != nil
14 | Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
15 | # use_frameworks! :linkage => linkage.to_sym
16 | end
17 | use_frameworks! :linkage => :static
18 | target 'RNInAppPaymentsQuickstart' do
19 | config = use_native_modules!
20 |
21 | use_react_native!(
22 | :path => config[:reactNativePath],
23 | # An absolute path to your application root.
24 | # :app_path => "#{Pod::Config.instance.installation_root}/.."
25 | )
26 | pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'
27 |
28 | post_install do |installer|
29 | react_native_post_install(installer)
30 |
31 | # Apple Silicon builds require a library path tweak for Swift library discovery or "symbol not found" for swift things
32 | installer.aggregate_targets.each do |aggregate_target|
33 | aggregate_target.user_project.native_targets.each do |target|
34 | target.build_configurations.each do |config|
35 | config.build_settings['LIBRARY_SEARCH_PATHS'] = ['$(SDKROOT)/usr/lib/swift', '$(inherited)']
36 | config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
37 | config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14.1'
38 | config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ''
39 | config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
40 | config.build_settings['CODE_SIGNING_REQUIRED'] = 'NO'
41 | end
42 | end
43 | aggregate_target.user_project.save
44 | end
45 | # Flipper requires a crude patch to bump up iOS deployment target, or "error: thread-local storage is not supported for the current target"
46 | # I'm not aware of any other way to fix this one other than bumping iOS deployment target to match react-native (iOS 11 now)
47 | installer.pods_project.targets.each do |target|
48 | target.build_configurations.each do |config|
49 | config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
50 | # config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "i386"
51 | config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14.1'
52 | config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ''
53 | config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
54 | config.build_settings['CODE_SIGNING_REQUIRED'] = 'NO'
55 | end
56 | end
57 | # ...but if you bump iOS deployment target, Flipper barfs again "Time.h:52:17: error: typedef redefinition with different types"
58 | # We need to make one crude patch to RCT-Folly - set `__IPHONE_10_0` to our iOS target + 1
59 | # https://github.com/facebook/flipper/issues/834 - 84 comments and still going...
60 | `sed -i -e $'s/__IPHONE_10_0/__IPHONE_12_0/' #{installer.sandbox.root}/RCT-Folly/folly/portability/Time.h`
61 | end
62 | end
63 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/RNInAppPaymentsQuickstart.xcodeproj/xcshareddata/xcschemes/RNInAppPaymentsQuickstart.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
53 |
55 |
61 |
62 |
63 |
64 |
70 |
72 |
78 |
79 |
80 |
81 |
83 |
84 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/RNInAppPaymentsQuickstart.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/RNInAppPaymentsQuickstart.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/RNInAppPaymentsQuickstart.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/RNInAppPaymentsQuickstart/AppDelegate.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Facebook, Inc. and its affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | #import
9 | #import
10 |
11 | @interface AppDelegate : RCTAppDelegate
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/RNInAppPaymentsQuickstart/AppDelegate.mm:
--------------------------------------------------------------------------------
1 | #import "AppDelegate.h"
2 |
3 | #import
4 |
5 | @implementation AppDelegate
6 |
7 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
8 | {
9 | self.moduleName = @"RNInAppPaymentsQuickstart";
10 | // You can add your custom initial props in the dictionary below.
11 | // They will be passed down to the ViewController used by React Native.
12 | self.initialProps = @{};
13 |
14 | return [super application:application didFinishLaunchingWithOptions:launchOptions];
15 | }
16 |
17 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
18 | {
19 | return [self bundleURL];
20 | }
21 |
22 | - (NSURL *)bundleURL
23 | {
24 | #if DEBUG
25 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
26 | #else
27 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
28 | #endif
29 | }
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/RNInAppPaymentsQuickstart/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
21 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/RNInAppPaymentsQuickstart/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "20x20",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "20x20",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "29x29",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "29x29",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "40x40",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "40x40",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "60x60",
35 | "idiom" : "iphone",
36 | "filename" : "Icon@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "60x60",
41 | "idiom" : "iphone",
42 | "filename" : "Icon@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "idiom" : "ipad",
47 | "size" : "20x20",
48 | "scale" : "1x"
49 | },
50 | {
51 | "idiom" : "ipad",
52 | "size" : "20x20",
53 | "scale" : "2x"
54 | },
55 | {
56 | "idiom" : "ipad",
57 | "size" : "29x29",
58 | "scale" : "1x"
59 | },
60 | {
61 | "idiom" : "ipad",
62 | "size" : "29x29",
63 | "scale" : "2x"
64 | },
65 | {
66 | "idiom" : "ipad",
67 | "size" : "40x40",
68 | "scale" : "1x"
69 | },
70 | {
71 | "idiom" : "ipad",
72 | "size" : "40x40",
73 | "scale" : "2x"
74 | },
75 | {
76 | "size" : "76x76",
77 | "idiom" : "ipad",
78 | "filename" : "IconiPad.png",
79 | "scale" : "1x"
80 | },
81 | {
82 | "size" : "76x76",
83 | "idiom" : "ipad",
84 | "filename" : "IconiPad@2x.png",
85 | "scale" : "2x"
86 | },
87 | {
88 | "size" : "83.5x83.5",
89 | "idiom" : "ipad",
90 | "filename" : "IconiPadPro.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "1024x1024",
95 | "idiom" : "ios-marketing",
96 | "filename" : "Icon1024.png",
97 | "scale" : "1x"
98 | }
99 | ],
100 | "info" : {
101 | "version" : 1,
102 | "author" : "xcode"
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/RNInAppPaymentsQuickstart/Images.xcassets/AppIcon.appiconset/Icon1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/ios/RNInAppPaymentsQuickstart/Images.xcassets/AppIcon.appiconset/Icon1024.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/RNInAppPaymentsQuickstart/Images.xcassets/AppIcon.appiconset/Icon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/ios/RNInAppPaymentsQuickstart/Images.xcassets/AppIcon.appiconset/Icon@2x.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/RNInAppPaymentsQuickstart/Images.xcassets/AppIcon.appiconset/Icon@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/ios/RNInAppPaymentsQuickstart/Images.xcassets/AppIcon.appiconset/Icon@3x.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/RNInAppPaymentsQuickstart/Images.xcassets/AppIcon.appiconset/IconiPad.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/ios/RNInAppPaymentsQuickstart/Images.xcassets/AppIcon.appiconset/IconiPad.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/RNInAppPaymentsQuickstart/Images.xcassets/AppIcon.appiconset/IconiPad@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/ios/RNInAppPaymentsQuickstart/Images.xcassets/AppIcon.appiconset/IconiPad@2x.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/RNInAppPaymentsQuickstart/Images.xcassets/AppIcon.appiconset/IconiPadPro.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/ios/RNInAppPaymentsQuickstart/Images.xcassets/AppIcon.appiconset/IconiPadPro.png
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/RNInAppPaymentsQuickstart/Images.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/RNInAppPaymentsQuickstart/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | React 🍪
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1
25 | LSRequiresIPhoneOS
26 |
27 | NSAppTransportSecurity
28 |
29 |
30 | NSAllowsArbitraryLoads
31 |
32 | NSAllowsLocalNetworking
33 |
34 |
35 | NSLocationWhenInUseUsageDescription
36 |
37 | UILaunchStoryboardName
38 | LaunchScreen
39 | UIRequiredDeviceCapabilities
40 |
41 | arm64
42 |
43 | UISupportedInterfaceOrientations
44 |
45 | UIInterfaceOrientationPortrait
46 | UIInterfaceOrientationLandscapeLeft
47 | UIInterfaceOrientationLandscapeRight
48 |
49 | UIViewControllerBasedStatusBarAppearance
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/RNInAppPaymentsQuickstart/PrivacyInfo.xcprivacy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NSPrivacyAccessedAPITypes
6 |
7 |
8 | NSPrivacyAccessedAPIType
9 | NSPrivacyAccessedAPICategoryFileTimestamp
10 | NSPrivacyAccessedAPITypeReasons
11 |
12 | C617.1
13 |
14 |
15 |
16 | NSPrivacyAccessedAPIType
17 | NSPrivacyAccessedAPICategoryUserDefaults
18 | NSPrivacyAccessedAPITypeReasons
19 |
20 | CA92.1
21 |
22 |
23 |
24 | NSPrivacyAccessedAPIType
25 | NSPrivacyAccessedAPICategorySystemBootTime
26 | NSPrivacyAccessedAPITypeReasons
27 |
28 | 35F9.1
29 |
30 |
31 |
32 | NSPrivacyCollectedDataTypes
33 |
34 | NSPrivacyTracking
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/RNInAppPaymentsQuickstart/es.lproj/LaunchScreen.strings:
--------------------------------------------------------------------------------
1 |
2 | /* Class = "UILabel"; text = "Powered by React Native"; ObjectID = "8ie-xW-0ye"; */
3 | "8ie-xW-0ye.text" = "Powered by React Native";
4 |
5 | /* Class = "UILabel"; text = "RNInAppPaymentsQuickstart"; ObjectID = "kId-c2-rCX"; */
6 | "kId-c2-rCX.text" = "RNInAppPaymentsQuickstart";
7 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/RNInAppPaymentsQuickstart/ja.lproj/LaunchScreen.strings:
--------------------------------------------------------------------------------
1 |
2 | /* Class = "UILabel"; text = "Powered by React Native"; ObjectID = "8ie-xW-0ye"; */
3 | "8ie-xW-0ye.text" = "Powered by React Native";
4 |
5 | /* Class = "UILabel"; text = "RNInAppPaymentsQuickstart"; ObjectID = "kId-c2-rCX"; */
6 | "kId-c2-rCX.text" = "RNInAppPaymentsQuickstart";
7 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/RNInAppPaymentsQuickstart/ja.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
21 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/RNInAppPaymentsQuickstart/main.m:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | #import
9 |
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char *argv[])
13 | {
14 | @autoreleasepool
15 | {
16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/CorePaymentCardResources.bundle/CorePaymentCardResources-Info.plist:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/CorePaymentCardResources.bundle/CorePaymentCardResources-Info.plist
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/CorePaymentCardResources.bundle/Info.plist:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/CorePaymentCardResources.bundle/Info.plist
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/CorePaymentCardResources.bundle/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/CorePaymentCardResources.bundle/en.lproj/InfoPlist.strings
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/Headers/PKPaymentRequest+Square.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018-present, Square, Inc. All rights reserved.
3 | //
4 | // Your use of this software is subject to the Square Developer Terms of
5 | // Service (https://squareup.com/legal/developers). This copyright notice shall
6 | // be included in all copies or substantial portions of the software.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
9 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
11 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
13 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
14 | // THE SOFTWARE.
15 | //
16 |
17 | #import
18 |
19 | /**
20 | PKPaymentRequest additions for using Apple Pay with Square.
21 | */
22 | @interface PKPaymentRequest (Square)
23 |
24 | /**
25 | Creates a PKPaymentRequest instance with Square-supported networks and merchant capabilities.
26 |
27 | @param merchantIdentifier Your merchant identifier. This must be one of the Merchant IDs associated with your Apple Developer account.
28 | @param countryCode The two-letter ISO 3166 country code for the country where the payment will be processed. E.g. "US".
29 | @param currencyCode The three-letter ISO 4217 currency code. E.g. "USD".
30 | */
31 | + (nonnull PKPaymentRequest *)squarePaymentRequestWithMerchantIdentifier:(nonnull NSString *)merchantIdentifier
32 | countryCode:(nonnull NSString *)countryCode
33 | currencyCode:(nonnull NSString *)currencyCode NS_SWIFT_NAME(squarePaymentRequest(merchantIdentifier:countryCode:currencyCode:));
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/Headers/SQIPApplePayNonceRequest.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018-present, Square, Inc. All rights reserved.
3 | //
4 | // Your use of this software is subject to the Square Developer Terms of
5 | // Service (https://squareup.com/legal/developers). This copyright notice shall
6 | // be included in all copies or substantial portions of the software.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
9 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
11 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
13 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
14 | // THE SOFTWARE.
15 | //
16 |
17 | #import
18 |
19 | @class PKPayment;
20 | @class SQIPCardDetails;
21 |
22 | /**
23 | A completion handler that handles the result of an Apple Pay nonce request.
24 | @param cardDetails Contains details about the card, including the nonce. `nil` when the request fails.
25 | @param error An error with domain `SQIPApplePayNonceRequestErrorDomain` when the nonce request fails; otherwise, `nil`.
26 |
27 | @see `SQIPApplePayNonceRequestError` for possible error types.
28 | */
29 | typedef void (^SQIPApplePayNonceRequestCompletionHandler)(SQIPCardDetails *_Nullable cardDetails, NSError *_Nullable error);
30 |
31 |
32 | /**
33 | Lets the application retrieve a card nonce using a PKPayment instance obtained from Apple Pay.
34 | */
35 | @interface SQIPApplePayNonceRequest : NSObject
36 |
37 | /**
38 | Creates a new Apple Pay nonce request.
39 |
40 | @param payment The PKPayment that should be used to request a nonce.
41 | */
42 | - (nonnull instancetype)initWithPayment:(nonnull PKPayment *)payment;
43 |
44 | /**
45 | Performs the request to retrieve a card nonce.
46 |
47 | @param completionHandler The completion handler to be called upon success or failure of the nonce request.
48 | */
49 | - (void)performWithCompletionHandler:(nonnull SQIPApplePayNonceRequestCompletionHandler)completionHandler;
50 |
51 | /**
52 | :nodoc:
53 | `init` is unavailable. Use `-[SQIPApplePayNonceRequest initWithPayment:]` instead.
54 | */
55 | - (instancetype)init NS_UNAVAILABLE;
56 |
57 | /**
58 | :nodoc:
59 | `new` is unavailable. Use `-[SQIPApplePayNonceRequest initWithPayment:]` instead.
60 | */
61 | + (instancetype) new NS_UNAVAILABLE;
62 |
63 | @end
64 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/Headers/SQIPApplePayNonceRequestError.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018-present, Square, Inc. All rights reserved.
3 | //
4 | // Your use of this software is subject to the Square Developer Terms of
5 | // Service (https://squareup.com/legal/developers). This copyright notice shall
6 | // be included in all copies or substantial portions of the software.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
9 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
11 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
13 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
14 | // THE SOFTWARE.
15 | //
16 |
17 | #import
18 | #import
19 |
20 |
21 | /**
22 | The domain for errors that occur when requesting a card nonce using Apple Pay.
23 | */
24 | extern NSString *_Nonnull const SQIPApplePayNonceRequestErrorDomain;
25 |
26 | /**
27 | Possible error codes that can be returned as a result of attempting to create a card nonce.
28 | */
29 | SQIP_ERROR_ENUM(SQIPApplePayNonceRequestErrorDomain, SQIPApplePayNonceRequestError){
30 |
31 | /**
32 | Square In-App Payments SDK could not connect to the network.
33 | */
34 | SQIPApplePayNonceRequestErrorNoNetwork = 1,
35 |
36 | /**
37 | The version of the Square In-App Payments SDK used by this application is no longer supported.
38 | */
39 | SQIPApplePayNonceRequestErrorUnsupportedSDKVersion,
40 |
41 | /**
42 | `SQIPApplePayNonceRequest` was used in an unexpected or unsupported way.
43 | See `userInfo[SQIPErrorDebugCodeKey]` and `userInfo[SQIPErrorDebugMessageKey]` for more information.
44 | */
45 | SQIPApplePayNonceRequestErrorUsageError,
46 | };
47 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/Headers/SQIPCard.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018-present, Square, Inc. All rights reserved.
3 | //
4 | // Your use of this software is subject to the Square Developer Terms of
5 | // Service (https://squareup.com/legal/developers). This copyright notice shall
6 | // be included in all copies or substantial portions of the software.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
9 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
11 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
13 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
14 | // THE SOFTWARE.
15 | //
16 |
17 | #import
18 |
19 | #import
20 | #import
21 | #import
22 |
23 | /**
24 | Represents a payment card.
25 | */
26 | @interface SQIPCard : NSObject
27 |
28 | /**
29 | The card brand (for example, Visa).
30 | */
31 | @property (nonatomic, assign, readonly) SQIPCardBrand brand;
32 |
33 | /**
34 | The last 4 digits of the card number.
35 | */
36 | @property (nonatomic, strong, readonly, nonnull) NSString *lastFourDigits;
37 |
38 | /**
39 | The expiration month of the card. Ranges between 1 and 12.
40 | */
41 | @property (nonatomic, assign, readonly) NSUInteger expirationMonth;
42 |
43 | /**
44 | The 4-digit expiration year of the card.
45 | */
46 | @property (nonatomic, assign, readonly) NSUInteger expirationYear;
47 |
48 | /**
49 | The billing postal code associated with the card, if available.
50 | */
51 | @property (nonatomic, strong, readonly, nullable) NSString *postalCode;
52 |
53 | /**
54 | :nodoc:
55 | The type of card (for example, Credit or Debit)
56 | Note: This property is experimental and will always return `unknown`
57 | */
58 | @property (nonatomic, assign, readonly) SQIPCardType type;
59 |
60 | /**
61 | :nodoc:
62 | The prepaid type of the credit card (for example, a Prepaid Gift Card)
63 | Note: This property is experimental and will always return `unknown`
64 | */
65 | @property (nonatomic, assign, readonly) SQIPCardPrepaidType prepaidType;
66 |
67 | /**
68 | :nodoc:
69 | `init` is unavailable.
70 | */
71 | - (instancetype)init NS_UNAVAILABLE;
72 |
73 | /**
74 | :nodoc:
75 | `new` is unavailable.
76 | */
77 | + (instancetype) new NS_UNAVAILABLE;
78 |
79 | @end
80 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/Headers/SQIPCardBrand.h:
--------------------------------------------------------------------------------
1 | #pragma Formatter Exempt
2 |
3 | //
4 | // Copyright (c) 2018-present, Square, Inc. All rights reserved.
5 | //
6 | // Your use of this software is subject to the Square Developer Terms of
7 | // Service (https://squareup.com/legal/developers). This copyright notice shall
8 | // be included in all copies or substantial portions of the software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
11 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
13 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
15 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
16 | // THE SOFTWARE.
17 | //
18 |
19 | #import
20 |
21 | /** Indicates a card's brand, such as Visa. */
22 | typedef NS_ENUM(NSUInteger, SQIPCardBrand) {
23 |
24 | /** An unidentified brand */
25 | SQIPCardBrandOtherBrand = 0,
26 |
27 | /** Visa */
28 | SQIPCardBrandVisa,
29 |
30 | /** Mastercard */
31 | SQIPCardBrandMastercard,
32 |
33 | /** American Express */
34 | SQIPCardBrandAmericanExpress,
35 |
36 | /** Discover */
37 | SQIPCardBrandDiscover,
38 |
39 | /** Diners Club International */
40 | SQIPCardBrandDiscoverDiners,
41 |
42 | /** JCB */
43 | SQIPCardBrandJCB,
44 |
45 | /** China UnionPay */
46 | SQIPCardBrandChinaUnionPay,
47 | };
48 |
49 | /**
50 | Creates a SQIPCardBrand from a string. i.e. "VISA" -> SQIPCardBrandVisa.
51 | :nodoc:
52 | */
53 | extern SQIPCardBrand SQIPCardBrandFromString(NSString *_Nonnull cardBrand) CF_SWIFT_NAME(SQIPCardBrand.init(_:));
54 |
55 | /**
56 | Creates a string from an SQIPCardBrand. i.e. SQIPCardBrandVisa -> "VISA".
57 | :nodoc:
58 | */
59 | extern NSString *_Nonnull NSStringFromSQIPCardBrand(SQIPCardBrand cardBrand) CF_SWIFT_NAME(getter:SQIPCardBrand.description(self:));
60 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/Headers/SQIPCardDetails.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018-present, Square, Inc. All rights reserved.
3 | //
4 | // Your use of this software is subject to the Square Developer Terms of
5 | // Service (https://squareup.com/legal/developers). This copyright notice shall
6 | // be included in all copies or substantial portions of the software.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
9 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
11 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
13 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
14 | // THE SOFTWARE.
15 | //
16 |
17 | #import
18 |
19 | @class SQIPCard;
20 |
21 | /**
22 | Represents the result of a successful operation to process card payment information.
23 | */
24 | @interface SQIPCardDetails : NSObject
25 |
26 | /**
27 | A one-time-use payment token that is used with the Payments API to [charge the card](https://developer.squareup.com/reference/square/payments-api/create-payment) or the Customers API to [store the Card on File](https://developer.squareup.com/reference/square/customers-api/create-customer-card).
28 | */
29 | @property (nonatomic, strong, readonly, nonnull) NSString *nonce;
30 |
31 | /**
32 | The payment card.
33 | */
34 | @property (nonatomic, strong, readonly, nonnull) SQIPCard *card;
35 |
36 | /**
37 | :nodoc:
38 | `init` is unavailable.
39 | */
40 | - (instancetype)init NS_UNAVAILABLE;
41 |
42 | /**
43 | :nodoc:
44 | `new` is unavailable.
45 | */
46 | + (instancetype) new NS_UNAVAILABLE;
47 |
48 | @end
49 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/Headers/SQIPCardPrepaidType.h:
--------------------------------------------------------------------------------
1 | #pragma Formatter Exempt
2 |
3 | //
4 | // Copyright (c) 2018-present, Square, Inc. All rights reserved.
5 | //
6 | // Your use of this software is subject to the Square Developer Terms of
7 | // Service (https://squareup.com/legal/developers). This copyright notice shall
8 | // be included in all copies or substantial portions of the software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
11 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
13 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
15 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
16 | // THE SOFTWARE.
17 | //
18 |
19 |
20 | #import
21 |
22 | /**
23 | Indicates if a card is prepaid.
24 | :nodoc:
25 | */
26 | typedef NS_ENUM(NSUInteger, SQIPCardPrepaidType) {
27 | /** Unable to determine whether the card is prepaid or not. */
28 | SQIPCardPrepaidTypeUnknown,
29 |
30 | /** Card that is not prepaid */
31 | SQIPCardPrepaidTypeNotPrepaid,
32 |
33 | /** Prepaid card */
34 | SQIPCardPrepaidTypePrepaid,
35 | };
36 |
37 | /**
38 | Creates a SQIPCardPrepaidType from a string. i.e. "PREPAID" -> SQIPCardPrepaidTypePrepaid.
39 | :nodoc:
40 | */
41 | extern SQIPCardPrepaidType SQIPCardPrepaidTypeFromString(NSString *_Nullable prepaidType) CF_SWIFT_NAME(SQIPCardPrepaidType.init(_:));
42 |
43 | /**
44 | Creates a string from a SQIPCardPrepaidType. i.e. SQIPCardPrepaidTypePrepaid -> "PREPAID".
45 | :nodoc:
46 | */
47 | extern NSString *_Nonnull NSStringFromSQIPCardPrepaidType(SQIPCardPrepaidType prepaidType) CF_SWIFT_NAME(getter:SQIPCardPrepaidType.description(self:));
48 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/Headers/SQIPCardType.h:
--------------------------------------------------------------------------------
1 | #pragma Formatter Exempt
2 |
3 | //
4 | // Copyright (c) 2018-present, Square, Inc. All rights reserved.
5 | //
6 | // Your use of this software is subject to the Square Developer Terms of
7 | // Service (https://squareup.com/legal/developers). This copyright notice shall
8 | // be included in all copies or substantial portions of the software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
11 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
13 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
15 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
16 | // THE SOFTWARE.
17 | //
18 |
19 | #import
20 |
21 | /**
22 | Indicates a card's type. Such as Credit
23 | :nodoc:
24 | */
25 | typedef NS_ENUM(NSUInteger, SQIPCardType) {
26 | /** Unidentified type */
27 | SQIPCardTypeUnknown,
28 |
29 | /** Credit Card */
30 | SQIPCardTypeCredit,
31 |
32 | /** Debit Card */
33 | SQIPCardTypeDebit,
34 | };
35 |
36 | /**
37 | Creates a SQIPCardType from a string. i.e. "CREDIT" -> SQIPCardTypeCredit.
38 | :nodoc:
39 | */
40 | extern SQIPCardType SQIPCardTypeFromString(NSString *_Nullable type) CF_SWIFT_NAME(SQIPCardType.init(_:));
41 |
42 | /**
43 | Creates a string from an SQIPCardType. i.e. SQIPCardTypeCredit -> "CREDIT".
44 | :nodoc:
45 | */
46 | extern NSString *_Nonnull NSStringFromSQIPCardType(SQIPCardType cardType) CF_SWIFT_NAME(getter:SQIPCardType.description(self:));
47 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/Headers/SQIPErrorConstants.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018-present, Square, Inc. All rights reserved.
3 | //
4 | // Your use of this software is subject to the Square Developer Terms of
5 | // Service (https://squareup.com/legal/developers). This copyright notice shall
6 | // be included in all copies or substantial portions of the software.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
9 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
11 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
13 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
14 | // THE SOFTWARE.
15 | //
16 |
17 | #import
18 |
19 | /**
20 | The `NSError` `userInfo` key used to retrieve a detailed debug code string for the error that occurred.
21 | */
22 | extern NSString *_Nonnull const SQIPErrorDebugCodeKey;
23 |
24 | /**
25 | The `NSError` `userInfo` key used to retrieve a human-readable message containing additional debug information related to the possible cause of the error.
26 | Debug messages should not be displayed to customers.
27 | */
28 | extern NSString *_Nonnull const SQIPErrorDebugMessageKey;
29 |
30 | #define SQIP_ERROR_ENUM(_domain, _name) \
31 | typedef enum _name : NSInteger _name; \
32 | enum __attribute__((ns_error_domain(_domain))) _name : NSInteger
33 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/Headers/SQIPInAppPaymentsSDK.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018-present, Square, Inc. All rights reserved.
3 | //
4 | // Your use of this software is subject to the Square Developer Terms of
5 | // Service (https://squareup.com/legal/developers). This copyright notice shall
6 | // be included in all copies or substantial portions of the software.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
9 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
11 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
13 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
14 | // THE SOFTWARE.
15 | //
16 |
17 | #import
18 |
19 | /**
20 | Manages configuration of the Square In-App Payments SDK.
21 | */
22 | @interface SQIPInAppPaymentsSDK : NSObject
23 |
24 | /**
25 | The Square application ID used to obtain a card nonce.
26 | @warning You must set a Square application ID before attempting any other SDK operation, or your app will crash.
27 | */
28 | @property (class, nonatomic, strong, nullable) NSString *squareApplicationID;
29 |
30 | /**
31 | `true` if the device supports Apple Pay and the customer's wallet contains a card supported by Square; `false` otherwise.
32 | */
33 | @property (class, nonatomic, readonly) BOOL canUseApplePay;
34 |
35 | /**
36 | :nodoc:
37 | `init` is unavailable.
38 | */
39 | - (instancetype)init NS_UNAVAILABLE;
40 |
41 | /**
42 | :nodoc:
43 | `new` is unavailable.
44 | */
45 | + (instancetype) new NS_UNAVAILABLE;
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/Headers/SQIPTheme.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018-present, Square, Inc. All rights reserved.
3 | //
4 | // Your use of this software is subject to the Square Developer Terms of
5 | // Service (https://squareup.com/legal/developers). This copyright notice shall
6 | // be included in all copies or substantial portions of the software.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
9 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
11 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
13 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
14 | // THE SOFTWARE.
15 | //
16 |
17 | #import
18 |
19 | /**
20 | Encapsulates options used to style SQIPCardEntryViewController.
21 | */
22 | @interface SQIPTheme : NSObject
23 |
24 | /**
25 | The font used for text fields and informational messages.
26 | */
27 | @property (nonatomic, strong, nonnull) UIFont *font;
28 |
29 | /**
30 | The background color of the card entry view controller.
31 | */
32 | @property (nonatomic, strong, nonnull) UIColor *backgroundColor;
33 |
34 | /**
35 | The fill color for text fields.
36 | */
37 | @property (nonatomic, strong, nonnull) UIColor *foregroundColor;
38 |
39 | /**
40 | The text field text color.
41 | */
42 | @property (nonatomic, strong, nonnull) UIColor *textColor;
43 |
44 | /**
45 | The text field placeholder text color.
46 | */
47 | @property (nonatomic, strong, nonnull) UIColor *placeholderTextColor;
48 |
49 | /**
50 | The tint color reflected in:
51 | * the text field cursor
52 | * the save button background color when enabled
53 | * the loading indicator
54 | */
55 | @property (nonatomic, strong, nonnull) UIColor *tintColor;
56 |
57 | /**
58 | The text color used to display informational messages (e.g. "Enter the three digit CVV number").
59 | */
60 | @property (nonatomic, strong, nonnull) UIColor *messageColor;
61 |
62 | /**
63 | The text color used to display errors.
64 | */
65 | @property (nonatomic, strong, nonnull) UIColor *errorColor;
66 |
67 | /**
68 | The title of the save button.
69 |
70 | */
71 | @property (nonatomic, strong, nonnull) NSString *saveButtonTitle;
72 |
73 | /**
74 | The save button font.
75 | */
76 | @property (nonatomic, strong, nonnull) UIFont *saveButtonFont;
77 |
78 | /**
79 | The text color of the save button when enabled.
80 | */
81 | @property (nonatomic, strong, nonnull) UIColor *saveButtonTextColor;
82 |
83 | /**
84 | The keyboard appearance.
85 | */
86 | @property (nonatomic) UIKeyboardAppearance keyboardAppearance;
87 |
88 | /**
89 | Sets an optional custom cancel button used to dismiss the view controller.
90 | This property is nil by default, indicating that the default cancel button should be used.
91 | */
92 |
93 | @property (nonatomic, strong, nullable) UIBarButtonItem *cancelButton;
94 |
95 | @end
96 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/Headers/SquareInAppPaymentsSDK.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018-present, Square, Inc. All rights reserved.
3 | //
4 | // Your use of this software is subject to the Square Developer Terms of
5 | // Service (https://squareup.com/legal/developers). This copyright notice shall
6 | // be included in all copies or substantial portions of the software.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
9 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
11 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
13 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
14 | // THE SOFTWARE.
15 | //
16 |
17 | #import
18 | #import
19 | #import
20 | #import
21 | #import
22 | #import
23 | #import
24 | #import
25 | #import
26 | #import
27 | #import
28 | #import
29 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/Info.plist:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/Info.plist
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/Modules/module.modulemap:
--------------------------------------------------------------------------------
1 | framework module SquareInAppPaymentsSDK {
2 | umbrella header "SquareInAppPaymentsSDK.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/SquareCoreResources.bundle/Info.plist:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/SquareCoreResources.bundle/Info.plist
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/SquareCoreResources.bundle/SquareCoreResources-Info.plist:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/SquareCoreResources.bundle/SquareCoreResources-Info.plist
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/SquareCoreResources.bundle/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/SquareCoreResources.bundle/en.lproj/InfoPlist.strings
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/SquareInAppPaymentsSDK:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/SquareInAppPaymentsSDK
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/SquareInAppPaymentsSDKResources.bundle/Assets.car:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/SquareInAppPaymentsSDKResources.bundle/Assets.car
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/SquareInAppPaymentsSDKResources.bundle/Base.lproj/Localizable.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/SquareInAppPaymentsSDKResources.bundle/Base.lproj/Localizable.strings
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/SquareInAppPaymentsSDKResources.bundle/Info.plist:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/SquareInAppPaymentsSDKResources.bundle/Info.plist
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/SquareInAppPaymentsSDKResources.bundle/en-AU.lproj/Localizable.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/SquareInAppPaymentsSDKResources.bundle/en-AU.lproj/Localizable.strings
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/SquareInAppPaymentsSDKResources.bundle/en-CA.lproj/Localizable.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/SquareInAppPaymentsSDKResources.bundle/en-CA.lproj/Localizable.strings
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/SquareInAppPaymentsSDKResources.bundle/en-GB.lproj/Localizable.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/SquareInAppPaymentsSDKResources.bundle/en-GB.lproj/Localizable.strings
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/SquareInAppPaymentsSDKResources.bundle/en.lproj/Localizable.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/SquareInAppPaymentsSDKResources.bundle/en.lproj/Localizable.strings
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/SquareInAppPaymentsSDKResources.bundle/es.lproj/Localizable.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/SquareInAppPaymentsSDKResources.bundle/es.lproj/Localizable.strings
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/SquareInAppPaymentsSDKResources.bundle/fr-CA.lproj/Localizable.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/SquareInAppPaymentsSDKResources.bundle/fr-CA.lproj/Localizable.strings
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/SquareInAppPaymentsSDKResources.bundle/ja.lproj/Localizable.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/SquareInAppPaymentsSDKResources.bundle/ja.lproj/Localizable.strings
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/SquareInAppPaymentsSDKResources.bundle/trustedcerts.plist:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square/in-app-payments-react-native-plugin/8206577acd28ddbe0d55713d8532a131804c8b8a/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/SquareInAppPaymentsSDKResources.bundle/trustedcerts.plist
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/ios/SquareInAppPaymentsSDK.framework/setup:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Don't choke if projects or targets have spaces in the name
4 | OLDIFS=$IFS
5 | IFS=$(echo "")
6 |
7 | # Remove unused architectures if archiving
8 |
9 | MOBILE_COMMERCE_SDK_FRAMEWORK="SquareInAppPaymentsSDK.framework"
10 |
11 | # Restore original field separator so $ARCHS is recognized as an array.
12 | IFS=$OLDIFS
13 |
14 | if [ "$ACTION" = "install" ]; then
15 | FRAMEWORKS_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}/Frameworks"
16 |
17 | FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORKS_PATH/$MOBILE_COMMERCE_SDK_FRAMEWORK/Info.plist" CFBundleExecutable)
18 | FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORKS_PATH/$MOBILE_COMMERCE_SDK_FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
19 |
20 | # echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"
21 |
22 | EXTRACTED_ARCHS=()
23 |
24 | for ARCH in $ARCHS
25 | do
26 | echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
27 | lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
28 | EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
29 | done
30 |
31 | echo "Merging extracted architectures: ${ARCHS}"
32 | lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"
33 | rm "${EXTRACTED_ARCHS[@]}"
34 |
35 | # echo "Replacing original executable with thinned version"
36 | rm "$FRAMEWORK_EXECUTABLE_PATH"
37 | mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"
38 | fi
39 |
40 | # Don't choke if projects or targets have spaces in the name
41 | IFS=$(echo "")
42 |
43 | # Delete this script if archiving
44 | if [ "$ACTION" = "install" ]; then
45 | rm -- $0
46 | fi
47 |
48 | # Codesign
49 | for filename in "${CODESIGNING_FOLDER_PATH}/Frameworks/$MOBILE_COMMERCE_SDK_FRAMEWORK"; do
50 | codesign --force --sign "${EXPANDED_CODE_SIGN_IDENTITY}" $filename
51 | if [ $? != 0 ]; then
52 | echo "error: Code signing failed."
53 | exit 1
54 | fi
55 | done
56 |
57 | IFS=$OLDIFS
58 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | preset: 'react-native',
3 | moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
4 | };
5 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/metro.config.js:
--------------------------------------------------------------------------------
1 | const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
2 |
3 | /**
4 | * Metro configuration
5 | * https://reactnative.dev/docs/metro
6 | *
7 | * @type {import('metro-config').MetroConfig}
8 | */
9 | const config = {};
10 |
11 | module.exports = mergeConfig(getDefaultConfig(__dirname), config);
12 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-native-in-app-payments-quickstart",
3 | "version": "2.0.0",
4 | "private": true,
5 | "scripts": {
6 | "android": "react-native run-android",
7 | "ios": "react-native run-ios",
8 | "lint": "eslint .",
9 | "start": "react-native start",
10 | "test": "jest"
11 | },
12 | "dependencies": {
13 | "fbjs": "^3.0.4",
14 | "jetifier": "^2.0.0",
15 | "react": "18.2.0",
16 | "react-native": "0.74.1",
17 | "react-native-gesture-handler": "^2.3.2",
18 | "react-native-modal": "^13.0.1",
19 | "react-native-reanimated": "^3.11.0",
20 | "react-native-square-in-app-payments": "file:../",
21 | "react-navigation": "^4.4.4"
22 | },
23 | "devDependencies": {
24 | "@babel/core": "^7.20.0",
25 | "@babel/preset-env": "^7.20.0",
26 | "@babel/runtime": "^7.20.0",
27 | "@react-native/babel-preset": "0.74.83",
28 | "@react-native/eslint-config": "0.74.83",
29 | "@react-native/metro-config": "0.74.83",
30 | "@react-native/typescript-config": "0.74.83",
31 | "@types/react": "^18.2.6",
32 | "@types/react-test-renderer": "^18.0.0",
33 | "babel-jest": "^29.6.3",
34 | "eslint": "^8.19.0",
35 | "eslint-import-resolver-node": "^0.3.9",
36 | "jest": "^29.6.3",
37 | "prettier": "2.8.8",
38 | "react-test-renderer": "18.2.0",
39 | "typescript": "5.0.4"
40 | },
41 | "engines": {
42 | "node": ">=18"
43 | },
44 | "packageManager": "yarn@1.22.22"
45 | }
46 |
--------------------------------------------------------------------------------
/react-native-in-app-payments-quickstart/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "allowJs": true,
4 | "allowSyntheticDefaultImports": true,
5 | "esModuleInterop": true,
6 | "isolatedModules": true,
7 | "jsx": "react",
8 | "lib": [
9 | "ES2019",
10 | "dom"
11 | ],
12 | "module": "commonjs",
13 | "target": "ES2019",
14 | "moduleResolution": "node",
15 | "noEmit": true,
16 | "strict": true,
17 | "skipLibCheck": true,
18 | "types": [
19 | "jest",
20 | "node"
21 | ],
22 | "noImplicitAny": false,
23 | "strictNullChecks": false
24 | },
25 | "include": [
26 | "app/**/*"
27 | ],
28 | "exclude": [
29 | "node_modules",
30 | "babel.config.js",
31 | "metro.config.js",
32 | "jest.config.js"
33 | ]
34 | }
--------------------------------------------------------------------------------
/src/Core.ts:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | import { NativeModules } from 'react-native'; // eslint-disable-line import/no-unresolved
17 | import Utilities from './Utilities';
18 |
19 | const { RNSquareInAppPayments } = NativeModules;
20 |
21 | async function setSquareApplicationId(applicationId:string) {
22 | Utilities.verifyStringType(applicationId, 'applicationId should be a valid string');
23 |
24 | await RNSquareInAppPayments.setApplicationId(applicationId);
25 | }
26 |
27 | export default {
28 | setSquareApplicationId,
29 | };
30 |
--------------------------------------------------------------------------------
/src/ErrorCodes.ts:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2022 Square Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | // error codes are defined below, both iOS and Android *MUST* return same error for these errors:
18 | // Usage error
19 | const UsageError = 'USAGE_ERROR';
20 |
21 | export default {
22 | UsageError,
23 | };
24 |
--------------------------------------------------------------------------------
/src/models/ApplePayConfig.ts:
--------------------------------------------------------------------------------
1 | import PaymentType from './PaymentType';
2 |
3 | interface ApplePayConfig {
4 | price:string;
5 | summaryLabel:string;
6 | countryCode:string;
7 | currencyCode:string;
8 | paymentType?:PaymentType;
9 | }
10 |
11 | export default ApplePayConfig;
12 |
--------------------------------------------------------------------------------
/src/models/Brand.ts:
--------------------------------------------------------------------------------
1 | enum Brand{
2 | OTHER_BRAND,
3 | VISA,
4 | MASTERCARD,
5 | AMERICAN_EXPRESS,
6 | DISCOVER,
7 | DISCOVER_DINERS,
8 | JCB,
9 | CHINA_UNION_PAY,
10 | SQUARE_GIFT_CARD,
11 | }
12 | export default Brand;
13 |
--------------------------------------------------------------------------------
/src/models/BuyerVerificationSuccessCallback.ts:
--------------------------------------------------------------------------------
1 | import VerificationResult from './VerificationResult';
2 |
3 | interface BuyerVerificationSuccessCallback {
4 | (verificationResult:VerificationResult): void;
5 | }
6 |
7 | export default BuyerVerificationSuccessCallback;
8 |
--------------------------------------------------------------------------------
/src/models/CancelAndCompleteCallback.ts:
--------------------------------------------------------------------------------
1 | interface CancelAndCompleteCallback {
2 | (): void;
3 | }
4 |
5 | export default CancelAndCompleteCallback;
6 |
--------------------------------------------------------------------------------
/src/models/Card.ts:
--------------------------------------------------------------------------------
1 | import Brand from './Brand';
2 | import PrepaidType from './PrepaidType';
3 | import Type from './Type';
4 |
5 | interface Card {
6 | brand?: Brand;
7 |
8 | lastFourDigits?: string;
9 |
10 | expirationMonth?: number;
11 |
12 | expirationYear?: number;
13 |
14 | postalCode?: string;
15 |
16 | type?: Type;
17 |
18 | prepaidType?: PrepaidType;
19 | }
20 | export default Card;
21 |
--------------------------------------------------------------------------------
/src/models/CardDetails.ts:
--------------------------------------------------------------------------------
1 | import Card from './Card';
2 |
3 | interface CardDetails {
4 | nonce?:string;
5 |
6 | card?:Card;
7 | }
8 | export default CardDetails;
9 |
--------------------------------------------------------------------------------
/src/models/CardEntryConfig.ts:
--------------------------------------------------------------------------------
1 | interface CardEntryConfig {
2 | collectPostalCode: boolean;
3 |
4 | squareLocationId?: string;
5 |
6 | buyerAction?: string;
7 |
8 | amount?: number;
9 |
10 | currencyCode?: string;
11 |
12 | givenName?: string;
13 |
14 | familyName?: string;
15 |
16 | addressLines?: string;
17 |
18 | city?: string;
19 |
20 | countryCode?: string;
21 |
22 | email?: string;
23 |
24 | phone?: string;
25 |
26 | postalCode?: string;
27 |
28 | region?:string;
29 | }
30 | export default CardEntryConfig;
31 |
--------------------------------------------------------------------------------
/src/models/ColorType.ts:
--------------------------------------------------------------------------------
1 | interface ColorType{
2 | r:number;
3 | g:number;
4 | b:number;
5 | a?:number;
6 | }
7 | export default ColorType;
8 |
--------------------------------------------------------------------------------
/src/models/ErrorDetails.ts:
--------------------------------------------------------------------------------
1 | interface ErrorDetails {
2 | debugMessage: string;
3 |
4 | message: string;
5 |
6 | code?: string;
7 |
8 | debugCode?: string;
9 | }
10 | export default ErrorDetails;
11 |
--------------------------------------------------------------------------------
/src/models/FailureCallback.ts:
--------------------------------------------------------------------------------
1 | import ErrorDetails from './ErrorDetails';
2 |
3 | interface FailureCallback {
4 | (error:ErrorDetails): void;
5 | }
6 |
7 | export default FailureCallback;
8 |
--------------------------------------------------------------------------------
/src/models/FontType.ts:
--------------------------------------------------------------------------------
1 | interface FontType{
2 | size:number;
3 | name?:string;
4 | }
5 | export default FontType;
6 |
--------------------------------------------------------------------------------
/src/models/GooglePayConfig.ts:
--------------------------------------------------------------------------------
1 | import GooglePayPriceStatus from './GooglePayPriceStatus';
2 |
3 | interface GooglePayConfig {
4 | price:string;
5 | currencyCode:string;
6 | priceStatus:GooglePayPriceStatus;
7 | }
8 |
9 | export default GooglePayConfig;
10 |
--------------------------------------------------------------------------------
/src/models/GooglePayPriceStatus.ts:
--------------------------------------------------------------------------------
1 | enum GooglePayPriceStatus{
2 | TotalPriceStatusNotCurrentlyKnown = 1,
3 | TotalPriceStatusEstimated = 2,
4 | TotalPriceStatusFinal = 3,
5 | }
6 |
7 | export default GooglePayPriceStatus;
8 |
--------------------------------------------------------------------------------
/src/models/NonceSuccessCallback.ts:
--------------------------------------------------------------------------------
1 | import CardDetails from './CardDetails';
2 |
3 | interface NonceSuccessCallback {
4 | (cardDetails: CardDetails): void;
5 | }
6 |
7 | export default NonceSuccessCallback;
8 |
--------------------------------------------------------------------------------
/src/models/PaymentType.ts:
--------------------------------------------------------------------------------
1 | enum PaymentType{
2 | PaymentTypePending = 1,
3 | PaymentTypeFinal = 2,
4 | }
5 | export default PaymentType;
6 |
--------------------------------------------------------------------------------
/src/models/PrepaidType.ts:
--------------------------------------------------------------------------------
1 | enum PrepaidType{
2 | UNKNOWN,
3 | NOT_PREPAID,
4 | PREPAID,
5 | }
6 | export default PrepaidType;
7 |
--------------------------------------------------------------------------------
/src/models/ThemeType.ts:
--------------------------------------------------------------------------------
1 | import ColorType from './ColorType';
2 | import FontType from './FontType';
3 |
4 | interface ThemeType{
5 | font?:FontType;
6 | saveButtonFont?:FontType;
7 | backgroundColor?:ColorType;
8 | textColor?:ColorType;
9 | placeholderTextColor?:ColorType;
10 | tintColor?:ColorType;
11 | messageColor?:ColorType;
12 | errorColor?:ColorType;
13 | saveButtonTitle?:string;
14 | saveButtonTextColor?:ColorType;
15 | keyboardAppearance?:string;
16 | cancelButton?:any;
17 | }
18 | export default ThemeType;
19 |
--------------------------------------------------------------------------------
/src/models/Type.ts:
--------------------------------------------------------------------------------
1 | enum Type{
2 | UNKNOWN,
3 | CREDIT,
4 | DEBIT,
5 | }
6 |
7 | export default Type;
8 |
--------------------------------------------------------------------------------
/src/models/VerificationResult.ts:
--------------------------------------------------------------------------------
1 | interface VerificationResult {
2 | nonce?: string;
3 |
4 | token?: string;
5 | }
6 |
7 | export default VerificationResult;
8 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "allowJs": true,
4 | "allowSyntheticDefaultImports": true,
5 | "esModuleInterop": true,
6 | "isolatedModules": true,
7 | "jsx": "react",
8 | "lib": ["ES2019"],
9 | "module": "commonjs",
10 | "target": "ES2019",
11 | "moduleResolution": "node",
12 | "noEmit": true,
13 | "strict": true,
14 | "skipLibCheck": true,
15 | "types": ["jest","node"],
16 | "noImplicitAny": false,
17 | "strictNullChecks": false
18 | },
19 | "include": ["src/**/*"],
20 | "exclude": [
21 | "node_modules",
22 | "babel.config.js",
23 | "metro.config.js",
24 | "jest.config.js"
25 | ]
26 | }
--------------------------------------------------------------------------------