Jump to content
Lachlan Gemmell

Google Pay and Apple Pay

Recommended Posts

I'm doing some early investigation into the feasibility of an FMX application that can use Google Pay and Apple Pay on their respective platforms. The first stumbling block I've found reading their documentation is that they both require you to use a particular specialised native button provided by their respective payment SDKs.

 

PKPaymentButton for Apple Pay

https://developer.apple.com/documentation/passkit/pkpaymentbutton

 

PayButton API for Google Pay

https://developers.google.com/pay/api/android/guides/resources/pay-button-api

 

FMX has some rudimentary support for native controls so presumably it would be technically possible to make use of these buttons, the question is how much work would be involved. I'm guessing quite a lot but maybe someone here knows more?

Share this post


Link to post
9 hours ago, Lachlan Gemmell said:

I'm guessing quite a lot but maybe someone here knows more?

I've done something similar for the AppleID button, here and here, and I suspect PKPaymentButton will be similar. You'll need an import for PassKit, too.

 

As for the PayButton from Google, you'll need to get the play-services-wallet package (which means obtaining any dependencies not already in the "default" jars in Delphi), then import the relevant classes before creating the same kind of code as for PKPaymentButton, but for the PayButton, for Android, as well as writing the code that uses the PaymentsClient class.

Share this post


Link to post
44 minutes ago, Dave Nottage said:

As for the PayButton from Google, you'll need to get the play-services-wallet package (which means obtaining any dependencies not already in the "default" jars in Delphi), then import the relevant classes

I'm assuming this the process you're referring to.

https://docwiki.embarcadero.com/RADStudio/Athens/en/Using_a_Custom_Set_of_Java_Libraries_In_Your_RAD_Studio_Android_Apps

 

45 minutes ago, Dave Nottage said:

before creating the same kind of code as for PKPaymentButton, but for the PayButton, for Android

OK, so an equivalent to your Apple ID button component in Kastri.

 

47 minutes ago, Dave Nottage said:

as well as writing the code that uses the PaymentsClient class.

Does this mean writing a Delphi wrapper around the Java PaymentsClient class? Can you think of any comparable code in Kastri for this task?

Share this post


Link to post
2 minutes ago, Lachlan Gemmell said:

I'm assuming this the process you're referring to.

Yes

2 minutes ago, Lachlan Gemmell said:

OK, so an equivalent to your Apple ID button component in Kastri.

Judging by the documentation for Wallet and PayButton, I expect it will be a bit more involved, but yes.

3 minutes ago, Lachlan Gemmell said:

Does this mean writing a Delphi wrapper around the Java PaymentsClient class?

If by "wrapper" you mean "Delphi code that uses PaymentsClient", then yes 🙂

10 minutes ago, Lachlan Gemmell said:

Can you think of any comparable code in Kastri for this task?

Perhaps the GoogleSignIn feature might come closest, however they're all fairly diverse (check units that end with .Android.pas in the subfolders of the Features folder). I expect using PaymentsClient (and the Wallet class) may be more complex than the others.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×