I have an e-commerce app, built in Flutter, and in order to simplify the checkout flow, I need to skip selecting shipping address and allow user to use Apple / Google pay shipping or billing address.
So is there anyway to get those addresses from system wallet and show them in the app as a prefilled delivery address options?
Or maybe there is a way to integrate the customer address book with Apple / Google payment addresses.
I'm using this library.
After some searches, while references about that in Flutter are too limited, the only way I found to get the billing or shipping address from Apple/Google Pay in Flutter is through forcing shipping/billing address in the configuration file, then after the payment being set, Pay library generates Apple Pay Token with new json key called shippingContact
and billingAddress
for Google Pay Token. (Keep in mind that in Android the address is not visible during the payment).
Now, to benefit from that feature, you can adjust your app's UX/UI (where you need to ask user to enter their shipping address) to use Apple/Google shipping address rather than asking them to fill an address form and selecting their location and so on..
Now for Apple, you can review the Apple shipping address when the native payment popup shows up. And before placing the payment, then either you pay directly or change the address and then pay (which is so flexible).
But for Google, I don't know why they don't show the address in the native payment popup for reviewing at least before proceeding, because the stored billing address in Google could be old or no longer exist.
So in summary, getting that address is only readable after placing the payment, not before it.