freeman-industries / react-native-payments-example-ios

Clone this to try using react-native-payments on iOS.
12 stars 4 forks source link

react-native-payments-example-ios

Clone this to try using react-native-payments on iOS.

Setup

npm install

cd ios
pod install

npm run ios

It works! What now?

Add it to your app!

Check out the full documentation at https://github.com/naoufal/react-native-payments.

Most people add Stripe / Braintree tokenization as a next step.

Stripe

Just add this block to your config object:

const config = [
    {
        supportedMethods: ['apple-pay'],
        data: {
            merchantIdentifier: 'merchant.com.react-native-payments.naoufal',
            supportedNetworks: ['visa', 'mastercard'],
            countryCode: 'US',
            currencyCode: 'USD',
+           paymentMethodTokenizationParameters: {
+               parameters: {
+                   gateway: 'stripe',
+                   'stripe:publishableKey': 'pk_test_asdfghjkl_qwertyuiop'
+               }
+           }
        }
    }
];

Braintree

Just add this block to your config object:

const config = [
    {
        supportedMethods: ['apple-pay'],
        data: {
            merchantIdentifier: 'merchant.com.react-native-payments.naoufal',
            supportedNetworks: ['visa', 'mastercard'],
            countryCode: 'US',
            currencyCode: 'USD',
+           paymentMethodTokenizationParameters: {
+               parameters: {
+                   gateway: 'braintree',
+                   'braintree:tokenizationKey': 'sandbox_asdfghjkl_qwertyuiop'
+               }
+           }
        }
    }
];

Raw Apple Pay Token

If you leave out both of the above, you'll instead get an Apple Pay token.