purchaseItem method
Future<GalaxyPurchase?>
purchaseItem(
- String productId,
- String passThroughParam, {
- OperationMode operationMode = OperationMode.test,
override
Implementation
@override
Future<GalaxyPurchase?> purchaseItem(
String productId, String passThroughParam,
{OperationMode operationMode = OperationMode.test}) async {
try {
final purchaseResponse =
await methodChannel.invokeMethod('purchaseItem', {
'productId': productId,
'passThroughParam': passThroughParam,
'operationMode': operationMode.getName()
});
return GalaxyPurchase.fromJson(
jsonDecode(purchaseResponse) as Map<String, dynamic>);
} on PlatformException catch (e) {
throw PlatformException(
code: e.code,
message: 'Error while purchasing item: ${e.message}',
details: e.details,
);
}
}