react-native-tpay 1.3.19 → 1.3.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +89 -64
- package/ios/Source/Configuration/MerchantConfiguration.swift +1 -1
- package/ios/Source/Configuration/TransactionConfiguration.swift +13 -4
- package/ios/Source/Model/Transportation/Transportation+PayerContext+AutomaticPaymentMethods+BlikAlias.swift +2 -0
- package/ios/Source/TpayVersion.generated.swift +1 -1
- package/package.json +1 -1
- package/react-native-tpay.podspec +1 -1
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ Documentation is available [here](https://tpay-com.github.io/tpay-react-native/)
|
|
|
11
11
|
|
|
12
12
|
| Library | Version |
|
|
13
13
|
| ------------------- | ----------------------------- |
|
|
14
|
-
| npm | 1.3.
|
|
14
|
+
| npm | 1.3.21 |
|
|
15
15
|
| Minimum Android SDK | 23 (Android 6.0, Marshmallow) |
|
|
16
16
|
| Minimum iOS version | 12.0 |
|
|
17
17
|
|
|
@@ -112,28 +112,37 @@ new CertificatePinningConfiguration('ssl_pinning')
|
|
|
112
112
|
|
|
113
113
|
In order to be able to use Google Pay method you have to provide your `merchant_id` to the SDK.
|
|
114
114
|
|
|
115
|
-
> [!tip]
|
|
116
|
-
> Your login name to the merchant panel is your merchant id.
|
|
117
|
-
|
|
118
115
|
```typescript
|
|
119
116
|
new WalletConfiguration(
|
|
120
117
|
new GooglePayConfiguration('merchant_id'),
|
|
121
118
|
)
|
|
122
119
|
```
|
|
123
120
|
|
|
121
|
+
`merchant_id` is unique identifier assigned to you during Tpay account registration.
|
|
122
|
+
|
|
124
123
|
#### Apple Pay configuration
|
|
125
124
|
|
|
126
125
|
In order to be able to use Apple Pay method you have to provide your `merchant_id` and `country_code` to the SDK.
|
|
127
126
|
|
|
127
|
+
> [!warning]
|
|
128
|
+
> - Apple Pay is available exclusively on Apple devices (iPhone, iPad, MacBook, iMac). Payments cannot be made on non-Apple operating systems such as Android or Windows.
|
|
129
|
+
> - Apple Pay supports only **Visa** and **Mastercard**.
|
|
130
|
+
|
|
128
131
|
> [!important]
|
|
129
|
-
>
|
|
132
|
+
> Before using Apple Pay, make sure the following prerequisites are met:
|
|
133
|
+
> - Card payments are enabled in your merchant account.
|
|
134
|
+
> - Apple Pay payment channel is activated in your merchant panel.
|
|
135
|
+
|
|
136
|
+
> [!important]
|
|
137
|
+
> To set up Apple Pay, you need an Apple Developer account. Follow these steps:
|
|
130
138
|
> 1. Log in to your Apple Developer account.
|
|
131
139
|
> 2. Navigate to the `Certificates, Identifiers & Profiles` section.
|
|
132
140
|
> 3. Under `Identifiers,` select `Merchant IDs.`
|
|
133
141
|
> 4. Click the `+` button to create a new Merchant ID.
|
|
134
142
|
> 5. Fill in the required information and associate it with your app's Bundle ID.
|
|
135
|
-
> 6.
|
|
136
|
-
> 7.
|
|
143
|
+
> 6. Set up a **Payment Processing Certificate** for the Merchant ID.
|
|
144
|
+
> 7. Once created, the merchant identifier can be found in the list of Merchant IDs.
|
|
145
|
+
> 8. For more details, please follow [Apple Pay documentation](https://developer.apple.com/documentation/passkit/apple_pay/setting_up_apple_pay).
|
|
137
146
|
|
|
138
147
|
```typescript
|
|
139
148
|
new WalletConfiguration(
|
|
@@ -413,6 +422,57 @@ new AutomaticPaymentMethods(
|
|
|
413
422
|
);
|
|
414
423
|
```
|
|
415
424
|
|
|
425
|
+
#### Google Pay on-site configuration
|
|
426
|
+
|
|
427
|
+
Google Pay on-site is an integration of Google Pay payments that allows customers to pay directly from your mobile application.
|
|
428
|
+
|
|
429
|
+
Google Pay on-site can be integrated in the following scenarios:
|
|
430
|
+
|
|
431
|
+
- Android application (native) - Google Pay is launched directly in a native Android mobile application, where the integration is implemented using the Google Pay API for Android.
|
|
432
|
+
|
|
433
|
+
> [!warning]
|
|
434
|
+
> - The Google Pay on-site method is currently available only for the Pekao acquiring agent. Check whether your card payments are processed through this acquiring agent.
|
|
435
|
+
> - Google Pay supports only **Visa** and **Mastercard**.
|
|
436
|
+
|
|
437
|
+
> [!important]
|
|
438
|
+
> Before using Google Pay, make sure the following prerequisites are met:
|
|
439
|
+
> - Card payments are enabled in your merchant account.
|
|
440
|
+
> - Google Pay payment channel is activated in your merchant panel.
|
|
441
|
+
|
|
442
|
+
##### Android application (native)
|
|
443
|
+
|
|
444
|
+
###### Development phase
|
|
445
|
+
|
|
446
|
+
In order to be able to use Google Pay method you have to:
|
|
447
|
+
|
|
448
|
+
- add `DigitalWallet.googlePay` to a supported payment list
|
|
449
|
+
- provide your `merchant_id` to the SDK as follows
|
|
450
|
+
|
|
451
|
+
```typescript
|
|
452
|
+
new WalletConfiguration(
|
|
453
|
+
new GooglePayConfiguration('merchant_id'),
|
|
454
|
+
)
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
`merchant_id` is unique identifier assigned to you during Tpay account registration.
|
|
458
|
+
|
|
459
|
+
###### Production readiness
|
|
460
|
+
|
|
461
|
+
To correctly launch Google Pay in an Android application, the application should:
|
|
462
|
+
|
|
463
|
+
- be signed with the application certificate (SHA-256),
|
|
464
|
+
- be submitted and configured in the Google Pay & Wallet Console,
|
|
465
|
+
- have a correctly configured package name consistent with the application data registered in Google.
|
|
466
|
+
|
|
467
|
+
Application requirements and environment configuration are described in Google's documentation:
|
|
468
|
+
|
|
469
|
+
- [App prerequisites (minSdk, distribution via Google Play)](https://developers.google.com/pay/api/android/guides/setup)
|
|
470
|
+
- [Application integration approval and publishing process](https://developers.google.com/pay/api/android/guides/test-and-deploy/publish-your-integration)
|
|
471
|
+
|
|
472
|
+
Google provides a checklist of functional and branding requirements that must be met before publishing the integration:
|
|
473
|
+
|
|
474
|
+
[Integration checklist](https://developers.google.com/pay/api/android/guides/test-and-deploy/integration-checklist)
|
|
475
|
+
|
|
416
476
|
## Tokenization
|
|
417
477
|
|
|
418
478
|
Tpay SDK allows you to make credit card transactions without need of entering card's data each time.
|
|
@@ -772,16 +832,12 @@ handleScreenlessResult(screenlessResult);
|
|
|
772
832
|
|
|
773
833
|
#### BLIK Alias Payment
|
|
774
834
|
|
|
775
|
-
If you have
|
|
776
|
-
smoother,
|
|
835
|
+
If you have returning users and you want to make their BLIK payments even smoother,
|
|
777
836
|
you can register BLIK Alias for them, so they will only be prompted to accept payment in their
|
|
778
|
-
banking app,
|
|
779
|
-
without need of entering BLIK code each time they want to make the payment.
|
|
837
|
+
banking app, without need of entering BLIK code each time they want to make the payment.
|
|
780
838
|
|
|
781
839
|
> [!warning]
|
|
782
840
|
> In order to register alias for a user/payment, you have to set `isRegistered` parameter to `false`.
|
|
783
|
-
> Then, a successful payment will register the alias in Tpay system
|
|
784
|
-
> and next time user will be able to use it.
|
|
785
841
|
|
|
786
842
|
```typescript
|
|
787
843
|
const blikPayment = new BlikPayment(
|
|
@@ -791,23 +847,25 @@ const blikPayment = new BlikPayment(
|
|
|
791
847
|
);
|
|
792
848
|
```
|
|
793
849
|
|
|
794
|
-
|
|
795
|
-
payments.
|
|
796
|
-
|
|
797
|
-
> [!warning]
|
|
798
|
-
> If you already have registered alias for a user, you can set up `isRegistered` parameter to `true`.
|
|
850
|
+
> [!important]
|
|
851
|
+
> Provided alias cannot be assumed as registered until receiving webhook notification about its status. Notification should be received by dedicated backend server, for implementation details check official [documentation](https://docs-api.tpay.com/en/webhooks/) . Additionally your backend server should implement other BLIK related [notifications](https://docs-api.tpay.com/en/webhooks/#blik-one-clickblik-recurring-payments-after-expiration-update-or-delete-alias) to ensure BLIK alias is valid and usable.
|
|
799
852
|
|
|
800
|
-
|
|
801
|
-
> To be able to pay with BLIK alias, you **MUST** set the code parameter to `null`.
|
|
853
|
+
Once alias is registered for a user, you can set up `isRegistered` parameter to `true`.
|
|
802
854
|
|
|
803
855
|
```typescript
|
|
804
856
|
const blikPayment = new BlikPayment(
|
|
805
857
|
null,
|
|
806
|
-
new BlikAlias(
|
|
858
|
+
new BlikAlias(true, '1234', 'label_1234'),
|
|
807
859
|
// rest of the BLIKPayment configuration
|
|
808
860
|
);
|
|
809
861
|
```
|
|
810
862
|
|
|
863
|
+
> [!warning]
|
|
864
|
+
> To be able to pay with BLIK alias, you **MUST** set the code parameter to `null`.
|
|
865
|
+
|
|
866
|
+
> [!warning]
|
|
867
|
+
> Before testing BLIK alias functionality check sandbox environment limitations listed in [documentation](https://docs-api.tpay.com/en/first-steps/environments/#blik-payments)
|
|
868
|
+
|
|
811
869
|
#### BLIK Ambiguous Alias Payment
|
|
812
870
|
|
|
813
871
|
Sometimes, there is a possibility for one alias to be registered more than once. For example, if
|
|
@@ -963,47 +1021,6 @@ async function startScreenlessPayPoPayment() {
|
|
|
963
1021
|
> If PayPoPayment returns `ScreenlessPaymentCreated` result, you have to handle `paymentUrl`
|
|
964
1022
|
> sent with it and redirect user to it in order to complete the payment.
|
|
965
1023
|
|
|
966
|
-
## Screenless Google Pay payment (Android only)
|
|
967
|
-
|
|
968
|
-
Google Pay payment requires a Google Pay token.
|
|
969
|
-
|
|
970
|
-
```typescript
|
|
971
|
-
const transaction = new PayPoPayment(
|
|
972
|
-
new PaymentDetails(
|
|
973
|
-
71.15,
|
|
974
|
-
'transaction description',
|
|
975
|
-
'hidden description',
|
|
976
|
-
Language.pl,
|
|
977
|
-
),
|
|
978
|
-
new Payer(
|
|
979
|
-
'John Doe',
|
|
980
|
-
'john.doe@example.com',
|
|
981
|
-
'123456789',
|
|
982
|
-
new Address(
|
|
983
|
-
'Test Street1',
|
|
984
|
-
'Warsaw',
|
|
985
|
-
'PL',
|
|
986
|
-
'00-007',
|
|
987
|
-
),
|
|
988
|
-
),
|
|
989
|
-
new Callbacks(
|
|
990
|
-
new Redirects('https://success.url', 'https://error.url'),
|
|
991
|
-
new Notifications(
|
|
992
|
-
'https://yourdomain.com/notifications',
|
|
993
|
-
'email@address',
|
|
994
|
-
),
|
|
995
|
-
),
|
|
996
|
-
);
|
|
997
|
-
|
|
998
|
-
const screenlessResult = await screenlessPayPoPayment(transaction);
|
|
999
|
-
|
|
1000
|
-
handleScreenlessResult(screenlessResult);
|
|
1001
|
-
```
|
|
1002
|
-
|
|
1003
|
-
> [!warning]
|
|
1004
|
-
> If PayPoPayment returns `ScreenlessPaymentCreated` result, you have to handle `paymentUrl`
|
|
1005
|
-
> sent with it and redirect user to it in order to complete the payment.
|
|
1006
|
-
|
|
1007
1024
|
### Screenless Google Pay Payment (Android only)
|
|
1008
1025
|
|
|
1009
1026
|
Tpay SDK allows you to perform Google Pay transactions.
|
|
@@ -1113,14 +1130,22 @@ else if (googlePayResult instanceof GooglePayOpenUnknownError) {
|
|
|
1113
1130
|
> If `googlePayResult` returns `GooglePayOpenSuccess`, you **HAVE TO** use it's content to make an actual
|
|
1114
1131
|
> payment buy using `GooglePayPayment` and `screenlessGooglePayPayment`.
|
|
1115
1132
|
|
|
1133
|
+
`merchant_id` is unique identifier assigned to you during Tpay account registration.
|
|
1134
|
+
|
|
1135
|
+
> [!warning]
|
|
1136
|
+
> In order to launch Google Pay on production follow [these guidelines](#production-readiness).
|
|
1137
|
+
|
|
1116
1138
|
### Screenless Apple Pay payment
|
|
1117
1139
|
|
|
1118
1140
|
Tpay SDK allows you to perform Apple Pay transactions.
|
|
1119
1141
|
|
|
1142
|
+
> [!warning]
|
|
1143
|
+
> Apple Pay is available exclusively on Apple devices (iPhone, iPad, MacBook, iMac) and supports only **Visa** and **Mastercard**.
|
|
1144
|
+
|
|
1120
1145
|
> [!warning]
|
|
1121
1146
|
> To be able to complete Apple Pay payment, you will need `apple_pay_token`. You **HAVE TO**
|
|
1122
|
-
> acquire a token by yourself. To do that check
|
|
1123
|
-
> official [Apple Pay documentation](https://developer.apple.com/
|
|
1147
|
+
> acquire a token by yourself using Apple's PassKit framework. To do that check
|
|
1148
|
+
> official [Apple Pay documentation](https://developer.apple.com/documentation/passkit/apple_pay/setting_up_apple_pay)
|
|
1124
1149
|
|
|
1125
1150
|
```typescript
|
|
1126
1151
|
const applePayPayment = new ApplePayPayment(
|
|
@@ -104,7 +104,7 @@ final class MerchantConfiguration {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
private func makeBlikConfiguration(from blikAliasToRegister: String?) -> Merchant.BlikConfiguration? {
|
|
107
|
-
guard let blikAliasToRegister = blikAliasToRegister else { return nil }
|
|
107
|
+
guard let blikAliasToRegister = blikAliasToRegister, !blikAliasToRegister.isEmpty else { return nil }
|
|
108
108
|
|
|
109
109
|
return .init(aliasToBeRegistered: .init(value: .uid(blikAliasToRegister)))
|
|
110
110
|
}
|
|
@@ -182,11 +182,19 @@ final class TransactionConfiguration {
|
|
|
182
182
|
guard let payerContext = singleTransaction.payerContext else { return nil }
|
|
183
183
|
|
|
184
184
|
let payer = makePayer(from: payerContext.payer)
|
|
185
|
-
let blikAllias = payerContext.automaticPaymentMethods?.blikAlias?.value
|
|
186
|
-
let registredBlikAlias = blikAllias != nil ? RegisteredBlikAlias(value: .uid(blikAllias!)) : nil
|
|
187
185
|
let tokenizedCards = payerContext.automaticPaymentMethods?.tokenizedCards?.compactMap { makeCardToken(from: $0) }
|
|
188
186
|
|
|
189
|
-
|
|
187
|
+
let blikAlias = payerContext.automaticPaymentMethods?.blikAlias
|
|
188
|
+
let registeredBlikAlias: RegisteredBlikAlias? = blikAlias.flatMap { alias in
|
|
189
|
+
guard alias.isRegistered else { return nil }
|
|
190
|
+
return RegisteredBlikAlias(value: .uid(alias.value))
|
|
191
|
+
}
|
|
192
|
+
let notRegisteredBlikAlias: NotRegisteredBlikAlias? = blikAlias.flatMap { alias in
|
|
193
|
+
guard !alias.isRegistered else { return nil }
|
|
194
|
+
return NotRegisteredBlikAlias(value: .uid(alias.value))
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return .init(payer: payer, automaticPaymentMethods: .init(registeredBlikAlias: registeredBlikAlias, notRegisteredBlikAlias: notRegisteredBlikAlias, tokenizedCards: tokenizedCards))
|
|
190
198
|
}
|
|
191
199
|
|
|
192
200
|
private static func makeTokenPayerContext(from tokenPayment: T.TokenPayment) -> PayerContext {
|
|
@@ -205,7 +213,8 @@ final class TransactionConfiguration {
|
|
|
205
213
|
}
|
|
206
214
|
|
|
207
215
|
private static func makeAddress(from contextAddress: T.Payer.Address?) -> Address? {
|
|
208
|
-
guard let contextAddress = contextAddress
|
|
216
|
+
guard let contextAddress = contextAddress,
|
|
217
|
+
contextAddress.address != nil else { return nil }
|
|
209
218
|
|
|
210
219
|
return .init(address: contextAddress.address,
|
|
211
220
|
city: contextAddress.city,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Auto-generated from package.json — do not edit manually.
|
|
2
|
-
let reactNativeTpayVersion: String = "1.3.
|
|
2
|
+
let reactNativeTpayVersion: String = "1.3.21"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-tpay",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.21",
|
|
4
4
|
"description": "The Tpay SDK empowers your app to seamlessly integrate Tpay’s payment functionalities, providing a comprehensive and developer-friendly solution for managing payments.",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|