naoufal / react-native-payments

Accept Payments with Apple Pay and Android Pay using the Payment Request API.
https://www.npmjs.com/package/react-native-payments
1.58k stars 410 forks source link

👉 Stripe React Native Official SDK 👉 #335

Open nabilfreeman opened 2 years ago

nabilfreeman commented 2 years ago

Hi everybody!

I've been trying to keep RN Payments alive over the last couple of years as there wasn't any stable payment solution for React Native apart from one other, Tipsi's library.

Now I've seen that Stripe has an official React Native SDK:

https://github.com/stripe/stripe-react-native

This library supports Expo Go.

Considering that iOS Apple Pay is the only truly stable part of this library, I would recommend everybody starts using the official library.

For Android devs, that means you will probably have a much better Google Pay experience.

I understand that for other merchants like Braintree, Adyen, Payfort, etc. this isn't the ideal solution but Stripe simply has the best SDK as it stands today.

If you would like to join as a maintainer for these other payment gateways I think this library could live on - drop a comment here if you are serious about maintaining and I will ask Naoufal.

dvicory commented 2 years ago

We've turned to this library because we want to use a totally different processor. Not Stripe, Braintree, etc. I'm not sure if I'm allowed to say our processor, but they're uncommon for small/medium businesses to use directly and do not have their own RN library.

We want to get the payment token directly which only our processor can decrypt - they will tokenize for us and we can use the token to initiate payments on our server as required.

From what I can tell, this library is the only one that can provide the payment token as part of the API to be used with other processors (if the Stripe library or others can, please let me know!).

We've already begun making some changes for Apple Pay and are planning to contribute them back. If the future of this library is uncertain, and we cannot find another library that allows for direct use of payment tokens and other processors, then we would be interested in becoming a maintainer.

Unfortunately, in that scenario, we wouldn't have the resources in making further improvements to Stripe/Braintree here as we don't use them, but could absolutely improve the experience for users who need a payments library and do not mind providing the connection to their processor of choice.

dvicory commented 2 years ago

As an update to my last comment, we're making continuous improvements to our company's fork. We would still be interested in contributing these back if we had contributor roles here. If we don't, we would continue to maintain our fork.

As a summary of things we've done so far:

We hope to either add TypeScript definitions or convert the library to TS in the future as well. We do not yet need Google Pay functionality but if our feature using Apple Pay goes well, attention to Google Pay would likely be next.

nabilfreeman commented 2 years ago

Hi @dvicory ! This sounds great and having you on board as a contributor would be really ideal. I'm glad you have a use case for this library.

You should have a chat with @naoufal who is the admin on the project and open to maintainers. I will try and set it up and have added you on LinkedIn for DMs.

In the meantime you are welcome to open PRs here 😁

AhmedHashem2105 commented 3 weeks ago

Hello there is an issue with other PKPaymentNetwork like mada and some more you wrote the code as the following

// https://developer.apple.com/documentation/passkit/pkpaymentnetwork?language=objc
export enum IosPKPaymentNetworksEnum {
    PKPaymentNetworkAmex = 'PKPaymentNetworkAmex',
    PKPaymentNetworkBancomat = 'PKPaymentNetworkBancomat',
    PKPaymentNetworkBancontact = 'PKPaymentNetworkBancontact',
    PKPaymentNetworkBarcode = 'PKPaymentNetworkBarcode',
    PKPaymentNetworkCartesBancaires = 'PKPaymentNetworkCartesBancaires',
    PKPaymentNetworkChinaUnionPay = 'PKPaymentNetworkChinaUnionPay',
    PKPaymentNetworkDankort = 'PKPaymentNetworkDankort',
    PKPaymentNetworkDiscover = 'PKPaymentNetworkDiscover',
    PKPaymentNetworkEftpos = 'PKPaymentNetworkEftpos',
    PKPaymentNetworkElectron = 'PKPaymentNetworkElectron',
    PKPaymentNetworkElo = 'PKPaymentNetworkElo',
    PKPaymentNetworkGirocard = 'PKPaymentNetworkGirocard',
    PKPaymentNetworkIDCredit = 'PKPaymentNetworkIDCredit',
    PKPaymentNetworkInterac = 'PKPaymentNetworkInterac',
    PKPaymentNetworkJCB = 'PKPaymentNetworkJCB',
    PKPaymentNetworkMada = 'PKPaymentNetworkMada',
    PKPaymentNetworkMaestro = 'PKPaymentNetworkMaestro',
    PKPaymentNetworkMasterCard = 'PKPaymentNetworkMasterCard',
    PKPaymentNetworkMir = 'PKPaymentNetworkMir',
    PKPaymentNetworkNanaco = 'PKPaymentNetworkNanaco',
    PKPaymentNetworkPostFinance = 'PKPaymentNetworkPostFinance',
    PKPaymentNetworkPrivateLabel = 'PKPaymentNetworkPrivateLabel',
    PKPaymentNetworkQuicPay = 'PKPaymentNetworkQuicPay',
    PKPaymentNetworkSuica = 'PKPaymentNetworkSuica',
    PKPaymentNetworkVPay = 'PKPaymentNetworkVPay',
    PKPaymentNetworkVisa = 'PKPaymentNetworkVisa',
    PKPaymentNetworkWaon = 'PKPaymentNetworkWaon',
}```
```        // TODO: Add mappings for other systems if needed
        const supportedNetworkMap: Record<SupportedNetworkEnum, IosPKPaymentNetworksEnum> = {
            [SupportedNetworkEnum.Amex]: IosPKPaymentNetworksEnum.PKPaymentNetworkAmex,
            [SupportedNetworkEnum.Mastercard]: IosPKPaymentNetworksEnum.PKPaymentNetworkMasterCard,
            [SupportedNetworkEnum.Visa]: IosPKPaymentNetworksEnum.PKPaymentNetworkVisa,
            [SupportedNetworkEnum.Discover]: IosPKPaymentNetworksEnum.PKPaymentNetworkDiscover,
            [SupportedNetworkEnum.Bancontact]: IosPKPaymentNetworksEnum.PKPaymentNetworkAmex,
            [SupportedNetworkEnum.CartesBancaires]: IosPKPaymentNetworksEnum.PKPaymentNetworkAmex,
            [SupportedNetworkEnum.ChinaUnionPay]: IosPKPaymentNetworksEnum.PKPaymentNetworkAmex,
            [SupportedNetworkEnum.Dankort]: IosPKPaymentNetworksEnum.PKPaymentNetworkAmex,
            [SupportedNetworkEnum.Eftpos]: IosPKPaymentNetworksEnum.PKPaymentNetworkAmex,
            [SupportedNetworkEnum.Electron]: IosPKPaymentNetworksEnum.PKPaymentNetworkAmex,
            [SupportedNetworkEnum.Elo]: IosPKPaymentNetworksEnum.PKPaymentNetworkAmex,
            [SupportedNetworkEnum.Girocard]: IosPKPaymentNetworksEnum.PKPaymentNetworkAmex,
            [SupportedNetworkEnum.Interac]: IosPKPaymentNetworksEnum.PKPaymentNetworkAmex,
            [SupportedNetworkEnum.Jcb]: IosPKPaymentNetworksEnum.PKPaymentNetworkAmex,
            [SupportedNetworkEnum.Mada]: IosPKPaymentNetworksEnum.PKPaymentNetworkMada,
            [SupportedNetworkEnum.Maestro]: IosPKPaymentNetworksEnum.PKPaymentNetworkAmex,
            [SupportedNetworkEnum.Mir]: IosPKPaymentNetworksEnum.PKPaymentNetworkAmex,
            [SupportedNetworkEnum.PrivateLabel]: IosPKPaymentNetworksEnum.PKPaymentNetworkAmex,
            [SupportedNetworkEnum.Vpay]: IosPKPaymentNetworksEnum.PKPaymentNetworkAmex,
        };

All of them are Amex, i fixed Mada but it says Invalid PKPaymentNetworkMada