react-native-iap 14.6.3 → 14.6.4
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/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +40 -0
- package/ios/HybridRnIap.swift +11 -3
- package/lib/module/index.js +78 -22
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js +26 -2
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/src/index.d.ts +10 -18
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts +35 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +72 -4
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/nitrogen/generated/android/NitroIapOnLoad.cpp +2 -0
- package/nitrogen/generated/android/c++/JBillingProgramAndroid.hpp +3 -0
- package/nitrogen/generated/android/c++/JDeveloperProvidedBillingDetailsAndroid.hpp +57 -0
- package/nitrogen/generated/android/c++/JFunc_void_DeveloperProvidedBillingDetailsAndroid.hpp +77 -0
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +13 -0
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.hpp +2 -0
- package/nitrogen/generated/android/c++/JInitConnectionConfig.hpp +9 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/BillingProgramAndroid.kt +2 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/DeveloperProvidedBillingDetailsAndroid.kt +36 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Func_void_DeveloperProvidedBillingDetailsAndroid.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/HybridRnIapSpec.kt +18 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/InitConnectionConfig.kt +6 -3
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.cpp +8 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +40 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +3 -0
- package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +18 -3
- package/nitrogen/generated/ios/swift/BillingProgramAndroid.swift +4 -0
- package/nitrogen/generated/ios/swift/DeveloperProvidedBillingDetailsAndroid.swift +35 -0
- package/nitrogen/generated/ios/swift/Func_void_DeveloperProvidedBillingDetailsAndroid.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridRnIapSpec.swift +2 -0
- package/nitrogen/generated/ios/swift/HybridRnIapSpec_cxx.swift +32 -0
- package/nitrogen/generated/ios/swift/InitConnectionConfig.swift +24 -1
- package/nitrogen/generated/shared/c++/BillingProgramAndroid.hpp +4 -0
- package/nitrogen/generated/shared/c++/DeveloperProvidedBillingDetailsAndroid.hpp +75 -0
- package/nitrogen/generated/shared/c++/HybridRnIapSpec.cpp +2 -0
- package/nitrogen/generated/shared/c++/HybridRnIapSpec.hpp +5 -0
- package/nitrogen/generated/shared/c++/InitConnectionConfig.hpp +9 -2
- package/openiap-versions.json +3 -3
- package/package.json +1 -1
- package/src/index.ts +105 -34
- package/src/specs/RnIap.nitro.ts +49 -2
- package/src/types.ts +76 -4
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// DeveloperProvidedBillingDetailsAndroid.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
#include <string>
|
|
29
|
+
|
|
30
|
+
namespace margelo::nitro::iap {
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A struct which can be represented as a JavaScript object (DeveloperProvidedBillingDetailsAndroid).
|
|
34
|
+
*/
|
|
35
|
+
struct DeveloperProvidedBillingDetailsAndroid {
|
|
36
|
+
public:
|
|
37
|
+
std::string externalTransactionToken SWIFT_PRIVATE;
|
|
38
|
+
|
|
39
|
+
public:
|
|
40
|
+
DeveloperProvidedBillingDetailsAndroid() = default;
|
|
41
|
+
explicit DeveloperProvidedBillingDetailsAndroid(std::string externalTransactionToken): externalTransactionToken(externalTransactionToken) {}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
} // namespace margelo::nitro::iap
|
|
45
|
+
|
|
46
|
+
namespace margelo::nitro {
|
|
47
|
+
|
|
48
|
+
// C++ DeveloperProvidedBillingDetailsAndroid <> JS DeveloperProvidedBillingDetailsAndroid (object)
|
|
49
|
+
template <>
|
|
50
|
+
struct JSIConverter<margelo::nitro::iap::DeveloperProvidedBillingDetailsAndroid> final {
|
|
51
|
+
static inline margelo::nitro::iap::DeveloperProvidedBillingDetailsAndroid fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
52
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
53
|
+
return margelo::nitro::iap::DeveloperProvidedBillingDetailsAndroid(
|
|
54
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "externalTransactionToken"))
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::DeveloperProvidedBillingDetailsAndroid& arg) {
|
|
58
|
+
jsi::Object obj(runtime);
|
|
59
|
+
obj.setProperty(runtime, "externalTransactionToken", JSIConverter<std::string>::toJSI(runtime, arg.externalTransactionToken));
|
|
60
|
+
return obj;
|
|
61
|
+
}
|
|
62
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
63
|
+
if (!value.isObject()) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
jsi::Object obj = value.getObject(runtime);
|
|
67
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "externalTransactionToken"))) return false;
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
} // namespace margelo::nitro
|
|
@@ -58,6 +58,8 @@ namespace margelo::nitro::iap {
|
|
|
58
58
|
prototype.registerHybridMethod("createAlternativeBillingTokenAndroid", &HybridRnIapSpec::createAlternativeBillingTokenAndroid);
|
|
59
59
|
prototype.registerHybridMethod("addUserChoiceBillingListenerAndroid", &HybridRnIapSpec::addUserChoiceBillingListenerAndroid);
|
|
60
60
|
prototype.registerHybridMethod("removeUserChoiceBillingListenerAndroid", &HybridRnIapSpec::removeUserChoiceBillingListenerAndroid);
|
|
61
|
+
prototype.registerHybridMethod("addDeveloperProvidedBillingListenerAndroid", &HybridRnIapSpec::addDeveloperProvidedBillingListenerAndroid);
|
|
62
|
+
prototype.registerHybridMethod("removeDeveloperProvidedBillingListenerAndroid", &HybridRnIapSpec::removeDeveloperProvidedBillingListenerAndroid);
|
|
61
63
|
prototype.registerHybridMethod("enableBillingProgramAndroid", &HybridRnIapSpec::enableBillingProgramAndroid);
|
|
62
64
|
prototype.registerHybridMethod("isBillingProgramAvailableAndroid", &HybridRnIapSpec::isBillingProgramAvailableAndroid);
|
|
63
65
|
prototype.registerHybridMethod("createBillingProgramReportingDetailsAndroid", &HybridRnIapSpec::createBillingProgramReportingDetailsAndroid);
|
|
@@ -49,6 +49,8 @@ namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithProviderProps; }
|
|
|
49
49
|
namespace margelo::nitro::iap { struct NitroDeepLinkOptionsAndroid; }
|
|
50
50
|
// Forward declaration of `UserChoiceBillingDetails` to properly resolve imports.
|
|
51
51
|
namespace margelo::nitro::iap { struct UserChoiceBillingDetails; }
|
|
52
|
+
// Forward declaration of `DeveloperProvidedBillingDetailsAndroid` to properly resolve imports.
|
|
53
|
+
namespace margelo::nitro::iap { struct DeveloperProvidedBillingDetailsAndroid; }
|
|
52
54
|
// Forward declaration of `BillingProgramAndroid` to properly resolve imports.
|
|
53
55
|
namespace margelo::nitro::iap { enum class BillingProgramAndroid; }
|
|
54
56
|
// Forward declaration of `NitroBillingProgramAvailabilityResultAndroid` to properly resolve imports.
|
|
@@ -86,6 +88,7 @@ namespace margelo::nitro::iap { struct ExternalPurchaseLinkResultIOS; }
|
|
|
86
88
|
#include "NitroVerifyPurchaseWithProviderProps.hpp"
|
|
87
89
|
#include "NitroDeepLinkOptionsAndroid.hpp"
|
|
88
90
|
#include "UserChoiceBillingDetails.hpp"
|
|
91
|
+
#include "DeveloperProvidedBillingDetailsAndroid.hpp"
|
|
89
92
|
#include "BillingProgramAndroid.hpp"
|
|
90
93
|
#include "NitroBillingProgramAvailabilityResultAndroid.hpp"
|
|
91
94
|
#include "NitroBillingProgramReportingDetailsAndroid.hpp"
|
|
@@ -168,6 +171,8 @@ namespace margelo::nitro::iap {
|
|
|
168
171
|
virtual std::shared_ptr<Promise<std::optional<std::string>>> createAlternativeBillingTokenAndroid(const std::optional<std::string>& sku) = 0;
|
|
169
172
|
virtual void addUserChoiceBillingListenerAndroid(const std::function<void(const UserChoiceBillingDetails& /* details */)>& listener) = 0;
|
|
170
173
|
virtual void removeUserChoiceBillingListenerAndroid(const std::function<void(const UserChoiceBillingDetails& /* details */)>& listener) = 0;
|
|
174
|
+
virtual void addDeveloperProvidedBillingListenerAndroid(const std::function<void(const DeveloperProvidedBillingDetailsAndroid& /* details */)>& listener) = 0;
|
|
175
|
+
virtual void removeDeveloperProvidedBillingListenerAndroid(const std::function<void(const DeveloperProvidedBillingDetailsAndroid& /* details */)>& listener) = 0;
|
|
171
176
|
virtual void enableBillingProgramAndroid(BillingProgramAndroid program) = 0;
|
|
172
177
|
virtual std::shared_ptr<Promise<NitroBillingProgramAvailabilityResultAndroid>> isBillingProgramAvailableAndroid(BillingProgramAndroid program) = 0;
|
|
173
178
|
virtual std::shared_ptr<Promise<NitroBillingProgramReportingDetailsAndroid>> createBillingProgramReportingDetailsAndroid(BillingProgramAndroid program) = 0;
|
|
@@ -25,9 +25,12 @@
|
|
|
25
25
|
|
|
26
26
|
// Forward declaration of `AlternativeBillingModeAndroid` to properly resolve imports.
|
|
27
27
|
namespace margelo::nitro::iap { enum class AlternativeBillingModeAndroid; }
|
|
28
|
+
// Forward declaration of `BillingProgramAndroid` to properly resolve imports.
|
|
29
|
+
namespace margelo::nitro::iap { enum class BillingProgramAndroid; }
|
|
28
30
|
|
|
29
31
|
#include "AlternativeBillingModeAndroid.hpp"
|
|
30
32
|
#include <optional>
|
|
33
|
+
#include "BillingProgramAndroid.hpp"
|
|
31
34
|
|
|
32
35
|
namespace margelo::nitro::iap {
|
|
33
36
|
|
|
@@ -37,10 +40,11 @@ namespace margelo::nitro::iap {
|
|
|
37
40
|
struct InitConnectionConfig {
|
|
38
41
|
public:
|
|
39
42
|
std::optional<AlternativeBillingModeAndroid> alternativeBillingModeAndroid SWIFT_PRIVATE;
|
|
43
|
+
std::optional<BillingProgramAndroid> enableBillingProgramAndroid SWIFT_PRIVATE;
|
|
40
44
|
|
|
41
45
|
public:
|
|
42
46
|
InitConnectionConfig() = default;
|
|
43
|
-
explicit InitConnectionConfig(std::optional<AlternativeBillingModeAndroid> alternativeBillingModeAndroid): alternativeBillingModeAndroid(alternativeBillingModeAndroid) {}
|
|
47
|
+
explicit InitConnectionConfig(std::optional<AlternativeBillingModeAndroid> alternativeBillingModeAndroid, std::optional<BillingProgramAndroid> enableBillingProgramAndroid): alternativeBillingModeAndroid(alternativeBillingModeAndroid), enableBillingProgramAndroid(enableBillingProgramAndroid) {}
|
|
44
48
|
};
|
|
45
49
|
|
|
46
50
|
} // namespace margelo::nitro::iap
|
|
@@ -53,12 +57,14 @@ namespace margelo::nitro {
|
|
|
53
57
|
static inline margelo::nitro::iap::InitConnectionConfig fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
54
58
|
jsi::Object obj = arg.asObject(runtime);
|
|
55
59
|
return margelo::nitro::iap::InitConnectionConfig(
|
|
56
|
-
JSIConverter<std::optional<margelo::nitro::iap::AlternativeBillingModeAndroid>>::fromJSI(runtime, obj.getProperty(runtime, "alternativeBillingModeAndroid"))
|
|
60
|
+
JSIConverter<std::optional<margelo::nitro::iap::AlternativeBillingModeAndroid>>::fromJSI(runtime, obj.getProperty(runtime, "alternativeBillingModeAndroid")),
|
|
61
|
+
JSIConverter<std::optional<margelo::nitro::iap::BillingProgramAndroid>>::fromJSI(runtime, obj.getProperty(runtime, "enableBillingProgramAndroid"))
|
|
57
62
|
);
|
|
58
63
|
}
|
|
59
64
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::InitConnectionConfig& arg) {
|
|
60
65
|
jsi::Object obj(runtime);
|
|
61
66
|
obj.setProperty(runtime, "alternativeBillingModeAndroid", JSIConverter<std::optional<margelo::nitro::iap::AlternativeBillingModeAndroid>>::toJSI(runtime, arg.alternativeBillingModeAndroid));
|
|
67
|
+
obj.setProperty(runtime, "enableBillingProgramAndroid", JSIConverter<std::optional<margelo::nitro::iap::BillingProgramAndroid>>::toJSI(runtime, arg.enableBillingProgramAndroid));
|
|
62
68
|
return obj;
|
|
63
69
|
}
|
|
64
70
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -70,6 +76,7 @@ namespace margelo::nitro {
|
|
|
70
76
|
return false;
|
|
71
77
|
}
|
|
72
78
|
if (!JSIConverter<std::optional<margelo::nitro::iap::AlternativeBillingModeAndroid>>::canConvert(runtime, obj.getProperty(runtime, "alternativeBillingModeAndroid"))) return false;
|
|
79
|
+
if (!JSIConverter<std::optional<margelo::nitro::iap::BillingProgramAndroid>>::canConvert(runtime, obj.getProperty(runtime, "enableBillingProgramAndroid"))) return false;
|
|
73
80
|
return true;
|
|
74
81
|
}
|
|
75
82
|
};
|
package/openiap-versions.json
CHANGED
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -55,6 +55,19 @@ import {RnIapConsole} from './utils/debug';
|
|
|
55
55
|
import {getSuccessFromPurchaseVariant} from './utils/purchase';
|
|
56
56
|
import {parseAppTransactionPayload} from './utils';
|
|
57
57
|
|
|
58
|
+
// ------------------------------
|
|
59
|
+
// Billing Programs API (Android 8.2.0+)
|
|
60
|
+
// ------------------------------
|
|
61
|
+
|
|
62
|
+
// Note: BillingProgramAndroid, ExternalLinkLaunchModeAndroid, and ExternalLinkTypeAndroid
|
|
63
|
+
// are exported from './types' (auto-generated from openiap-gql).
|
|
64
|
+
// Import them here for use in this file's interfaces and functions.
|
|
65
|
+
import type {
|
|
66
|
+
BillingProgramAndroid,
|
|
67
|
+
ExternalLinkLaunchModeAndroid,
|
|
68
|
+
ExternalLinkTypeAndroid,
|
|
69
|
+
} from './types';
|
|
70
|
+
|
|
58
71
|
// Export all types
|
|
59
72
|
export type {
|
|
60
73
|
RnIap,
|
|
@@ -371,6 +384,98 @@ export const userChoiceBillingListenerAndroid = (
|
|
|
371
384
|
};
|
|
372
385
|
};
|
|
373
386
|
|
|
387
|
+
/**
|
|
388
|
+
* Add a listener for developer provided billing events (Android 8.3.0+ only).
|
|
389
|
+
* Fires when a user selects developer billing in the External Payments flow.
|
|
390
|
+
*
|
|
391
|
+
* External Payments is part of Google Play Billing Library 8.3.0+ and allows
|
|
392
|
+
* showing a side-by-side choice between Google Play Billing and developer's
|
|
393
|
+
* external payment option directly in the purchase flow. (Japan only)
|
|
394
|
+
*
|
|
395
|
+
* @param listener - Function to call when user chooses developer billing
|
|
396
|
+
* @returns EventSubscription with remove() method to unsubscribe
|
|
397
|
+
* @platform Android
|
|
398
|
+
* @since Google Play Billing Library 8.3.0+
|
|
399
|
+
*
|
|
400
|
+
* @example
|
|
401
|
+
* ```typescript
|
|
402
|
+
* const subscription = developerProvidedBillingListenerAndroid((details) => {
|
|
403
|
+
* console.log('User chose developer billing');
|
|
404
|
+
* console.log('Token:', details.externalTransactionToken);
|
|
405
|
+
*
|
|
406
|
+
* // Process payment through your external payment system
|
|
407
|
+
* await processExternalPayment();
|
|
408
|
+
*
|
|
409
|
+
* // Report transaction to Google Play (within 24 hours)
|
|
410
|
+
* await reportToGooglePlay(details.externalTransactionToken);
|
|
411
|
+
* });
|
|
412
|
+
*
|
|
413
|
+
* // Later, remove the listener
|
|
414
|
+
* subscription.remove();
|
|
415
|
+
* ```
|
|
416
|
+
*/
|
|
417
|
+
type NitroDeveloperProvidedBillingListener = Parameters<
|
|
418
|
+
RnIap['addDeveloperProvidedBillingListenerAndroid']
|
|
419
|
+
>[0];
|
|
420
|
+
const developerProvidedBillingListenerMap = new WeakMap<
|
|
421
|
+
(details: any) => void,
|
|
422
|
+
NitroDeveloperProvidedBillingListener
|
|
423
|
+
>();
|
|
424
|
+
|
|
425
|
+
export interface DeveloperProvidedBillingDetailsAndroid {
|
|
426
|
+
/**
|
|
427
|
+
* External transaction token used to report transactions made through developer billing.
|
|
428
|
+
* This token must be used when reporting the external transaction to Google Play.
|
|
429
|
+
* Must be reported within 24 hours of the transaction.
|
|
430
|
+
*/
|
|
431
|
+
externalTransactionToken: string;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
export const developerProvidedBillingListenerAndroid = (
|
|
435
|
+
listener: (details: DeveloperProvidedBillingDetailsAndroid) => void,
|
|
436
|
+
): EventSubscription => {
|
|
437
|
+
if (Platform.OS !== 'android') {
|
|
438
|
+
RnIapConsole.warn(
|
|
439
|
+
'developerProvidedBillingListenerAndroid: This listener is only available on Android',
|
|
440
|
+
);
|
|
441
|
+
return {remove: () => {}};
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
const wrappedListener: NitroDeveloperProvidedBillingListener = (details) => {
|
|
445
|
+
listener(details);
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
developerProvidedBillingListenerMap.set(listener, wrappedListener);
|
|
449
|
+
let attached = false;
|
|
450
|
+
try {
|
|
451
|
+
IAP.instance.addDeveloperProvidedBillingListenerAndroid(wrappedListener);
|
|
452
|
+
attached = true;
|
|
453
|
+
} catch (e) {
|
|
454
|
+
const msg = toErrorMessage(e);
|
|
455
|
+
if (msg.includes('Nitro runtime not installed')) {
|
|
456
|
+
RnIapConsole.warn(
|
|
457
|
+
'[developerProvidedBillingListenerAndroid] Nitro not ready yet; listener inert until initConnection()',
|
|
458
|
+
);
|
|
459
|
+
} else {
|
|
460
|
+
throw e;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
return {
|
|
465
|
+
remove: () => {
|
|
466
|
+
const wrapped = developerProvidedBillingListenerMap.get(listener);
|
|
467
|
+
if (wrapped) {
|
|
468
|
+
if (attached) {
|
|
469
|
+
try {
|
|
470
|
+
IAP.instance.removeDeveloperProvidedBillingListenerAndroid(wrapped);
|
|
471
|
+
} catch {}
|
|
472
|
+
}
|
|
473
|
+
developerProvidedBillingListenerMap.delete(listener);
|
|
474
|
+
}
|
|
475
|
+
},
|
|
476
|
+
};
|
|
477
|
+
};
|
|
478
|
+
|
|
374
479
|
// ------------------------------
|
|
375
480
|
// Query API
|
|
376
481
|
// ------------------------------
|
|
@@ -2246,40 +2351,6 @@ export const createAlternativeBillingTokenAndroid: MutationField<
|
|
|
2246
2351
|
}
|
|
2247
2352
|
};
|
|
2248
2353
|
|
|
2249
|
-
// ------------------------------
|
|
2250
|
-
// Billing Programs API (Android 8.2.0+)
|
|
2251
|
-
// ------------------------------
|
|
2252
|
-
|
|
2253
|
-
/**
|
|
2254
|
-
* Billing program type for external content links and external offers.
|
|
2255
|
-
* @platform Android
|
|
2256
|
-
* @since Google Play Billing Library 8.2.0+
|
|
2257
|
-
*/
|
|
2258
|
-
export type BillingProgramAndroid =
|
|
2259
|
-
| 'unspecified'
|
|
2260
|
-
| 'external-content-link'
|
|
2261
|
-
| 'external-offer';
|
|
2262
|
-
|
|
2263
|
-
/**
|
|
2264
|
-
* Launch mode for external link flow.
|
|
2265
|
-
* @platform Android
|
|
2266
|
-
* @since Google Play Billing Library 8.2.0+
|
|
2267
|
-
*/
|
|
2268
|
-
export type ExternalLinkLaunchModeAndroid =
|
|
2269
|
-
| 'unspecified'
|
|
2270
|
-
| 'launch-in-external-browser-or-app'
|
|
2271
|
-
| 'caller-will-launch-link';
|
|
2272
|
-
|
|
2273
|
-
/**
|
|
2274
|
-
* Link type for external link flow.
|
|
2275
|
-
* @platform Android
|
|
2276
|
-
* @since Google Play Billing Library 8.2.0+
|
|
2277
|
-
*/
|
|
2278
|
-
export type ExternalLinkTypeAndroid =
|
|
2279
|
-
| 'unspecified'
|
|
2280
|
-
| 'link-to-digital-content-offer'
|
|
2281
|
-
| 'link-to-app-download';
|
|
2282
|
-
|
|
2283
2354
|
/**
|
|
2284
2355
|
* Parameters for launching an external link (Android 8.2.0+).
|
|
2285
2356
|
*/
|
package/src/specs/RnIap.nitro.ts
CHANGED
|
@@ -45,11 +45,18 @@ export type IapStore = 'unknown' | 'apple' | 'google' | 'horizon';
|
|
|
45
45
|
// Note: Nitro requires at least 2 values for union types
|
|
46
46
|
export type PurchaseVerificationProvider = 'iapkit' | 'none';
|
|
47
47
|
|
|
48
|
-
// Billing Programs API types (Android 8.2.0+)
|
|
48
|
+
// Billing Programs API types (Android 8.2.0+, 8.3.0+ for external-payments)
|
|
49
49
|
export type BillingProgramAndroid =
|
|
50
50
|
| 'unspecified'
|
|
51
51
|
| 'external-content-link'
|
|
52
|
-
| 'external-offer'
|
|
52
|
+
| 'external-offer'
|
|
53
|
+
| 'external-payments';
|
|
54
|
+
|
|
55
|
+
// Developer Billing Launch Mode (Android 8.3.0+)
|
|
56
|
+
export type DeveloperBillingLaunchModeAndroid =
|
|
57
|
+
| 'unspecified'
|
|
58
|
+
| 'launch-in-external-browser-or-app'
|
|
59
|
+
| 'caller-will-launch-link';
|
|
53
60
|
|
|
54
61
|
export type ExternalLinkLaunchModeAndroid =
|
|
55
62
|
| 'unspecified'
|
|
@@ -321,6 +328,19 @@ export interface NitroBillingProgramReportingDetailsAndroid {
|
|
|
321
328
|
externalTransactionToken: string;
|
|
322
329
|
}
|
|
323
330
|
|
|
331
|
+
/**
|
|
332
|
+
* Details provided when user selects developer billing option (Android 8.3.0+)
|
|
333
|
+
* Received via DeveloperProvidedBillingListener callback in External Payments flow
|
|
334
|
+
*/
|
|
335
|
+
export interface DeveloperProvidedBillingDetailsAndroid {
|
|
336
|
+
/**
|
|
337
|
+
* External transaction token used to report transactions made through developer billing.
|
|
338
|
+
* This token must be used when reporting the external transaction to Google Play.
|
|
339
|
+
* Must be reported within 24 hours of the transaction.
|
|
340
|
+
*/
|
|
341
|
+
externalTransactionToken: string;
|
|
342
|
+
}
|
|
343
|
+
|
|
324
344
|
/**
|
|
325
345
|
* Discount amount details for one-time purchase offers (Android)
|
|
326
346
|
*/
|
|
@@ -941,6 +961,33 @@ export interface RnIap extends HybridObject<{ios: 'swift'; android: 'kotlin'}> {
|
|
|
941
961
|
listener: (details: UserChoiceBillingDetails) => void,
|
|
942
962
|
): void;
|
|
943
963
|
|
|
964
|
+
/**
|
|
965
|
+
* Add a listener for developer provided billing events (Android 8.3.0+ only).
|
|
966
|
+
* Fires when a user selects developer billing in the External Payments flow.
|
|
967
|
+
*
|
|
968
|
+
* External Payments is part of Google Play Billing Library 8.3.0+ and allows
|
|
969
|
+
* showing a side-by-side choice between Google Play Billing and developer's
|
|
970
|
+
* external payment option directly in the purchase flow. (Japan only)
|
|
971
|
+
*
|
|
972
|
+
* @param listener - Function to call when user chooses developer billing
|
|
973
|
+
* @platform Android
|
|
974
|
+
* @since Billing Library 8.3.0+
|
|
975
|
+
*/
|
|
976
|
+
addDeveloperProvidedBillingListenerAndroid(
|
|
977
|
+
listener: (details: DeveloperProvidedBillingDetailsAndroid) => void,
|
|
978
|
+
): void;
|
|
979
|
+
|
|
980
|
+
/**
|
|
981
|
+
* Remove a developer provided billing listener (Android only).
|
|
982
|
+
*
|
|
983
|
+
* @param listener - Function to remove from listeners
|
|
984
|
+
* @platform Android
|
|
985
|
+
* @since Billing Library 8.3.0+
|
|
986
|
+
*/
|
|
987
|
+
removeDeveloperProvidedBillingListenerAndroid(
|
|
988
|
+
listener: (details: DeveloperProvidedBillingDetailsAndroid) => void,
|
|
989
|
+
): void;
|
|
990
|
+
|
|
944
991
|
// ╔════════════════════════════════════════════════════════════════════════╗
|
|
945
992
|
// ║ BILLING PROGRAMS API (Android 8.2.0+) ║
|
|
946
993
|
// ╚════════════════════════════════════════════════════════════════════════╝
|
package/src/types.ts
CHANGED
|
@@ -66,10 +66,10 @@ export interface AppTransaction {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
|
-
* Billing program types for external content links and external
|
|
70
|
-
* Available in Google Play Billing Library 8.2.0
|
|
69
|
+
* Billing program types for external content links, external offers, and external payments (Android)
|
|
70
|
+
* Available in Google Play Billing Library 8.2.0+, EXTERNAL_PAYMENTS added in 8.3.0
|
|
71
71
|
*/
|
|
72
|
-
export type BillingProgramAndroid = 'unspecified' | 'external-content-link' | 'external-offer';
|
|
72
|
+
export type BillingProgramAndroid = 'unspecified' | 'external-content-link' | 'external-offer' | 'external-payments';
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
75
|
* Result of checking billing program availability (Android)
|
|
@@ -97,6 +97,16 @@ export interface BillingProgramReportingDetailsAndroid {
|
|
|
97
97
|
externalTransactionToken: string;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Parameters for creating billing program reporting details (Android)
|
|
102
|
+
* Used with createBillingProgramReportingDetailsAsync
|
|
103
|
+
* Available in Google Play Billing Library 8.3.0+
|
|
104
|
+
*/
|
|
105
|
+
export interface BillingProgramReportingDetailsParamsAndroid {
|
|
106
|
+
/** The billing program to create reporting details for */
|
|
107
|
+
billingProgram: BillingProgramAndroid;
|
|
108
|
+
}
|
|
109
|
+
|
|
100
110
|
export interface DeepLinkOptions {
|
|
101
111
|
/** Android package name to target (required on Android) */
|
|
102
112
|
packageNameAndroid?: (string | null);
|
|
@@ -104,6 +114,41 @@ export interface DeepLinkOptions {
|
|
|
104
114
|
skuAndroid?: (string | null);
|
|
105
115
|
}
|
|
106
116
|
|
|
117
|
+
/**
|
|
118
|
+
* Launch mode for developer billing option (Android)
|
|
119
|
+
* Determines how the external payment URL is launched
|
|
120
|
+
* Available in Google Play Billing Library 8.3.0+
|
|
121
|
+
*/
|
|
122
|
+
export type DeveloperBillingLaunchModeAndroid = 'unspecified' | 'launch-in-external-browser-or-app' | 'caller-will-launch-link';
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Parameters for developer billing option in purchase flow (Android)
|
|
126
|
+
* Used with BillingFlowParams to enable external payments flow
|
|
127
|
+
* Available in Google Play Billing Library 8.3.0+
|
|
128
|
+
*/
|
|
129
|
+
export interface DeveloperBillingOptionParamsAndroid {
|
|
130
|
+
/** The billing program (should be EXTERNAL_PAYMENTS for external payments flow) */
|
|
131
|
+
billingProgram: BillingProgramAndroid;
|
|
132
|
+
/** The launch mode for the external payment link */
|
|
133
|
+
launchMode: DeveloperBillingLaunchModeAndroid;
|
|
134
|
+
/** The URI where the external payment will be processed */
|
|
135
|
+
linkUri: string;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Details provided when user selects developer billing option (Android)
|
|
140
|
+
* Received via DeveloperProvidedBillingListener callback
|
|
141
|
+
* Available in Google Play Billing Library 8.3.0+
|
|
142
|
+
*/
|
|
143
|
+
export interface DeveloperProvidedBillingDetailsAndroid {
|
|
144
|
+
/**
|
|
145
|
+
* External transaction token used to report transactions made through developer billing.
|
|
146
|
+
* This token must be used when reporting the external transaction to Google Play.
|
|
147
|
+
* Must be reported within 24 hours of the transaction.
|
|
148
|
+
*/
|
|
149
|
+
externalTransactionToken: string;
|
|
150
|
+
}
|
|
151
|
+
|
|
107
152
|
/**
|
|
108
153
|
* Discount amount details for one-time purchase offers (Android)
|
|
109
154
|
* Available in Google Play Billing Library 7.0+
|
|
@@ -270,7 +315,7 @@ export interface ExternalPurchaseNoticeResultIOS {
|
|
|
270
315
|
|
|
271
316
|
export type FetchProductsResult = ProductOrSubscription[] | Product[] | ProductSubscription[] | null;
|
|
272
317
|
|
|
273
|
-
export type IapEvent = 'purchase-updated' | 'purchase-error' | 'promoted-product-ios' | 'user-choice-billing-android';
|
|
318
|
+
export type IapEvent = 'purchase-updated' | 'purchase-error' | 'promoted-product-ios' | 'user-choice-billing-android' | 'developer-provided-billing-android';
|
|
274
319
|
|
|
275
320
|
export type IapPlatform = 'ios' | 'android';
|
|
276
321
|
|
|
@@ -286,6 +331,12 @@ export interface InitConnectionConfig {
|
|
|
286
331
|
* If not specified, defaults to NONE (standard Google Play billing)
|
|
287
332
|
*/
|
|
288
333
|
alternativeBillingModeAndroid?: (AlternativeBillingModeAndroid | null);
|
|
334
|
+
/**
|
|
335
|
+
* Enable a specific billing program for Android (8.2.0+)
|
|
336
|
+
* When set, enables the specified billing program for external transactions.
|
|
337
|
+
* Use 'external-payments' for Developer Provided Billing (Japan only, 8.3.0+).
|
|
338
|
+
*/
|
|
339
|
+
enableBillingProgramAndroid?: (BillingProgramAndroid | null);
|
|
289
340
|
}
|
|
290
341
|
|
|
291
342
|
/**
|
|
@@ -918,6 +969,12 @@ export interface RentalDetailsAndroid {
|
|
|
918
969
|
}
|
|
919
970
|
|
|
920
971
|
export interface RequestPurchaseAndroidProps {
|
|
972
|
+
/**
|
|
973
|
+
* Developer billing option parameters for external payments flow (8.3.0+).
|
|
974
|
+
* When provided, the purchase flow will show a side-by-side choice between
|
|
975
|
+
* Google Play Billing and the developer's external payment option.
|
|
976
|
+
*/
|
|
977
|
+
developerBillingOption?: (DeveloperBillingOptionParamsAndroid | null);
|
|
921
978
|
/** Personalized offer flag */
|
|
922
979
|
isOfferPersonalized?: (boolean | null);
|
|
923
980
|
/** Obfuscated account ID */
|
|
@@ -986,6 +1043,12 @@ export interface RequestPurchasePropsByPlatforms {
|
|
|
986
1043
|
export type RequestPurchaseResult = Purchase | Purchase[] | null;
|
|
987
1044
|
|
|
988
1045
|
export interface RequestSubscriptionAndroidProps {
|
|
1046
|
+
/**
|
|
1047
|
+
* Developer billing option parameters for external payments flow (8.3.0+).
|
|
1048
|
+
* When provided, the purchase flow will show a side-by-side choice between
|
|
1049
|
+
* Google Play Billing and the developer's external payment option.
|
|
1050
|
+
*/
|
|
1051
|
+
developerBillingOption?: (DeveloperBillingOptionParamsAndroid | null);
|
|
989
1052
|
/** Personalized offer flag */
|
|
990
1053
|
isOfferPersonalized?: (boolean | null);
|
|
991
1054
|
/** Obfuscated account ID */
|
|
@@ -1078,6 +1141,14 @@ export interface RequestVerifyPurchaseWithIapkitResult {
|
|
|
1078
1141
|
}
|
|
1079
1142
|
|
|
1080
1143
|
export interface Subscription {
|
|
1144
|
+
/**
|
|
1145
|
+
* Fires when a user selects developer billing in the External Payments flow (Android only)
|
|
1146
|
+
* Triggered when the user chooses to pay via the developer's external payment option
|
|
1147
|
+
* instead of Google Play Billing in the side-by-side choice dialog.
|
|
1148
|
+
* Contains the externalTransactionToken needed to report the transaction.
|
|
1149
|
+
* Available in Google Play Billing Library 8.3.0+
|
|
1150
|
+
*/
|
|
1151
|
+
developerProvidedBillingAndroid: DeveloperProvidedBillingDetailsAndroid;
|
|
1081
1152
|
/** Fires when the App Store surfaces a promoted product (iOS only) */
|
|
1082
1153
|
promotedProductIOS: string;
|
|
1083
1154
|
/** Fires when a purchase fails or is cancelled */
|
|
@@ -1375,6 +1446,7 @@ export type MutationFieldMap = {
|
|
|
1375
1446
|
|
|
1376
1447
|
// -- Subscription helper types (auto-generated)
|
|
1377
1448
|
export type SubscriptionArgsMap = {
|
|
1449
|
+
developerProvidedBillingAndroid: never;
|
|
1378
1450
|
promotedProductIOS: never;
|
|
1379
1451
|
purchaseError: never;
|
|
1380
1452
|
purchaseUpdated: never;
|