flutter-plugin icon indicating copy to clipboard operation
flutter-plugin copied to clipboard

Wrong exported ApplePay json: paymentMethod: { ..., type: 1 }

Open oremlawi opened this issue 1 year ago • 4 comments

According to Apple's documentation, The payment method type can be one of the following string values:

"debit" "credit" "prepaid" "store"

While the received json exported by this library returns the type key as an integer type: 1

I had also to correct the exported key called token to be paymentData, but for the type key I couldn't correct it, as the mapping between card types (debit, credit, prepaid, store) and their integer equivalents are not documented anywhere.

But at least I know debit -> 1 (according to the card I was using in my test), any idea about the remaining types?

debit -> 1 credit -> ? prepaid -> ? store -> ?

oremlawi avatar Mar 26 '23 08:03 oremlawi

I also added a credit card, and it returns '2'..

So apparently the mapping is like the following:

debit -> 1 credit -> 2 prepaid -> 3 (not sure) store -> 4 (not sure)

Please @JlUgia, can you confirm.

oremlawi avatar Mar 27 '23 13:03 oremlawi

Hi @oremlawi I'm not sure I follow. What are you referring to when you say the "JSON exported by this library"? I also noted that the link you shared above refers to the Payment Request API integration. Note that, for the time being, this plugin only supports the iOS platform for Apple Pay. The API for the native integration differs from the Web APIs.

JlUgia avatar Aug 02 '23 14:08 JlUgia

Hi @oremlawi I had the same question and this is what I found on PassKit The method type has the following declaration enum PKPaymentMethodType : UInt

image

volodymyr-kam-nrtl avatar Oct 30 '23 18:10 volodymyr-kam-nrtl

Thank you for the reply @volodymyr-kam-nrtl .

This fields are currently only JSON-deserialized before sent back to the Flutter end. Would you find it valuable to use a string-typed key instead?

JlUgia avatar Dec 19 '23 22:12 JlUgia

Feel free to reopen this issue if you have additional feedback.

JlUgia avatar May 09 '24 12:05 JlUgia