<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: arif chaudhary</title>
    <description>The latest articles on DEV Community by arif chaudhary (@arif_chaudhary_94777248d1).</description>
    <link>https://dev.to/arif_chaudhary_94777248d1</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2054484%2F9964308a-790b-4f86-80ac-b179951c3488.jpg</url>
      <title>DEV Community: arif chaudhary</title>
      <link>https://dev.to/arif_chaudhary_94777248d1</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/arif_chaudhary_94777248d1"/>
    <language>en</language>
    <item>
      <title>🍏 Integrating Apple Pay with Stripe in a React Native CLI Project (iOS)</title>
      <dc:creator>arif chaudhary</dc:creator>
      <pubDate>Wed, 21 May 2025 16:55:22 +0000</pubDate>
      <link>https://dev.to/arif_chaudhary_94777248d1/integrating-apple-pay-with-stripe-in-a-react-native-cli-project-ios-48pd</link>
      <guid>https://dev.to/arif_chaudhary_94777248d1/integrating-apple-pay-with-stripe-in-a-react-native-cli-project-ios-48pd</guid>
      <description>&lt;p&gt;Integrating &lt;strong&gt;Apple Pay&lt;/strong&gt; with &lt;strong&gt;Stripe&lt;/strong&gt; in a &lt;strong&gt;React Native CLI&lt;/strong&gt; project involves configuring your Apple Developer account, setting up Stripe, installing dependencies, and implementing the payment flow.&lt;/p&gt;

&lt;p&gt;This guide uses the &lt;a href="https://github.com/stripe/stripe-react-native" rel="noopener noreferrer"&gt;&lt;code&gt;@stripe/stripe-react-native&lt;/code&gt;&lt;/a&gt; SDK and is &lt;strong&gt;iOS-focused&lt;/strong&gt;, as Apple Pay is available only on Apple devices.&lt;/p&gt;




&lt;h2&gt;
  
  
  ✅ Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before starting, ensure you have the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;React Native CLI&lt;/strong&gt; project (not Expo).&lt;/li&gt;
&lt;li&gt;A valid &lt;strong&gt;Apple Developer Program&lt;/strong&gt; account.&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;Stripe&lt;/strong&gt; account (test keys available).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Xcode&lt;/strong&gt; installed on macOS.&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;physical iOS device&lt;/strong&gt; (real Apple Pay testing).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Node.js&lt;/strong&gt;, &lt;strong&gt;npm&lt;/strong&gt; or &lt;strong&gt;yarn&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;A code editor like &lt;strong&gt;VS Code&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🔧 Step-by-Step Integration
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: Set Up Apple Developer Account for Apple Pay
&lt;/h3&gt;

&lt;h4&gt;
  
  
  1. Enroll in the Apple Developer Program
&lt;/h4&gt;

&lt;p&gt;You must be enrolled in the &lt;a href="https://developer.apple.com/programs/" rel="noopener noreferrer"&gt;Apple Developer Program&lt;/a&gt; to use Apple Pay.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. Create a Merchant ID
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Sign in to the &lt;a href="https://developer.apple.com/account/" rel="noopener noreferrer"&gt;Apple Developer Console&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Go to &lt;strong&gt;Certificates, Identifiers &amp;amp; Profiles &amp;gt; Identifiers&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click the &lt;code&gt;+&lt;/code&gt; button.&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Merchant IDs&lt;/strong&gt; and create a new one, e.g., &lt;code&gt;merchant.com.yourappname&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Add a description and register the ID.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  3. Generate an Apple Pay Certificate
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;In the &lt;strong&gt;Stripe Dashboard&lt;/strong&gt;, go to:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   Developers &amp;gt; iOS Certificate Settings
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;Add new application&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Select your &lt;strong&gt;Merchant ID&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Download the &lt;strong&gt;CSR (Certificate Signing Request)&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;In the Apple Developer portal, go to &lt;strong&gt;Merchant IDs&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Enable &lt;strong&gt;Apple Pay&lt;/strong&gt; and upload the &lt;strong&gt;CSR&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Download the &lt;strong&gt;generated certificate&lt;/strong&gt; and upload it back to Stripe.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  4. Enable Apple Pay in Xcode
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Open your React Native project in Xcode:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   ios/YourAppName.xcodeproj
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Select your target → &lt;strong&gt;Signing &amp;amp; Capabilities&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;code&gt;+ Capability&lt;/code&gt; → Add &lt;strong&gt;Apple Pay&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Select your &lt;strong&gt;Merchant ID&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Ensure the &lt;strong&gt;Bundle ID&lt;/strong&gt; matches what is configured in Apple.&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  Step 2: Set Up Stripe Account
&lt;/h3&gt;

&lt;h4&gt;
  
  
  1. Create a Stripe Account
&lt;/h4&gt;

&lt;p&gt;Create a free account at &lt;a href="https://stripe.com" rel="noopener noreferrer"&gt;https://stripe.com&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. Obtain API Keys
&lt;/h4&gt;

&lt;p&gt;In the Stripe Dashboard:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to &lt;code&gt;Developers &amp;gt; API Keys&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Copy:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Publishable Key&lt;/strong&gt; (for client-side)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Secret Key&lt;/strong&gt; (for server-side)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ &lt;strong&gt;Keep your secret key secure!&lt;/strong&gt; Use it only on the backend.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  3. Create a Backend Server for Payment Intents
&lt;/h4&gt;

&lt;p&gt;Apple Pay requires a &lt;strong&gt;PaymentIntent&lt;/strong&gt;, which must be created on the server. Here’s an example using Node.js:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// server.js&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;express&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Stripe&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;stripe&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;stripe&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Stripe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sk_test_YourSecretKey&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;express&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;express&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;

&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/create-payment-intent&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;paymentIntent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;stripe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;paymentIntents&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
      &lt;span class="na"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1099&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// amount in cents&lt;/span&gt;
      &lt;span class="na"&gt;currency&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;usd&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;payment_method_types&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;card&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="c1"&gt;// includes Apple Pay&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;

    &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;clientSecret&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;paymentIntent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;client_secret&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Server running on http://localhost:3000&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;You can host this on &lt;strong&gt;Glitch&lt;/strong&gt;, &lt;strong&gt;Render&lt;/strong&gt;, &lt;strong&gt;Vercel&lt;/strong&gt;, &lt;strong&gt;AWS&lt;/strong&gt;, or any backend provider.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  🔗 Configuring URL Scheme for Apple Pay (3D Secure)
&lt;/h2&gt;

&lt;p&gt;Some Stripe flows (like 3D Secure) require a custom &lt;strong&gt;URL scheme&lt;/strong&gt; to redirect back into your app.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Add URL Scheme to &lt;code&gt;Info.plist&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Open &lt;code&gt;ios/YourAppName/Info.plist&lt;/code&gt; and add the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;key&amp;gt;&lt;/span&gt;CFBundleURLTypes&lt;span class="nt"&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;array&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;dict&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;key&amp;gt;&lt;/span&gt;CFBundleTypeRole&lt;span class="nt"&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;string&amp;gt;&lt;/span&gt;Editor&lt;span class="nt"&gt;&amp;lt;/string&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;key&amp;gt;&lt;/span&gt;CFBundleURLName&lt;span class="nt"&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;string&amp;gt;&lt;/span&gt;com.yourappname&lt;span class="nt"&gt;&amp;lt;/string&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;key&amp;gt;&lt;/span&gt;CFBundleURLSchemes&lt;span class="nt"&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;array&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;string&amp;gt;&lt;/span&gt;yourapp&lt;span class="nt"&gt;&amp;lt;/string&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/array&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/dict&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/array&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Replace &lt;code&gt;yourapp&lt;/code&gt; and &lt;code&gt;com.yourappname&lt;/code&gt; with your actual values.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Step 2: Verify in Xcode
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Open the project in Xcode.&lt;/li&gt;
&lt;li&gt;Go to &lt;strong&gt;Info &amp;gt; URL Types&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Make sure:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Identifier&lt;/strong&gt;: &lt;code&gt;com.yourappname&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;URL Schemes&lt;/strong&gt;: &lt;code&gt;yourapp&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Role&lt;/strong&gt;: Editor&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🧪 StripeProvider Setup in React Native
&lt;/h2&gt;

&lt;p&gt;In your &lt;code&gt;App.js&lt;/code&gt; or main entry component, wrap your app in the &lt;code&gt;StripeProvider&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;StripeProvider&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@stripe/stripe-react-native&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;StripeProvider&lt;/span&gt;
  &lt;span class="na"&gt;publishableKey&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"pk_test_YourPublishableKey"&lt;/span&gt;
  &lt;span class="na"&gt;merchantIdentifier&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"merchant.com.yourappname"&lt;/span&gt;
  &lt;span class="na"&gt;urlScheme&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"yourapp://stripe-redirect"&lt;/span&gt;
&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;YourPaymentComponent&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;StripeProvider&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Make sure &lt;code&gt;urlScheme&lt;/code&gt; matches the one you registered in &lt;code&gt;Info.plist&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  🔪 Testing Apple Pay Integration
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Run your app on a &lt;strong&gt;physical iOS device&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   npx react-native run-ios
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Test a payment with Apple Pay.&lt;/li&gt;
&lt;li&gt;Use a test card (e.g., 4000 0027 6000 3184) that &lt;strong&gt;requires 3D Secure&lt;/strong&gt; to test the redirect and return flow.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  📝 Notes &amp;amp; Troubleshooting
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Replace all &lt;code&gt;yourapp&lt;/code&gt; strings with your actual app scheme.&lt;/li&gt;
&lt;li&gt;Ensure &lt;strong&gt;Bundle ID&lt;/strong&gt;, &lt;strong&gt;Merchant ID&lt;/strong&gt;, and &lt;strong&gt;URL schemes&lt;/strong&gt; are all consistent.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If Stripe fails to redirect after authentication, check:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;URL scheme in &lt;code&gt;StripeProvider&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;CFBundleURLSchemes&lt;/code&gt; in &lt;code&gt;Info.plist&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Always test Apple Pay on a &lt;strong&gt;physical iOS device&lt;/strong&gt;. Simulators do not fully support the flow.&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  📚 Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/stripe/stripe-react-native" rel="noopener noreferrer"&gt;Stripe React Native SDK&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://stripe.com/docs/apple-pay" rel="noopener noreferrer"&gt;Apple Pay on Stripe Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.apple.com/account/resources/identifiers/list/merchant" rel="noopener noreferrer"&gt;Apple Developer Merchant IDs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reactnative.dev/docs/environment-setup" rel="noopener noreferrer"&gt;React Native CLI Setup&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;If this helped you integrate Apple Pay, please leave a ❤️ or drop your questions below. Happy coding!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Deploy a Node.js App on EC2 and Keep It Running Forever with PM2</title>
      <dc:creator>arif chaudhary</dc:creator>
      <pubDate>Sat, 17 May 2025 16:40:39 +0000</pubDate>
      <link>https://dev.to/arif_chaudhary_94777248d1/deploy-a-nodejs-app-on-ec2-and-keep-it-running-forever-with-pm2-33n5</link>
      <guid>https://dev.to/arif_chaudhary_94777248d1/deploy-a-nodejs-app-on-ec2-and-keep-it-running-forever-with-pm2-33n5</guid>
      <description>&lt;h1&gt;
  
  
  🌥️ Node.js Hello World on EC2 — Keep It Running Forever with PM2
&lt;/h1&gt;

&lt;p&gt;Great for testing simple deployments on any cloud (AWS EC2, DigitalOcean, etc.).&lt;/p&gt;




&lt;h2&gt;
  
  
  ✅ Full Setup Guide (Step-by-Step)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  🧱 Step 1: Install Node.js and NPM Using NVM
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Become root&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;su -

&lt;span class="c"&gt;# Install NVM (Node Version Manager)&lt;/span&gt;
curl &lt;span class="nt"&gt;-o-&lt;/span&gt; https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash

&lt;span class="c"&gt;# Activate NVM&lt;/span&gt;
&lt;span class="nb"&gt;.&lt;/span&gt; ~/.nvm/nvm.sh

&lt;span class="c"&gt;# Install latest Node.js&lt;/span&gt;
nvm &lt;span class="nb"&gt;install &lt;/span&gt;node

&lt;span class="c"&gt;# Verify installation&lt;/span&gt;
node &lt;span class="nt"&gt;-v&lt;/span&gt;
npm &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  🔧 Step 2: Install Git and Clone the Repository
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Update packages&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get update &lt;span class="nt"&gt;-y&lt;/span&gt;

&lt;span class="c"&gt;# Install Git&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install &lt;/span&gt;git &lt;span class="nt"&gt;-y&lt;/span&gt;

&lt;span class="c"&gt;# Verify Git version&lt;/span&gt;
git &lt;span class="nt"&gt;--version&lt;/span&gt;

&lt;span class="c"&gt;# Clone the Node.js sample repo&lt;/span&gt;
git clone https://github.com/yeshwanthlm/nodejs-on-ec2.git

&lt;span class="c"&gt;# Move into the project directory&lt;/span&gt;
&lt;span class="nb"&gt;cd &lt;/span&gt;nodejs-on-ec2

&lt;span class="c"&gt;# Install dependencies&lt;/span&gt;
npm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  🚀 Step 3: Start the Application (For Testing)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your app will now serve &lt;code&gt;"A Monk in Cloud"&lt;/code&gt; — but it will stop when the terminal is closed or the server reboots. To fix that, let’s keep it running with PM2 👇&lt;/p&gt;




&lt;h3&gt;
  
  
  🔁 Step 4: Install and Use PM2 to Keep App Alive
&lt;/h3&gt;

&lt;h4&gt;
  
  
  📥 Install PM2 globally:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; pm2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  ▶️ Start the App with PM2:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pm2 start index.js &lt;span class="nt"&gt;--name&lt;/span&gt; BackendAPI
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;📝 Replace &lt;code&gt;index.js&lt;/code&gt; with the name of your main JS file if different.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  ♻️ Step 5: Keep App Running After Reboot
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pm2 startup
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Copy and run the command it outputs (something like this):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo env &lt;/span&gt;&lt;span class="nv"&gt;PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$PATH&lt;/span&gt;:/root/.nvm/versions/node/vXX/bin /root/.nvm/versions/node/vXX/lib/node_modules/pm2/bin/pm2 startup systemd &lt;span class="nt"&gt;-u&lt;/span&gt; root &lt;span class="nt"&gt;--hp&lt;/span&gt; /root
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then save the PM2 process list:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pm2 save
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  📋 Step 6: PM2 Useful Commands
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pm2 list              &lt;span class="c"&gt;# Show running apps&lt;/span&gt;
pm2 logs              &lt;span class="c"&gt;# Show app logs&lt;/span&gt;
pm2 restart monk-app  &lt;span class="c"&gt;# Restart the app&lt;/span&gt;
pm2 stop monk-app     &lt;span class="c"&gt;# Stop the app&lt;/span&gt;
pm2 delete monk-app   &lt;span class="c"&gt;# Remove it from PM2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  ✅ Final Result
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Node.js is installed with NVM&lt;/li&gt;
&lt;li&gt;App is deployed and running&lt;/li&gt;
&lt;li&gt;PM2 keeps it alive forever&lt;/li&gt;
&lt;li&gt;App auto-starts after reboot&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  ✨ Optional
&lt;/h3&gt;

&lt;p&gt;You can also:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use NGINX as a reverse proxy for clean domain access&lt;/li&gt;
&lt;li&gt;Add HTTPS with Let’s Encrypt&lt;/li&gt;
&lt;li&gt;Connect a CI/CD pipeline&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let me know in the comments if you'd like a guide for any of those! 🙌&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
