Member-only story
How to use Apple pay with Flutter?
4 min readAug 31, 2021
After lots of switching packages, configuring gradles, installing pods to make it work. I am finally happy to see google putting an end to this battle with the introduction of pay library. As the name is, its really simple and straight forward, yet I felt there must be some resource out on the internet to help devs to implement such a feature in short time so that you can focus on developing something really awesome.
I am making it very simple where you can just copy paste bunch of lines below and make it work.
First off all you need the following:
- Apple Pay developer account.
- Mac Device to open Xcode.
- Real iOS device to test apple pay or (you can use the simulator but apple pay token will return null).
- Create Tester account in apple developer account to use testing cards (sandbox tester).
1- Setup Code:
- Install pay package
flutter pub add pay
- add apple pay button in your screen :
import 'package:flutter/material.dart';
import 'package:pay/pay.dart';const _paymentItems = [PaymentItem(label: '<Add Your merchant name or the displayName you added…