Expose properties to load the configuration both from an asset and a JSON string directly from the GooglePayButton widget
The Pay client accepts loading a payment configuration both from an asset stored within the Flutter module, or a JSON string produced at runtime (eg.: loaded from a backend server). This flexibility is not exposed all the way up to the GooglePayButton widget yet.
Include an additional property in the GooglePayButton widget to load the configuration from a JSON string, similar to how the Pay client already offers. Make sure to control for existence of at least one field using assert on the init constructor.
@JlUgia sir do you know how to add paymentConfiguration without using assets? i can not create PaymentConfiguration.
Hi @91priyansh, you can instantiate a payment configuration using a string:
PaymentConfiguration.fromJsonString(configurationJsonString)
You can then use that configuration to call the methods to determine readiness to pay and start the payment process. You can use the high level client in the pay package as a reference.
We may want to consider simplifying the use of JSON strings, exposing the method it all the way to the pay client, adding a wrapping method that takes a list of strings instead of assets.
Use the new 1.1.0 version from the pay package to load your configuration from strings.