<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Gatien Didry on Medium]]></title>
        <description><![CDATA[Stories by Gatien Didry on Medium]]></description>
        <link>https://medium.com/@gatien.didry_61288?source=rss-d8e61fa16ade------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*kvTkGF7TfYRys9n4VIKT2g.jpeg</url>
            <title>Stories by Gatien Didry on Medium</title>
            <link>https://medium.com/@gatien.didry_61288?source=rss-d8e61fa16ade------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 00:32:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gatien.didry_61288/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Swift Value Types vs Reference Types: A Complete Guide (Stack vs Heap Explained)]]></title>
            <link>https://towardsdev.com/swift-value-types-vs-reference-types-a-complete-guide-stack-vs-heap-explained-7677ec1bb7ed?source=rss-d8e61fa16ade------2</link>
            <guid isPermaLink="false">https://medium.com/p/7677ec1bb7ed</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[swift-programming]]></category>
            <dc:creator><![CDATA[Gatien Didry]]></dc:creator>
            <pubDate>Tue, 04 Mar 2025 11:30:19 GMT</pubDate>
            <atom:updated>2025-03-05T14:35:44.129Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p><strong>Did you know that how Swift manages memory can significantly impact your app’s performance?</strong> 🚀 In this guide, we’ll break down <strong>Value Types vs Reference Types in Swift</strong>, the role of <strong>Stack and Heap memory</strong>, and key concepts like <strong>Copy-on-Write (COW)</strong>. Whether you’re preparing for an iOS interview or optimizing Swift performance, this article is for you.</p><h3>What are Value Types and Reference Types in Swift?</h3><p>In Swift, data types fall into two categories:</p><ul><li><strong>Value Types</strong>: Each instance keeps a unique copy of its data.</li><li><strong>Reference Types</strong>: Instances share the same memory location.</li></ul><h3>Understanding Stack and Heap in Swift Memory Management</h3><p>When a Swift program runs, memory is allocated in two areas:</p><h4>Stack Memory</h4><ul><li>Fast and efficient (LIFO: Last In, First Out).</li><li>Each thread manages its own stack.</li><li>Stores <strong>Value Types</strong> (Structs, Enums, Tuples).</li><li>Memory size is fixed (on macOS, ~8MB).</li></ul><h4>Heap Memory</h4><ul><li>Dynamically allocated.</li><li>Shared across multiple threads.</li><li>Stores <strong>Reference Types</strong> (Classes, Closures, Actors).</li><li>Requires ARC (Automatic Reference Counting) for cleanup.</li></ul><figure><img alt="Swift Stack vs Heap memory diagram — Value Types vs Reference Types" src="https://cdn-images-1.medium.com/max/1024/1*qiRaDjUttMgpCjiZF2le3w.png" /></figure><h3>Swift Struct vs Class: Key Differences</h3><p>Let’s compare a <strong>struct</strong> and a <strong>class</strong> in Swift:</p><pre>class Person {<br>    var firstName: String<br>    var lastName: String<br>    <br>    init(_ firstName: String, _ lastName: String) {<br>        self.firstName = firstName<br>        self.lastName = lastName<br>    }<br>}<br><br>struct PersonWithStruct {<br>    var firstName: String<br>    var lastName: String<br>    <br>    init(_ firstName: String, _ lastName: String) {<br>        self.firstName = firstName<br>        self.lastName = lastName<br>    }<br>}</pre><h4>Example: Assigning Structs vs Classes</h4><pre>var person1 = Person(&quot;Antoine&quot;, &quot;Dupont&quot;)<br>var person2 = person1 // Both point to the same value in heap<br>person1.firstName = &quot;Mike&quot;<br><br>print(person1.firstName) // Mike<br>print(person2.firstName) // Mike (Reference Type)<br><br>var struct1 = PersonWithStruct(&quot;Antoine&quot;, &quot;Dupont&quot;)<br>var struct2 = struct1 // Creates a copy<br>struct1.firstName = &quot;Mike&quot;<br><br>print(struct1.firstName) // Mike<br>print(struct2.firstName) // Antoine (Value Type)</pre><h3>How Copy-on-Write (COW) Works in Swift?</h3><p>Swift optimizes <strong>Value Types</strong> like Array, Dictionary, and String using <strong>Copy-on-Write (COW)</strong>. This means a copy is only created <strong>when a modification occurs</strong>.</p><pre>var array1 = [1, 2, 3]<br>var array2 = array1 // No copy yet, both reference the same memory<br>array2.append(4) // Now a copy is made</pre><h3>Debugging Memory in Swift with LLDB</h3><p>Using LLDB, we can inspect memory allocation:</p><pre>frame variable person1<br># (ValueOrRefTypes.Person) person1 = 0x0000600000c6d230 (firstName = &quot;Mike&quot;, lastName = &quot;Dupont&quot;)<br><br>frame variable struct1<br># (ValueOrRefTypes.PersonWithStruct) struct1 = (firstName = &quot;Mike&quot;, lastName = &quot;Dupont&quot;)</pre><p>💡 <strong>Notice how the struct has no memory address (stored in stack), while the class has a heap address.</strong></p><h3>Best Practices for Swift Performance Optimization</h3><ul><li>✅ <strong>Use Structs</strong> for immutability and performance.</li><li>✅ <strong>Use Classes</strong> when objects need shared state.</li><li>✅ <strong>Leverage Copy-on-Write (COW)</strong> for efficient memory management.</li><li>✅ <strong>Monitor memory usage</strong> with Instruments and LLDB.</li></ul><h3>TL;DR — Key Takeaways 📝</h3><p>✅ <strong>Value Types</strong> (Structs, Enums, Tuples) are stored in the <strong>Stack</strong> and are <strong>copied when assigned</strong>.<br>✅ <strong>Reference Types</strong> (Classes, Closures, Actors) are stored in the <strong>Heap</strong> and shared between variables.<br>✅ <strong>Swift optimizes performance with Copy-on-Write (COW)</strong> for collections like <strong>Array, Dictionary, and String</strong>.<br>✅ <strong>Use Structs for immutability and performance, and Classes when you need shared state.</strong></p><h3>🚀 Final Thoughts</h3><p><strong>Did this guide help you understand Swift memory management?</strong> Let me know in the comments!<br>🚀 If you found this useful, give it a 👏 and follow me for more <strong>Swift &amp; iOS development tips!</strong></p><p>Thanks for reading! Feel free to reach out on <a href="https://www.linkedin.com/in/gatiendidrymobileappdeveloper/"><strong>LinkedIn</strong></a> 😃.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7677ec1bb7ed" width="1" height="1" alt=""><hr><p><a href="https://towardsdev.com/swift-value-types-vs-reference-types-a-complete-guide-stack-vs-heap-explained-7677ec1bb7ed">Swift Value Types vs Reference Types: A Complete Guide (Stack vs Heap Explained)</a> was originally published in <a href="https://towardsdev.com/">Towards Dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Enhance Swift Debugging with the @DebugDescription Macro]]></title>
            <link>https://medium.com/@gatien.didry_61288/increase-swift-debugging-experience-with-debugdescription-macro-17c1c8cda3b1?source=rss-d8e61fa16ade------2</link>
            <guid isPermaLink="false">https://medium.com/p/17c1c8cda3b1</guid>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[swift-programming]]></category>
            <category><![CDATA[apple]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Gatien Didry]]></dc:creator>
            <pubDate>Tue, 25 Feb 2025 10:27:30 GMT</pubDate>
            <atom:updated>2025-02-25T14:08:47.592Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="A bird flying" src="https://cdn-images-1.medium.com/max/1024/1*cyzbfS6AY7mdchxIdgyrSA.png" /></figure><p>A new macro named @DebugDescription appeared with Swift 6.</p><p>How does it work ? Why use it (or not) ?</p><p>@DebugDescription will be useful for debugging with lldb.</p><h4>Understand how p and po work</h4><p>Remember: there is the compiler for your code and lldb has its own.</p><p>When you use lldb and you want to print a value of a variable, you can use p(print) or po<strong> </strong>(print object).</p><p>When you use po, lldb creates a piece of code to access the value of your variable, compiles it in the context of your debugged program, executes it, and then recreates another piece of code (which wraps the result), compiles it, and executes it again. It returns a String.</p><p>When you use p, like po, lldb creates a piece of code to access the value of your variable, compiles it in the context of your debugged program, executes it, and passes the result to a data formatter. So, in this case, there is only one compilation and execution (it&#39;s faster).</p><p>The output is also different. Let’s check with an example.<br>In my iOS app, I have a class Person:</p><pre>final class Person{<br>    var firstName: String<br>    private var lastName: String<br>    private var age: Int<br><br>    init(firstName: String, lastName: String, age: Int) {<br>        self.firstName = firstName<br>        self.lastName = lastName<br>        self.age = age<br>    }<br>}</pre><p>I instantiate one Person in the constructor of my ContentView. I add a breakpoint on the last line (the print statement):</p><pre>let person1 = Person(firstName: &quot;Leon&quot;, lastName: &quot;Marchand&quot;, age: 22)<br>        <br>print(&quot;add a break point on this line&quot;)</pre><p>What if I enter the command po person1 in lldb?</p><figure><img alt="po person1 return “object description requested, but type doesn’t implement a custom object description. Consider using “p” instead of “po” (this note will only be shown once per debug session).  &lt;Person: 0x60000176ebc0&gt;”" src="https://cdn-images-1.medium.com/max/1024/1*uPygjyfMykjJfnYDAOEGjw.png" /></figure><p>So, to have a custom description, we can implement CustomDebugStringConvertible:</p><pre>extension Person: CustomDebugStringConvertible {<br>    var debugDescription: String {<br>        &quot;Person: \(firstName) \(lastName) - \(age)&quot;<br>    }<br>}</pre><p>Now we have:</p><figure><img alt="po person1 return “Person: Leon Marchand — 22”" src="https://cdn-images-1.medium.com/max/1024/1*k8G40dTEUK4GhyxaaUWLpw.png" /></figure><p>According to the documentation, po returns the object&#39;s description.<br>And what if I enter p person1 in lldb?</p><figure><img alt="p return “(AwesomeApp.Person) 0x0000600001762c00 (firstName = “Leon”, lastName = “Marchand”, age = 22)”" src="https://cdn-images-1.medium.com/max/1024/1*XuEDjXvKxgwV5iZeiY2LXQ.png" /></figure><p>According to the documentation, p passes through formatters and returns the formatted data.<br>So, po is slower, but it can print objects with a more detailed description.<br>p uses data formatters, and data formatters don’t have access to computed properties (like the number of elements in an array).<br>You can customize data formatters directly in lldb by adding filters or summary strings.</p><p>In lldb, I’ll enter</p><pre>type summary add AwesomeApp.Person --summary-string &quot;${var.firstName} age : ${var.age}&quot;</pre><p>to customize my output of the p command.<br>This is the result:</p><figure><img alt="p return “(AwesomeApp.Person) 0x000060000175ca80 “Leon” age : 22&quot;" src="https://cdn-images-1.medium.com/max/1024/1*l-A4fNZCGbZdMpUojKJSTg.png" /></figure><h4>And now, what about @DebugDescription ?</h4><p>In fact, @DebugDescription allows us to customize data formatters&#39; summary type directly from the swift code.<br>One of the biggest benefits is that we can get the customized output directly in the variable hierarchy (on the left side of my screenshot).</p><p>Let’s add @DebugDescription to our Person class:</p><pre>final class Person{<br>    var firstName: String<br>    private var lastName: String<br>    private var age: Int<br><br>    init(firstName: String, lastName: String, age: Int) {<br>        self.firstName = firstName<br>        self.lastName = lastName<br>        self.age = age<br>    }<br>}<br><br>@DebugDescription<br>extension Person: CustomDebugStringConvertible {<br>    var debugDescription: String {<br>        &quot;Person: \(firstName) \(lastName) - \(age)&quot;<br>    }<br>}</pre><figure><img alt="We can see in the variable arboresence that person1 is displayed as “person1 = AwesomeApp.Person Person: “Leon” “Marchand” — 22 “ ; p person1 return (AwesomeApp.Person) 0x0000600001747540 Person: “Leon” “Marchand” — 22 {
 firstName = “Leon”
 lastName = “Marchand”
 age = 22
 }" src="https://cdn-images-1.medium.com/max/1024/1*lsT20iR0pNH-2TbnDROO7w.png" /></figure><p>So it works! We can see that the output in the variable hierarchy corresponds to our debug description, and the output of phas changed.</p><p>But what if debugDescription isn&#39;t adapted for p?<br>p cannot handle computed descriptions (like array size).</p><p>I added an array of objects to my Person class:</p><pre>final class Person{<br>    var firstName: String<br>    private var lastName: String<br>    private var age: Int<br>    private var items: [String]<br><br>    init(<br>        firstName: String,<br>        lastName: String,<br>        age: Int,<br>        items: [String]) {<br>            self.firstName = firstName<br>            self.lastName = lastName<br>            self.age = age<br>            self.items = items<br>        }<br>}<br><br>@DebugDescription<br>extension Person: CustomDebugStringConvertible {<br>    var debugDescription: String {<br>        &quot;Person: \(firstName) -  items: \(items.count)&quot;<br>    }<br>}<br><br>...<br>let person1 = Person(<br>            firstName: &quot;Leon&quot;,<br>            lastName: &quot;Marchand&quot;,<br>            age: 22,<br>            items: [&quot;iPhone&quot;, &quot;iPad&quot;]<br>        )</pre><p>Let’s check the result :</p><figure><img alt="p return “(AwesomeApp.Person) 0x000060000175aa40 error: summary string parsing error”" src="https://cdn-images-1.medium.com/max/1024/1*ypRhDJQMw8dfTpMnU_0NKA.png" /></figure><p>So, as expected, it doesn’t work (but it works with po).</p><p>To separate p and po, we can use lldbDescription:</p><pre>@DebugDescription<br>extension Person: CustomDebugStringConvertible {<br>    var debugDescription: String {<br>        &quot;Person: \(firstName) -  items: \(items.count)&quot;<br>    }<br><br>    var lldbDescription: String {<br>        &quot;Person: \(firstName) - age: \(age)&quot;<br>    }<br>}</pre><p>And now it works :</p><figure><img alt="p return “ 0x000060000176de40 Person: “Leon” — age: 22&quot; as expected" src="https://cdn-images-1.medium.com/max/1024/1*FLzU9Dcg9tVzxIjeIZjtRQ.png" /></figure><p>With @DebugDescription, you can now define data formatters directly in your Swift code to debug faster.</p><p>Thanks for reading! Feel free to comment and add me on <a href="https://www.linkedin.com/in/gatiendidrymobileappdeveloper/">LinkedIn</a>. 😃</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17c1c8cda3b1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Manage iOS Subscriptions in Your Backend with App Store Server Notifications]]></title>
            <link>https://medium.com/@gatien.didry_61288/manage-your-ios-subscriptions-in-your-backend-with-app-store-server-notifications-fb9708ca77e7?source=rss-d8e61fa16ade------2</link>
            <guid isPermaLink="false">https://medium.com/p/fb9708ca77e7</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Gatien Didry]]></dc:creator>
            <pubDate>Sun, 09 Feb 2025 14:10:52 GMT</pubDate>
            <atom:updated>2025-02-09T14:22:32.211Z</atom:updated>
            <content:encoded><![CDATA[<p>Today, we’ll see how to manage users’ status in your backend by implementing App Store Server Notifications V2.</p><p>The use case is when a user subscribes to an offer in your iOS app, you also need to update the user’s row in your remote database (via your backend).</p><p>Please check <a href="https://medium.com/@gatien.didry_61288/update-your-database-after-a-new-subscription-in-your-ios-app-7c05cea3d575">my first article</a> first to learn how to update the database right after the purchase via the app client. In it, I explain all the configurations, how I set up products, how I implemented SubscriptionStoreView, and more:</p><p><a href="https://medium.com/@gatien.didry_61288/update-your-database-after-a-new-subscription-in-your-ios-app-7c05cea3d575">https://medium.com/@gatien.didry_61288/update-your-database-after-a-new-subscription-in-your-ios-app-7c05cea3d575</a></p><p>This article is the sequel, so I will focus on the essentials.</p><h4>1. Diagrams to Understand How It Works</h4><p>When a user makes a payment, Apple’s server can notify your server with a notification.</p><figure><img alt="A pseudo-sequence diagram illustrates how App Store Server Notifications work. When a user subscribes, Apple’s server triggers a notification to your server." src="https://cdn-images-1.medium.com/max/1024/1*KQ7ZxM6sy_Fl5c-Oo0oU4A.png" /><figcaption>A pseudo-sequence diagram illustrating how App Store Server Notifications work.</figcaption></figure><p>There are many notification types; you can find them here:</p><p><a href="https://developer.apple.com/documentation/appstoreservernotifications/notificationtype">notificationType | Apple Developer Documentation</a></p><p>In our case, will be focused on :</p><ul><li>SUBSCRIBED : When a user subscribes to a subscription offer.</li><li>EXPIRED : When a user’s subscription has expired.</li><li>DID_CHANGE_RENEWAL_PREF : When a user upgrades or downgrades their subscription level.</li><li>DID_RENEW : When the user’s subscription is successfully renewed.</li></ul><p>We can separate these four events into two categories:</p><ul><li><strong>Immediate effect</strong>: When a user subscribes or upgrades their subscription, the change takes effect immediately.</li><li><strong>Delayed effect</strong>: When a user stops or downgrades their subscription, the change takes effect at the end of the current billing period. For example, if they subscribe for one month, the change will take effect at the end of that month.</li></ul><h4>2. Set up</h4><p>Let’s create a Firebase function to handle theses notifications.</p><pre>export const manageAppStoreServerNotificationsV2 = onRequest(async (request, response) =&gt; {<br>    logger.info(&quot;In the manageAppStoreServerNotificationsV2 function&quot;)<br><br>    logger.info(request.body)<br><br>    // Return a response with status code 200 to 206 to indicate to the App Store Server that you have successfully received the notification.<br>    response.status(200).send();<br>})</pre><p>We need to add the URL of this function in App Store Connect.</p><p>Go to:<br>General → App Information → App Store Server Notifications → Sandbox Server URL.</p><figure><img alt="An image showing the Sandbox Server URL area" src="https://cdn-images-1.medium.com/max/1024/1*15v1LYQ1Be_bQOXXNl5ihg.png" /></figure><p>Your server must support the Transport Layer Security (TLS) 1.2 protocol or later (the URL must be http<strong>S</strong>).</p><p>Now, when we make a payment in the iOS app within the <strong>Sandbox environment</strong>, we should receive notifications.</p><p>If you don’t get any notifications, please check that:</p><ul><li>You don’t have any <strong>StoreKit</strong> configuration file in your project.</li><li>You are using a <strong>real device</strong> — it won’t work on emulators.</li></ul><p>If we check the notification, we get something like this:</p><pre>jsonPayload: {<br>signedPayload: &quot;long string...&quot;<br>}</pre><h4>3. Verify Signed Data</h4><p>The signed payload is cryptographically signed by the App Store in JSON Web Signature (JWS) format.</p><p>According to Apple’s documentation:</p><blockquote>“The JWS format increases security and enables you to decode and validate the signature on your server.”</blockquote><p>We could manually verify the signed transaction, but <strong>Apple provides a library</strong> to simplify the process. This library is available in <strong>Swift, Java, Python, and Node.js</strong>.</p><p>Here is the documentation for <strong>Node.js</strong>:</p><p><a href="https://apple.github.io/app-store-server-library-node/">@apple/app-store-server-library</a></p><p>We will use the <strong>verifyAndDecodeNotification </strong>method of <strong>SignedDataVerifier</strong>.</p><p>Let’s install the library.</p><pre>npm install @apple/app-store-server-library --save</pre><p>Let’s instantiate a <strong>SignedDataVerifier:</strong></p><pre>  let cert = fs.readFileSync(&quot;./AppleRootCA-G3.cer&quot;)<br>    let appleCertificates: Buffer[] = []<br>    appleCertificates.push(cert)<br><br>    const bundleId = &quot;app.AwesomeApp&quot;<br><br>    const environment = Environment.SANDBOX<br><br>    const enableOnlineChecks = true<br><br>    const appAppleId = undefined   // appAppleId is required when the environment is Production<br>    <br>    const verifier = new SignedDataVerifier(appleCertificates, enableOnlineChecks, environment, bundleId, appAppleId)</pre><ul><li>You need to obtain one or more Apple root certificates. I personally use the “G3” certificate<strong> </strong>(<a href="https://www.apple.com/certificateauthority/">https://www.apple.com/certificateauthority/</a>).</li><li>The bundle ID of your app</li><li>The environment (Don’t forget to set it to Environment.PRODUCTION in production)</li><li>enableOnlineChecks, set to true or false</li><li>appAppleId (can be undefined in the Sandbox environment). To find it, check out this guide:<a href="https://medium.com/@gatien.didry_61288/get-app-apple-id-ad95a173a024">https://medium.com/@gatien.didry_61288/get-app-apple-id-ad95a173a024</a>)</li></ul><p>Now we can verify and decode notification:</p><pre> let notificationDecoded = await verifier.verifyAndDecodeNotification(request.body.signedPayload)</pre><pre>jsonPayload: {<br>data: {<br>appAppleId: ...<br>bundleId: &quot;app.AwesomeApp&quot;<br>bundleVersion: &quot;1&quot;<br>environment: &quot;Sandbox&quot;<br>signedRenewalInfo: &quot;....&quot;<br>signedTransactionInfo: &quot;....&quot;<br>status: 1<br>}<br>notificationType: &quot;SUBSCRIBED&quot;<br>notificationUUID: &quot;...&quot;<br>signedDate: 1739040208155<br>subtype: &quot;INITIAL_BUY&quot;<br>version: &quot;2.0&quot;<br>}</pre><p>You can see the notification type. We also need to verify signedTransactionInfo.</p><pre> const transactionInfo = await verifier.verifyAndDecodeTransaction(notificationDecoded.data?.signedTransactionInfo!)</pre><pre>jsonPayload: {<br>appAccountToken: &quot;8ee94299-b2d7-4a35-aa92-96a1d1f4d01b&quot;<br>bundleId: &quot;app.AwesomeApp&quot;<br>currency: &quot;EUR&quot;<br>environment: &quot;Sandbox&quot;<br>expiresDate: 1739040379000<br>inAppOwnershipType: &quot;PURCHASED&quot;<br>originalPurchaseDate: 1739040200000<br>originalTransactionId: &quot;...&quot;<br>price: 5990<br>productId: &quot;awesome_silver_subscription&quot;<br>purchaseDate: 1739040199000<br>quantity: 1<br>signedDate: 1739040208116<br>storefront: &quot;FRA&quot;<br>storefrontId: &quot;143442&quot;<br>subscriptionGroupIdentifier: &quot;...&quot;<br>transactionId: &quot;...&quot;<br>transactionReason: &quot;PURCHASE&quot;<br>type: &quot;Auto-Renewable Subscription&quot;<br>webOrderLineItemId: &quot;...&quot;<br>}</pre><p>We retrieve our appAccountToken to identify the user in our database (refer to the first <a href="https://medium.com/@gatien.didry_61288/update-your-database-after-a-new-subscription-in-your-ios-app-7c05cea3d575">article</a>), as well as the productId.</p><p>You can activate the user account when you receive this notification. In a normal scenario, the account should already be activated (refer to the first <a href="https://medium.com/@gatien.didry_61288/update-your-database-after-a-new-subscription-in-your-ios-app-7c05cea3d575">article</a>), but this serves as an additional security measure.</p><p>For an <strong>upgrade</strong>, you must activate the user <strong>immediately</strong>. The notification will have:</p><ul><li><strong>notificationType</strong>: &quot;DID_CHANGE_RENEWAL_PREF&quot;</li><li><strong>subtype</strong>: &quot;UPGRADE&quot;</li></ul><p>In a normal scenario, the account should already be activated (refer to the first <a href="https://medium.com/@gatien.didry_61288/update-your-database-after-a-new-subscription-in-your-ios-app-7c05cea3d575">article</a>), but this also serves as a security measure.</p><p>For a downgrade, you must apply the downgrade when you receive a DID_RENEW notification <strong>and</strong> the productId has changed. You’ll receive DID_RENEW when the subscription period is renewed, regardless of the productId. For example, this happens when a user finishes their month as a <strong>Gold member</strong> and transitions to a <strong>Bronze member</strong>.</p><p>When a user stops their subscription, you will receive a EXPIRED notification.</p><p>Thanks for reading! 😊</p><p>Feel free to comment on this article and <strong>connect with me on </strong><a href="https://www.linkedin.com/in/gatiendidrymobileappdeveloper/"><strong>LinkedIn</strong></a>! 😃</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb9708ca77e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Update Your Database After a New Subscription in Your iOS App]]></title>
            <link>https://medium.com/@gatien.didry_61288/update-your-database-after-a-new-subscription-in-your-ios-app-7c05cea3d575?source=rss-d8e61fa16ade------2</link>
            <guid isPermaLink="false">https://medium.com/p/7c05cea3d575</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <dc:creator><![CDATA[Gatien Didry]]></dc:creator>
            <pubDate>Sun, 09 Feb 2025 14:07:17 GMT</pubDate>
            <atom:updated>2025-02-09T14:18:44.140Z</atom:updated>
            <content:encoded><![CDATA[<p>Today, we will explore how to update your database after a user subscribes to an offer in your app. We will start with the scenario where a user subscribes and you need to upgrade their privilege level in the (remote) database.</p><p>For this article, I will use iOS with SwiftUI, a Firebase project with Firestore, and Cloud Functions written in TypeScript. I assume that you already have a backend configured, so I will focus on the essentials. I’ll begin with StoreKit 2 and then introduce an approach using RevenueCat.</p><p>I will cover how to manage unsubscription and downgrades in <a href="https://medium.com/@gatien.didry_61288/manage-your-ios-subscriptions-in-your-backend-with-app-store-server-notifications-fb9708ca77e7">a second article, using App Store Server Notifications.</a></p><h4>1. Diagrams to Understand How It Works</h4><figure><img alt="The pseudo-sequence diagram illustrates how the subscription process works. First, the app communicates with Apple’s server to retrieve subscription details. Then, when a user makes a purchase, the app calls your personal server and sends the signed transaction to activate the subscription. Your personal server verifies the signed data to ensure everything is correct." src="https://cdn-images-1.medium.com/max/1024/1*cn_tNiXR72T2b2Tf_k-Fzg.png" /><figcaption>A pseudo-sequence diagram illustrating how subscriptions work using signed transactions.</figcaption></figure><p>So, as you can see, there are three phases:</p><ol><li>The app retrieves the available subscriptions and subscribes to one.</li><li>The app sends the signed transaction to your server.</li><li>Your server verifies it and updates the database.</li></ol><p>Why send a signed transaction? To ensure that the data comes from the App Store and has not been modified.</p><p><em>Ok G., but what if the user kills the app or loses network after paying and before calling my server? The user wouldn’t receive their subscription privileges on the server side.</em></p><p>You’re absolutely right! That can be a problem. That’s why Apple has implemented <strong>App Store Server Notifications</strong>.</p><figure><img alt="The pseudo-sequence diagram explains how subscriptions work with App Store Server Notifications. When a user subscribes, Apple notifies your server." src="https://cdn-images-1.medium.com/max/1024/1*KQ7ZxM6sy_Fl5c-Oo0oU4A.png" /><figcaption>A pseudo-sequence diagram illustrating how subscriptions work with App Store Server Notifications.</figcaption></figure><p><strong>App Store Server Notifications</strong> are triggered after an in-app purchase event. Receiving notifications from Apple and processing them on your server takes time. You can’t rely solely on App Store Server Notifications without activating the subscription from the app. What will you show to the user during the time between payment and the notification process?</p><p>We will cover App Store Server Notifications in<a href="https://medium.com/@gatien.didry_61288/manage-your-ios-subscriptions-in-your-backend-with-app-store-server-notifications-fb9708ca77e7"> the second article</a>. For now, <strong>let’s focus on activating the subscription directly from the app.</strong></p><h4>2. Configure subscription’s offers</h4><p>I start a new Xcode project <strong>without</strong> <strong>using a</strong> <strong>StoreKit Configuration File</strong>, as it does not trigger App Store Server Notifications.I add an app icon and immediately submit a release to App Store Connect to set up the environment (Product → Archive → Distribute App → App Store Connect …).</p><figure><img alt="The App Store Connect dashboard displaying my app" src="https://cdn-images-1.medium.com/max/1024/1*DgRWhzKAW0KrReFMrbP2Vw.png" /><figcaption>My app has been uploaded to App Store Connect.</figcaption></figure><p>Now, I will configure my subscriptions. I offer three subscription tiers, ordered in ascending price and privileges:</p><ul><li><strong>Bronze:</strong> $2.99/week</li><li><strong>Silver:</strong> $4.99/week</li><li><strong>Gold:</strong> $9.99/week</li></ul><p>To do this, I will go to the bottom of the left navigation bar and select ‘Subscriptions’.</p><figure><img alt="The App Store Connect dashboard with the ‘Subscriptions’ button framed." src="https://cdn-images-1.medium.com/max/1024/1*dDF59DMNAwxBAjonwJ8ekg.png" /></figure><p>First we need to create a subscription group.</p><p>A user can only have one subscription at a time within the same group, but they can hold multiple subscriptions from different groups simultaneously. If a user changes their subscription within a group, it will be considered an ‘upgrade’ or ‘downgrade’ event. However, if the user subscribes to a second subscription from another group, it will function independently.</p><p>In our case, we need to create a group that includes our 3 subscription offers.</p><figure><img alt="Click the ‘Create’ button in the Subscription Groups section." src="https://cdn-images-1.medium.com/max/1024/1*0sgI-QhM69PzyeBZXPlr_g.png" /></figure><p>Give it a name and click ‘Create’.</p><figure><img alt="Enter group name in the popup" src="https://cdn-images-1.medium.com/max/1024/1*ftg0xK2PgLXHwxbi75IX8A.png" /></figure><p>We will create our three subscriptions. Click ‘Create’ in the ‘Subscriptions’ section.</p><figure><img alt="Click ‘Create’ in the Subscriptions section." src="https://cdn-images-1.medium.com/max/1024/1*gZGP_T--pPUEazPwjVAYlQ.png" /></figure><p>Give it a name. If you have good naming conventions, feel free to share them in the comments of this Medium article.</p><figure><img alt="Add a name for your subscription" src="https://cdn-images-1.medium.com/max/1024/1*9CuZN36trxmgFS-RR7zPzg.png" /></figure><p>Click ‘Create’, choose a subscription duration.</p><figure><img alt="Choose a subscription duration." src="https://cdn-images-1.medium.com/max/1024/1*-cEJc1cN2yYKZaL4UlxGKQ.png" /></figure><p>Availability → Set to ‘All’ (or as preferred)</p><p>Price → I set it to $9.99 in the USA. Modify it as needed for other countries.</p><figure><img alt="Set the price to $9,99 for USA" src="https://cdn-images-1.medium.com/max/1024/1*kZG4y3FEm-WFgfg1Y6nInQ.png" /></figure><p>You can set up the rest after.</p><p>I repeat the process for the silver subscription ($4,99/week) and the bronze subscription ($2,99/month).</p><figure><img alt="All the subscriptions have been created" src="https://cdn-images-1.medium.com/max/1024/1*1uh0t3Qi--ZmMZn4uWg_Pw.png" /></figure><p><strong>You need to sort your subscriptions in descending order based on the level of privileges they provide</strong> to the user. The subscription with the highest level of privileges should be at the top. <strong>This is important for handling upgrade and downgrade events correctly</strong>.</p><h4>3. Implement Store View in iOS App.</h4><p>Now, back to my app. In my content file, I import StoreKit and add a SubscriptionStoreView :</p><pre>import SwiftUI<br>import StoreKit<br><br>struct ContentView: View {<br>    var body: some View {<br>        SubscriptionStoreView(productIDs: [<br>            &quot;awesome_bronze_subscription&quot;,<br>            &quot;awesome_silver_subscription&quot;,<br>            &quot;awesome_gold_subscription&quot;<br>        ])<br>    }<br>}</pre><p>I sort the products in ascending order by price. Then, I run the app and see my paywall.</p><figure><img alt="A screenshot showing the paywall with the 3 options sorted in ascending order" src="https://cdn-images-1.medium.com/max/400/1*Rvq9nInZO431RnUIBwJsGQ.png" /></figure><p>I repeat: <strong>You must not have any StoreKit file in your Xcode project.</strong></p><p>I add onInAppPurchaseCompletion to my SubscriptionStoreView and print the result.</p><pre><br>import SwiftUI<br>import StoreKit<br><br>struct ContentView: View {<br>    var body: some View {<br>        SubscriptionStoreView(productIDs: [<br>            &quot;awesome_bronze_subscription&quot;,<br>            &quot;awesome_silver_subscription&quot;,<br>            &quot;awesome_gold_subscription&quot;<br>        ]).onInAppPurchaseCompletion { product, result in<br>            print(result)<br>        }<br>    }<br>}</pre><h4>4. Configure a Sandbox Tester</h4><p>Ok, before testing, we need to configure a Sandbox tester.</p><p>Sandbox is an environment that allows us to test our implementation using real products and server-to-server transactions.</p><p>So, we need to create a Sandbox user.</p><p>Go to App Store Connect → Users and Access → Sandbox.</p><figure><img alt="Select Sandbox in “Users and Access” section on App Store Connect dashboard" src="https://cdn-images-1.medium.com/max/1024/1*3xjyf1t-QXzuRFL04TS83w.png" /></figure><p>Click on “Add Test Account” and create a user with a real email address you own and a password you’ll remember</p><figure><img alt="Click on “Add Test Account” and create a user with a real email adress you have and a password you’ll remember." src="https://cdn-images-1.medium.com/max/1024/1*hnjg-T1OtzcRjjrWxbQVMQ.png" /></figure><p>Refresh the page. The user should appear.</p><figure><img alt="The user I added appearead in the dashboard after I refresh the page" src="https://cdn-images-1.medium.com/max/1024/1*yWG1EtzhPTS1p__uI4qRKw.png" /></figure><p>Now, back to your iPhone. <strong>Please use a physical device; </strong>it won’t work on the emulator.</p><p>Go to Settings → Developer → SANDBOX APPLE ACCOUNT and sign in (at the very bottom of the page).</p><figure><img alt="The button is at the very bottom of the page" src="https://cdn-images-1.medium.com/max/300/1*3zhntFGtGQcFoUAXmpCMJA.png" /></figure><p>Sign in with the Sandbox account you created on <strong>App Store Connect.</strong> The email should appear.</p><figure><img alt="The email must appear after sign up" src="https://cdn-images-1.medium.com/max/300/1*4Sduyk4om0kXwrbAdZxffw.jpeg" /></figure><p>Back to the app. Choose a product and click ‘Subscribe’.</p><figure><img alt="The payment sheet appears" src="https://cdn-images-1.medium.com/max/300/1*1eJFa1K3CdIj_kl2OqjOig.jpeg" /></figure><p>You will be prompted to enter your password. If you check the Xcode logs, you will see</p><figure><img alt="The logs “Making a purchase without listening for transaction updates risks missing successful purchases. Create a Task to iterate Transaction.updates at launch.”" src="https://cdn-images-1.medium.com/max/1024/1*MSnkSPSxanUPE3qm8iW9oQ.png" /></figure><p>It’s not today’s topic, but if you want to learn more about it, please check Apple’s documentation:</p><p><a href="https://developer.apple.com/documentation/storekit/transaction/updates">updates | Apple Developer Documentation</a></p><p>And you should see something like this in your log (corresponding to print(result)):</p><pre>success(StoreKit.Product.PurchaseResult.success({<br>  &quot;header&quot; : {<br>    &quot;alg&quot; : &quot;ES256&quot;,<br>    &quot;x5c&quot; : [<br>...      <br>]<br>  },<br>  &quot;payload&quot; : {<br>    &quot;bundleId&quot; : &quot;app.AwesomeApp&quot;,<br>    &quot;currency&quot; : &quot;EUR&quot;,<br>    &quot;environment&quot; : &quot;Sandbox&quot;,<br>    &quot;expiresDate&quot; : 1738684608000,<br>    &quot;inAppOwnershipType&quot; : &quot;PURCHASED&quot;,<br>    &quot;originalPurchaseDate&quot; : 1738683886000,<br>    &quot;originalTransactionId&quot; : &quot;...&quot;,<br>    &quot;price&quot; : 5990,<br>    &quot;productId&quot; : &quot;awesome_silver_subscription&quot;,<br>    &quot;purchaseDate&quot; : 1738684428000,<br>    &quot;quantity&quot; : 1,<br>    &quot;signedDate&quot; : 1738684428798,<br>    &quot;storefront&quot; : &quot;FRA&quot;,<br>    &quot;storefrontId&quot; : &quot;143442&quot;,<br>    &quot;subscriptionGroupIdentifier&quot; : &quot;21606258&quot;,<br>    &quot;transactionId&quot; : &quot;...&quot;<br>...<br>  },<br>  &quot;signature&quot; : &quot;64 bytes (verified)&quot;<br>}))</pre><p>And that’s great! Our goal now is to send the signed transaction to our backend to update the user&#39;s subscription in our database.</p><p>Why send the signed transaction? With this information, our backend will have everything it needs to update (or not) the user in the database.</p><h4>5. Set up appAccountToken.</h4><p>So far, we haven’t linked the subscriptions to our user. We need to add a user identifier to the transaction. It’s important to identify who made the transaction (both in our case and for future use).</p><p>To do this, we can pass <strong>appAccountToken</strong>.</p><pre>import SwiftUI<br>import StoreKit<br><br>struct ContentView: View {<br><br>    var body: some View {<br>        SubscriptionStoreView(productIDs: [<br>            &quot;awesome_bronze_subscription&quot;,<br>            &quot;awesome_silver_subscription&quot;,<br>            &quot;awesome_gold_subscription&quot;<br>        ]).inAppPurchaseOptions({ product in<br>            return [.appAccountToken(UUID(uuidString: &quot;8ee94299-b2d7-4a35-aa92-96a1d1f4d01b&quot;)!)]<br>        })<br>        .onInAppPurchaseCompletion { product, result in<br>            print(result)<br>        }<br>    }<br>}<br></pre><p><strong>appAccountToken</strong> must be a UUID, and we will need it in the backend. Firebase UID won’t work<strong>. </strong>You need to find a way to store it in your database (linked to the user account) and retrieve it in your app. <em>(I won’t cover this part in this article.) </em>You can use the npm uuid package. Personally, I generate it during the signup process.</p><h4>6. Send transaction info to the backend.</h4><p>Now I can unwrap the result and and retrieve some transaction information:</p><pre>import SwiftUI<br>import StoreKit<br><br>struct ContentView: View {<br><br>    var body: some View {<br>        SubscriptionStoreView(productIDs: [<br>            &quot;awesome_bronze_subscription&quot;,<br>            &quot;awesome_silver_subscription&quot;,<br>            &quot;awesome_gold_subscription&quot;<br>        ]).inAppPurchaseOptions({ product in<br>            return [.appAccountToken(<br>                UUID(uuidString: &quot;8ee94299-b2d7-4a35-aa92-96a1d1f4d01b&quot;)!<br>            )]<br>        })<br>        .onInAppPurchaseCompletion { product, result in<br>            do {<br>                switch result {<br><br>                case .success(let purchaseResult):<br><br>                    switch purchaseResult {<br><br>                    case .success(let transaction):<br>                        print(&quot;The transaction id : \(transaction.payloadValue.id)&quot;)<br>                    case .userCancelled:<br>                        print(&quot;user cancelled&quot;)<br>                    case .pending:<br>                        print(&quot;pending&quot;)<br>                    @unknown default:<br>                        print(&quot;default&quot;)<br>                    }<br>                case .failure(_):<br>                    print(&quot;Purchase failed&quot;)<br>                }<br>            } catch {<br>                print(error.localizedDescription)<br>            }<br>        }<br>    }<br>}</pre><p>We send the signed transaction to our server:</p><pre>import SwiftUI<br>import StoreKit<br><br>struct ContentView: View {<br><br>    func activateSubscription(jwsTransaction: String) async throws {<br><br>        let urlString = &quot;YOUR BACKEND URL HERE&quot;<br><br>        guard let url = URL(string: urlString) else {<br>            return<br>        }<br><br>        var urlRequest = URLRequest(url: url)<br><br>        urlRequest.httpMethod = &quot;POST&quot;<br><br>        let jsonObject: [String: String] = [<br>            &quot;jwsTransaction&quot;: jwsTransaction<br>        ]<br><br>        guard let jsonData = try? JSONSerialization.data(withJSONObject: jsonObject) else {<br>            return<br>        }<br><br>        urlRequest.setValue(&quot;application/json&quot;, forHTTPHeaderField: &quot;Content-Type&quot;)<br>        urlRequest.httpBody = jsonData<br><br>        let (data, response) = try await URLSession.shared.data(for: urlRequest)<br><br>        guard let httpResponse = response as? HTTPURLResponse else {<br>            throw URLError(.badServerResponse)<br>        }<br><br>        print(httpResponse.statusCode)<br><br>    }<br><br>    var body: some View {<br><br>        SubscriptionStoreView(productIDs: [<br>            &quot;awesome_bronze_subscription&quot;,<br>            &quot;awesome_silver_subscription&quot;,<br>            &quot;awesome_gold_subscription&quot;<br>        ]).inAppPurchaseOptions({ product in<br>            return [.appAccountToken(<br>                UUID(uuidString: &quot;8ee94299-b2d7-4a35-aa92-96a1d1f4d01b&quot;)!<br>            )]<br>        })<br>        .onInAppPurchaseCompletion { product, result in<br>            do {<br>                switch result {<br><br>                case .success(let purchaseResult):<br><br>                    switch purchaseResult {<br><br>                    case .success(let verifiedResult):<br><br>                        try await activateSubscription(<br>                            jwsTransaction: &quot;\(verifiedResult.jwsRepresentation)&quot;<br>                        )<br><br>                    case .userCancelled:<br>                        print(&quot;user cancelled&quot;)<br>                    case .pending:<br>                        print(&quot;pending&quot;)<br>                    @unknown default:<br>                        print(&quot;default&quot;)<br>                    }<br>                case .failure(_):<br>                    print(&quot;Purchase failed&quot;)<br>                }<br>            } catch {<br>                print(error.localizedDescription)<br>            }<br>        }<br>    }<br>}</pre><p>I repeat: <strong>This is just an example to demonstrate the process.</strong> In a real-world scenario, you should authenticate your user with a <strong>Bearer token</strong> and add a <strong>spinner</strong> to improve the UX during this operation.</p><h4>7. Verify Signed Transaction with your backend.</h4><p>Now, we can switch to our backend. <strong>I</strong> personally use Firebase Functions with TypeScript.</p><p>So, let’s create a Cloud Function for this.</p><pre>export const activateSubscriptionFromApp = onRequest((request, response) =&gt; {<br>    logger.info(&quot;In the activateSubscription&quot;)<br>    logger.info(request.body.jwsTransaction)<br>    response.status(200).send();<br>})</pre><p>Now, I need to verify the signed transaction. I assume that the user is already authenticated (with a Bearer token, for example) and that I have already retrieved their app account token from the database.</p><p>We could verify the signed transaction manually, but <strong>Apple provides a library</strong> to simplify the process (available in Swift, Java, Python, and Node).</p><p>Here is the documentation for Node.js:</p><p><a href="https://apple.github.io/app-store-server-library-node/">https://apple.github.io/app-store-server-library-node/</a></p><p>As you can see, there is a class named <strong>SignedDataVerifier</strong>. We will use the <strong>verifyAndDecodeTransaction</strong> method (not to be confused with <strong>verifyAndDecodeAppTransaction</strong>!).</p><p>Let’s install the library.</p><pre>npm install @apple/app-store-server-library --save</pre><p>Let’s instantiate a <strong>SignedDataVerifier</strong></p><pre>    let cert = fs.readFileSync(&quot;./AppleRootCA-G3.cer&quot;)<br>    let appleCertificates: Buffer[] = []<br>    appleCertificates.push(cert)<br><br>    const bundleId = &quot;app.AwesomeApp&quot;<br><br>    const environment = Environment.SANDBOX<br><br>    const enableOnlineChecks = true<br><br>    const appAppleId = undefined   // appAppleId is required when the environment is Production<br><br>    const verifier = new SignedDataVerifier(appleCertificates, enableOnlineChecks, environment, bundleId, appAppleId)</pre><ul><li>You need to obtain one or more Apple root certificates. I personally use the “G3” certificate<strong> </strong>(<a href="https://www.apple.com/certificateauthority/">https://www.apple.com/certificateauthority/</a>).</li><li>The bundle ID of your app</li><li>The environment (Don’t forget to set it to Environment.PRODUCTION in production)</li><li>enableOnlineChecks, set to true or false</li><li>appAppleId (can be undefined in the Sandbox environment). To find it, check out this guide:<a href="https://medium.com/@gatien.didry_61288/get-app-apple-id-ad95a173a024">https://medium.com/@gatien.didry_61288/get-app-apple-id-ad95a173a024</a>)</li></ul><p>Now we can verify signed transaction.</p><pre>export const activateSubscriptionFromApp = onRequest(async (request, response) =&gt; {<br>    logger.info(&quot;In the activateSubscription&quot;)<br><br>    if (!request.body.jwsTransaction) {<br>        response.status(422).send()<br>        return<br>    }<br><br>    // check user auth<br>    // ...<br><br>    // Instantiate SignedDataVerifier<br><br>    let cert = fs.readFileSync(&quot;./AppleRootCA-G3.cer&quot;)<br><br>    let appleCertificates: Buffer[] = []<br>    appleCertificates.push(cert)<br><br>    const bundleId = &quot;app.AwesomeApp&quot;<br><br>    const environment = Environment.SANDBOX<br><br>    const enableOnlineChecks = true<br><br>    const appAppleId = undefined   // appAppleId is required when the environment is Production<br><br>    const verifier = new SignedDataVerifier(appleCertificates, enableOnlineChecks, environment, bundleId, appAppleId)<br><br>    // Verify transaction <br><br>    const jwsTransaction = request.body.jwsTransaction<br>    const verifiedTansaction = await verifier.verifyAndDecodeTransaction(jwsTransaction)<br><br>    logger.log(verifiedTansaction)<br><br>    if (verifiedTansaction.expiresDate &amp;&amp; verifiedTansaction.expiresDate &gt; Date.now()) {<br>        logger.info(&quot;Activate subscription&quot;)<br>        logger.info(verifiedTansaction.productId) // subscription<br>        logger.info(verifiedTansaction.appAccountToken) // Verify that it correspond to the current user<br><br>        // Now you can update the subscription level in DB<br><br>        response.status(200).send();<br>        return;<br><br>    }<br><br>    logger.error(&quot;Subscription expired&quot;)<br>    response.status(403).send();<br>    return;<br>})</pre><p>Great work! You can now retrieve and process the response in your mobile app.</p><h4>8. Manage Upgrades (but Not Downgrades)</h4><p>But what happens if a user is already subscribed and decides to upgrade?</p><p><strong>Upgrade:</strong></p><p>Let’s do it. I am currently subscribed to <strong>Silver</strong> (<strong>medium level</strong>). Now, I go back to my app as a <strong>Silver subscriber</strong> and subscribe to the <strong>Gold</strong> offer.</p><p>After verifying the <strong>signed transaction</strong>, we receive this on our backend::</p><pre>{<br>appAccountToken: &quot;8ee94299-b2d7-4a35-aa92-96a1d1f4d01b&quot;<br>bundleId: &quot;app.AwesomeApp&quot;<br>currency: &quot;EUR&quot;<br>deviceVerification: &quot;...&quot;<br>deviceVerificationNonce: &quot;...&quot;<br>environment: &quot;Sandbox&quot;<br>expiresDate: 1738921329000<br>inAppOwnershipType: &quot;PURCHASED&quot;<br>originalPurchaseDate: 1738920822000<br>originalTransactionId: &quot;...&quot;<br>price: 9990<br>productId: &quot;awesome_gold_subscription&quot;<br>purchaseDate: 1738921149000<br>quantity: 1<br>signedDate: 1738921148922<br>storefront: &quot;FRA&quot;<br>storefrontId: &quot;143442&quot;<br>subscriptionGroupIdentifier: &quot;21606258&quot;<br>transactionId: &quot;...&quot;<br>transactionReason: &quot;PURCHASE&quot;<br>type: &quot;Auto-Renewable Subscription&quot;<br>webOrderLineItemId: &quot;...&quot;<br>}</pre><p>We can note that the <strong>productId</strong> has changed and the <strong>transactionReason</strong> is “PURCHASED”.</p><p>When a user upgrades their subscription, they are immediately upgraded and receive a refund for the prorated amount of their original subscription. So, we need to update our database immediately.</p><p><strong>Downgrade:</strong></p><p>Now, we are Gold subscribers on our awesome app. What happens if we downgrade to the Bronze subscription?</p><p>Let’s do it. After the downgrade, we receive this on our backend:</p><pre>{<br>appAccountToken: &quot;8ee94299-b2d7-4a35-aa92-96a1d1f4d01b&quot;<br>bundleId: &quot;app.AwesomeApp&quot;<br>currency: &quot;EUR&quot;<br>deviceVerification: &quot;...&quot;<br>deviceVerificationNonce: &quot;...&quot;<br>environment: &quot;Sandbox&quot;<br>expiresDate: 1738921509000<br>inAppOwnershipType: &quot;PURCHASED&quot;<br>originalPurchaseDate: 1738920822000<br>originalTransactionId: &quot;...&quot;<br>price: 9990<br>productId: &quot;awesome_gold_subscription&quot;<br>purchaseDate: 1738921329000<br>quantity: 1<br>signedDate: 1738921345105<br>storefront: &quot;FRA&quot;<br>storefrontId: &quot;143442&quot;<br>subscriptionGroupIdentifier: &quot;21606258&quot;<br>transactionId: &quot;...&quot;<br>transactionReason: &quot;RENEWAL&quot;<br>type: &quot;Auto-Renewable Subscription&quot;<br>webOrderLineItemId: &quot;...&quot;<br>}</pre><p>We can see that the <strong>productId</strong> does not change, and the <strong>transactionReason</strong> is “RENEWAL”.</p><p>In fact, when a user downgrades (or cancels) their subscription, the change takes effect <strong>at the end of the current billing period</strong>. For example, if a user subscribes for one month, the downgrade will only take effect at the end of that month.</p><p>So, for an upgrade, we need to immediately update our database, but for a downgrade, we don’t update anything in this function.</p><p>To determine the correct action, we need to check both the <strong>transactionReason</strong> and <strong>productId</strong>.</p><h4>9. A Clarification for RevenueCat</h4><p>I have already used this framework, and I couldn’t find a way to retrieve the <strong>transaction</strong> in <strong>JWS format</strong> (even though we can see it in the logs).</p><p>So, to achieve the same functionality with RevenueCat, you can <strong>send the </strong><strong>transactionId</strong> and make an <strong>API call to the App Store Server</strong>.</p><figure><img alt="The pseudo-sequence diagram illustrates how the subscription process works. First, the app communicates with Apple’s server to retrieve subscription details. Then, when a user makes a purchase, the app calls your personal server and sends the transactionId to your personal server. Your personal server can call App Store api to check the subscription status." src="https://cdn-images-1.medium.com/max/1024/1*u2CU3IwkoYSDRLupXfUXXw.png" /></figure><p>With the <strong>transactionId</strong>, we can check the <strong>subscription status</strong> using <strong>Get All Subscription Statuses</strong>: <a href="https://developer.apple.com/documentation/appstoreserverapi/get-v1-subscriptions-_transactionid_">https://developer.apple.com/documentation/appstoreserverapi/get-v1-subscriptions-_transactionid_</a></p><p>We need to <strong>instantiate</strong> AppStoreServerAPIClient and call <strong>getAllSubscriptionStatuses</strong>, passing:</p><ul><li>The <strong>transactionId</strong></li><li>An array containing <strong>1</strong> (which corresponds to active subscriptions)</li></ul><pre>// I&#39;ll show how to instantiate AppStoreServerAPIClient in the part 2 of this article <br>const client = new AppStoreServerAPIClient(encodedKey, keyId, issuerId, bundleId, environment)<br><br>        // corresponding to the active subscription status<br>        const APP_STORE_SUBSCRIPTION_STATUS = 1<br><br>        let activeSubscriptionStatuses = await client.getAllSubscriptionStatuses(transactionID, [APP_STORE_SUBSCRIPTION_STATUS])<br><br>        // if activeSubscriptionStatuses.data is empty, there aren&#39;t any active subscription<br>        if (!activeSubscriptionStatuses.data || (activeSubscriptionStatuses.data.length == 0)) {<br>            response.status(HTTPResponse.FORBIDDEN).send()<br>            return<br>        }<br><br>        for (const transactionActiveSubscriptions of activeSubscriptionStatuses.data) {<br><br>            logger.info(transactionActiveSubscriptions.lastTransactions)<br><br>            if (transactionActiveSubscriptions.lastTransactions &amp;&amp; transactionActiveSubscriptions.lastTransactions.length &gt; 0 &amp;&amp; transactionActiveSubscriptions.lastTransactions[0].signedTransactionInfo) {<br><br>                let verifiedTransactionSubscription = await verifier.verifyAndDecodeTransaction(transactionActiveSubscriptions.lastTransactions![0].signedTransactionInfo)<br><br>                 // All the data you need is verifiedTransactionSubscription<br>                  <br><br>                response.status(HTTPResponse.OK).send()<br>                return<br>            }<br>        }<br>        response.status(HTTPResponse.OK).send()<br>        return</pre><p>Now, I will explain how to <strong>manage subscriptions</strong>, especially <strong>downgrades</strong> and <strong>expired subscriptions</strong>, using <strong>App Store Server Notifications</strong>. You can find the article here:<br><a href="https://medium.com/@gatien.didry_61288/manage-your-ios-subscriptions-in-your-backend-with-app-store-server-notifications-fb9708ca77e7">https://medium.com/@gatien.didry_61288/manage-your-ios-subscriptions-in-your-backend-with-app-store-server-notifications-fb9708ca77e7</a></p><p>Thanks for reading! 😊</p><p>Feel free to comment on this article and <strong>connect with me on </strong><a href="https://www.linkedin.com/in/gatiendidrymobileappdeveloper/"><strong>LinkedIn</strong></a>! 😃</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7c05cea3d575" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Get App Apple ID]]></title>
            <link>https://medium.com/@gatien.didry_61288/get-app-apple-id-ad95a173a024?source=rss-d8e61fa16ade------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad95a173a024</guid>
            <category><![CDATA[development]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[swiftui]]></category>
            <dc:creator><![CDATA[Gatien Didry]]></dc:creator>
            <pubDate>Fri, 07 Feb 2025 08:30:42 GMT</pubDate>
            <atom:updated>2025-02-07T08:31:41.924Z</atom:updated>
            <content:encoded><![CDATA[<p>To get App Apple ID,</p><ul><li>connect to App Store Connect</li><li>-&gt; Apps</li><li>-&gt; choose your app</li><li>-&gt; App Information</li></ul><figure><img alt="A screenshot of App Store Connect dashboard showing App Information Button on the left menu" src="https://cdn-images-1.medium.com/max/1024/1*Wy4pTSWy_MME7fxxwd0JCw.png" /></figure><ul><li>&gt; General information</li><li>-&gt; Apple ID</li></ul><figure><img alt="A screenshot showing Apple ID section in App Store Connect Dashboard" src="https://cdn-images-1.medium.com/max/1024/1*VVWfOQS_Vvm1g7vYQY_HQA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad95a173a024" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Loneliness Economy]]></title>
            <link>https://medium.com/@gatien.didry_61288/the-loneliness-economy-68a5a4fcbce9?source=rss-d8e61fa16ade------2</link>
            <guid isPermaLink="false">https://medium.com/p/68a5a4fcbce9</guid>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[loneliness]]></category>
            <category><![CDATA[business]]></category>
            <dc:creator><![CDATA[Gatien Didry]]></dc:creator>
            <pubDate>Tue, 28 Jan 2025 10:22:47 GMT</pubDate>
            <atom:updated>2025-01-28T10:22:47.721Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="A person walking alone in a city with people around" src="https://cdn-images-1.medium.com/max/1024/1*guCh0zsx4IuqeOz_Ua0x6g.png" /></figure><p>Do you wonder how you can meet new people?</p><p>Today, I’m 26 years old. I finished my studies two years ago and currently live in Bordeaux, France. Like many of my friends, I’ve noticed that when you leave school, you automatically lose a large part of your social life. Some friends move away to work in other cities, and while you can occasionally gather for events like paddle tennis or soccer games, over time, you may start wondering: <strong>How can I meet new people?</strong></p><p>When I left my parents’ home, I moved to a city where I didn’t know anyone. I was truly alone. The first two months were not easy because I didn’t have any friends yet (at the time, my classmates were just acquaintances). I tried meeting people for drinks through city student Facebook groups. The people I met were nice, but they didn’t become my friends. You share a drink and quickly realize that you don’t have common hobbies. The conversations feel shallow, and I can assure you that while you might try this a couple of times, you’ll eventually stop going.</p><p>I’m truly convinced that having shared memories is a key part of building friendships. To create those memories, you need to share experiences with others, like playing sports, working on school projects, gaming, or making music together. Simply meeting at a bar isn’t enough to create meaningful connections. <strong>Building friendships takes time.</strong> The best way to foster them is to participate in regular activities. For example, joining a sports club is a great way to make friends. When sessions are scheduled at the same time every week, like playing badminton every Tuesday at 8 p.m., it forces you to show up. Over time, you’ll see the same people regularly and build lasting friendships. This approach works not just for sports but also for activities like music, theater, and more.</p><h3>Are You a Member of a Sports Club?</h3><p>I’ve noticed that many people are not. Why is that?</p><p>Because joining a club requires commitment, and that comes with constraints. For example, if you play handball, you’re expected to be available for matches on weekends. That can be a barrier for people aged 25–35, who often have other priorities. They might need to renovate their homes, travel to visit friends and family, attend apartment viewings, or simply want a moment for themselves without having to set an alarm on a Saturday morning.</p><p>I believe people today are seeking more freedom. Thanks to remote work, food delivery apps, ride-hailing services like Uber, and similar conveniences, people have more control over their schedules. And I think that’s a good thing. People are becoming more independent and can do more on their own. AI will likely accelerate this trend.</p><p>But here’s the irony: <strong>People still feel lonely.</strong> The need for belonging is the third pillar of Maslow’s hierarchy of needs. Many people, especially those who have just moved to a new city, struggle to find their group and integrate into a community — for the reasons I mentioned earlier.</p><h3>Running Clubs: A Solution to Loneliness?</h3><p>I’ve been part of a running club, and when I talk to others there, I keep hearing the same thing:<br><em>“I joined to do sports and to meet people.”</em></p><p>And it’s not about dating or finding a romantic relationship — it’s about belonging to a group. Running is particularly interesting because it allows you to talk to others during training, yet it’s still an individual sport, so you’re not dependent on anyone else. Plus, it’s great for your health.</p><h3>The Future of the Loneliness Economy</h3><p>I truly believe we’ll see a wave of startups addressing the loneliness economy. Companies like <strong>Timeleft</strong> are pioneers in this space. It’s an emerging and fascinating trend.</p><p>While I don’t currently have a startup project or idea related to this, writing this article has helped me clarify my thoughts.</p><p>Feel free to connect with me on <a href="https://www.linkedin.com/in/gatiendidrymobileappdeveloper/">LinkedIn</a> if you’d like to discuss this topic further or share your thoughts. I’m always happy to connect and exchange ideas!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=68a5a4fcbce9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The F**** 2K Erg Test]]></title>
            <link>https://medium.com/@gatien.didry_61288/the-f-2k-erg-test-daf1143b213f?source=rss-d8e61fa16ade------2</link>
            <guid isPermaLink="false">https://medium.com/p/daf1143b213f</guid>
            <category><![CDATA[endurance]]></category>
            <category><![CDATA[competition]]></category>
            <category><![CDATA[mindset]]></category>
            <category><![CDATA[sports]]></category>
            <category><![CDATA[rowing]]></category>
            <dc:creator><![CDATA[Gatien Didry]]></dc:creator>
            <pubDate>Wed, 11 Dec 2024 10:58:01 GMT</pubDate>
            <atom:updated>2024-12-11T10:58:01.243Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Screen of a progressiv 2K work on ergometer. Made in 6min 10.6." src="https://cdn-images-1.medium.com/max/1024/1*49H5yf3lh_XTPwKteSxt_w.jpeg" /><figcaption>The ‘B4’: A progressive 2K workout done one week before the erg test in the French training program.</figcaption></figure><p>Before starting, let me introduce myself.<br>I’m Gatien, a <strong>French</strong> <strong>entrepreneur</strong> with a background in software engineering. I build mobile apps, and I’m in a committed relationship — with rowing. <strong>I was a high-level athlete</strong> for four years (2016–2020), during which I competed at the U23 World Rowing Championships with the French national team and became a multiple-time French champion.</p><p>In 2020, <strong>I decided to end my high-level sports career to continue my studies </strong>in software engineering and pursue a job. Today, I strive to balance my entrepreneurial ambitions with my personal life and passion for rowing. I want to explore how far I can push my performance while living a typical entrepreneur’s life — without the advantages I had during my competitive years.</p><p>Every year, we have two 2K erg tests: one at the beginning of December and another in February. I believe the December test is the most important. It’s the first test, and it’s incredibly difficult to improve upon it by February.</p><p>My goal for the upcoming 2K test is to go under <strong>6:05</strong>. That’s <strong>ten seconds slower</strong> than my personal best of <strong>5:55.7</strong>, which I achieved during my high-level sports period.</p><p>In France, we follow a specific protocol to prepare for this test. One week before, we perform the <strong>“B4”</strong>, a progressive 2K workout structured as follows:</p><ul><li><strong>1000 meters</strong> at <strong>24 strokes per minute</strong></li><li><strong>500 meters</strong> at <strong>28 strokes per minute</strong></li><li><strong>500 meters</strong> at <strong>32 strokes per minute</strong></li></ul><p>If you respect the pace during the “B4” workout, you can aim to be <strong>10 seconds faster</strong> on the actual 2K test. I really like this workout: it’s fast, not too difficult, and gives useful insights about your current form. If I can complete it in under <strong>6:15.0</strong>, that’s a good sign. As you can see in the picture, I did <strong>6:10.7</strong>. This is great for me — I’m in good form. Now, I just need to shave off <strong>6 more seconds</strong> with a bit of extra effort, and I can realistically aim for a <strong>6:02</strong> or even a <strong>6:01</strong> on test day.</p><p>Two days later, we do a <strong>1000-meter free-pace</strong> piece. I like to aim for a pace that’s <strong>2 seconds faster per 500 meters</strong> than my goal for the actual 2K test. This makes the workout challenging but manageable. It’s an effective way to push the pace closer to race-day reality.</p><p>Since my goal for the 2K test is <strong>1:30–1:31 per 500 meters</strong>, I aim for <strong>1:28–1:29 per 500 meters</strong> in this 1000-meter workout.</p><figure><img alt="A picture of a erg screen showing a 1000 meters result made in 2:55.4 (1:27.7/500)" src="https://cdn-images-1.medium.com/max/1024/1*FqaXtcFXroT6Xj7qeYD4FA.jpeg" /><figcaption>The result of the 1000-meter free-pace workout.</figcaption></figure><p>I reached my goal — not easily, but without too much difficulty either. At this point, <strong>all the lights are green</strong> for test day.</p><p>On the big day, I woke up feeling pretty good. I’d had a cold for the past two days, but I was hopeful that my consistent <strong>8 hours of sleep</strong> each night over the past week would help. The real <strong>2K test</strong> was organized at my club as a competition. All the ergs were linked, and we could see each other’s performances. This setup is great for winning medals, but not always ideal for pure performance because:</p><ul><li>There are <strong>a lot of people</strong>, and it gets hot.</li><li>It’s <strong>very noisy</strong>.</li><li>You can’t see all your data at once. You have to choose between viewing your <strong>average speed</strong> or your <strong>projected finish time</strong> — which can be tricky when you’re aware of other rowers who are either faster or slower than you.</li></ul><p><strong>“Attention… Ready?”</strong><br><strong>Biiiiiip!</strong> And it began.</p><p>I started with a powerful sprint, going full speed for the first <strong>four strokes</strong>, then settled into my target rhythm of <strong>1:30–1:31 per 500 meters</strong>. The first 500 meters felt manageable — not easy, but not overwhelming, and not too fast. I saw myself take the lead in the race, just as I had planned.</p><p>At <strong>800 meters</strong> (with <strong>1200 meters to go</strong>), my legs started to feel heavy as the <strong>lactic acid</strong> kicked in. I knew that the second 500 meters is the point where the first warning signs — the red lights — start to flash. During my best erg tests, I treated this phase like the first storm, believing a second wind would come after another <strong>200 or 300 meters</strong>. So, I told myself, <strong>“Just stay at your average power. If I’m one second slower, it’s okay.”</strong></p><p>The problem? <strong>The storm never passed.</strong><br>Worse still, negative thoughts started creeping in:</p><ul><li>“F***, this is so difficult.”</li><li>“This is so boring.”</li><li>“Why am I doing this?”</li><li>“I’m 60 meters ahead of the second-place rower. I can ease up and still win.”</li></ul><p>All these negative thoughts stayed with me until the finish line. My average speed got progressively slower: <strong>1:29.8 → 1:31.0 → 1:34.2 → 1:38.5</strong>. I finished the erg test in <strong>6:13.5–3 seconds slower</strong> than my B4 workout from a week before.</p><p>At the end, I felt <strong>very frustrated</strong>. This isn’t the first time I’ve performed worse than my B4 test from a week earlier. I don’t know why I keep getting stuck like this. I used to be great at this exercise, but now I’m not. Maybe the fact that it was a contest, or that I was a little sick, didn’t help. However, I know those aren’t the main reasons.</p><p>I feel like, in the past, I needed to prove myself — to my parents, my coaches, my friends, my competitors, and the French Rowing Federation. Back then, all my effort was focused on winning international medals. That kind of motivation gave me an incredible amount of energy for a 2K test.</p><p>Today, my goal is different. I want to see how far I can push myself and become <strong>a better version of myself</strong>. Of course, I still want to approach <strong>6 minutes for 2000 meters</strong> and, someday, get back under that mark. Even more, I want to surpass my personal best with all the knowledge I’ve gained since <strong>2019</strong>.</p><p>It’s not the same feeling when I’m racing against other boats in rowing. I have the <strong>ego</strong> to want to be faster than them, and that ego pushes me to be stronger. When my competitors are around, my ego is naturally stimulated. But it’s not the same on the erg.</p><p>Since I got a job, I’ve become less extreme with myself when it comes to sports performance. Before, if I didn’t hit the times I expected during training, I would get really frustrated. Now, I think it’s more acceptable to finish a session slower than planned than to quit entirely, as I might have done before. It’s not the same mindset, and I think my mindset today is better. I have more experience, and I’m still curious and motivated to explore new ways to train.</p><p>The <strong>B4 workout</strong> gave me a lot of confidence about how I train now. However, I still faced a setback with the 2K erg test, and I don’t have a solution yet. I know I need to reduce negative thoughts, but how?</p><p>Feel free to comment on this article and share any advice or solutions that could help me overcome this challenge.</p><p>I’m passionate about bringing ideas to life through mobile apps. If you have a project in mind, <a href="https://www.linkedin.com/in/gatien-didry-8a4855188/">let’s connect</a> and explore how we can make it happen together.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=daf1143b213f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why You’re Afraid to Sell as a Tech Founder (and Why Selling Is at the Heart of Every Business)]]></title>
            <link>https://medium.com/@gatien.didry_61288/why-youre-afraid-to-sell-as-a-tech-founder-and-why-selling-is-at-the-heart-of-every-business-e12b43bbe95a?source=rss-d8e61fa16ade------2</link>
            <guid isPermaLink="false">https://medium.com/p/e12b43bbe95a</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[entrepreneurship]]></category>
            <category><![CDATA[cto]]></category>
            <category><![CDATA[entrepreneur]]></category>
            <category><![CDATA[selling]]></category>
            <dc:creator><![CDATA[Gatien Didry]]></dc:creator>
            <pubDate>Mon, 04 Nov 2024 10:01:41 GMT</pubDate>
            <atom:updated>2024-11-04T10:01:41.988Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="A man working at his desk" src="https://cdn-images-1.medium.com/max/1024/1*9cRI8vkUD8Qn41rjG-skMg.png" /></figure><p>A few days ago, I celebrated my first year as a full-time entrepreneur. It felt like the perfect time to reflect on and share what I’ve learned about entrepreneurship as a software engineer.</p><p>Today, I’ll explain why selling is the most important part of a business — even more than the product or anything else. I’ll also share some tips on how you can become more comfortable with selling.</p><p>When I first started creating mobile apps as a software engineer, my focus was entirely on the product. To me, the most important part of a tech business was software engineering, and other roles existed only to help the product sell better. In my mind, other functions weren’t essential to the business — a tech team could develop and launch a product on its own.</p><p>I was wrong. Maybe it was because there was a shortage of software engineers at the time, and software engineers were considered the company’s ‘rockstars.’ I’m not sure, but it doesn’t really matter. I started developing my mobile apps, and the first one was targeted at sports clubs. I built the project, thinking it would take off as soon as I put it on the store. Some random people installed it, created accounts, used the core feature once, and… that was it.</p><p>I remember asking a non-tech friend how I could attract people to my app. He replied that this was the biggest challenge of any business. That answer really struck me. My belief was:</p><p>company = building a product + accounting (and a little bit of marketing but not necessarily).</p><p>I was wrong.</p><p>After that, I considered promoting my app on social media. My guess was that I’d need to pay to get my first hundred users, and then growth would happen naturally through word of mouth. But I didn’t know where to start. Should I use Meta ads or Google ads? I asked an experienced executive at an app studio, and he replied, ‘If I were you, I wouldn’t spend on ads. I’d contact clubs directly and test the app with them. It’s free.’</p><p>No way — I was too afraid. What would they think of the product? I worried they’d think it was terrible and that I’d wasted their time.</p><p>I didn’t take this project further. Instead, I got an opportunity to work on a real estate mobile app. I saw the potential to create something innovative with technology, but I felt that talking to users and selling wasn’t my strength. So, to solve this problem, I decided to delegate sales to a commercial partner. In my mind, the equation was simple:<br>I build the product → my partner sells it → we make a lot of money 🤑.</p><p>But it didn’t work out. The failure was entirely my fault — not my partner’s.</p><p>Over time and with a lot of trial and error, I learned a few valuable lessons. My goal with this article is to help you remember these important things:</p><p><strong>A product exists because it solves a problem — not the other way around</strong>. If you build your product before studying the problem, you’ll end up with a product that isn’t useful. Nobody will care about it except you.</p><p><strong>You don’t know people’s problems; you only have hypotheses.</strong> Humans are very good at assuming others share the same problems they do. If you think you’re building a product with no competition, or if you believe your product is in a ‘blue ocean,’ you need to be careful. Often, the market doesn’t exist — it’s not a blue ocean at all. Contact your prospects. Help them. Be genuinely interested in them. There are many ways to connect with people (LinkedIn, Reddit, Facebook, in-person events, etc.). Find out the best approach for your business.</p><p><strong>Sales are a good thing. Don’t be afraid — you aren’t a scammer.</strong> Selling isn’t a scam. You build a product to help your prospects save money or time. You provide them with so much value that they are willing to pay for it. This is how I view sales now, and it has really helped me feel more confident when I prospect.”</p><p><strong>You need to sell before building the product.</strong> Selling validates that a problem exists; it’s the product/market fit validation. In France, we have a proverb: ‘Il ne faut pas vendre la peau de l’ours avant de l’avoir tué’ (which translates to ‘You shouldn’t sell the bear’s skin before you’ve killed the bear’). But in the startup world, we don’t kill bears, we need to adapt this proverb to say: ‘You need to sell your product before building it.’</p><p><strong>As a CEO, you need to be the first salesperson in your company.</strong> You sell your vision to your team, your company to potential candidates, and your product to prospects. Selling is everywhere. When you don’t have a track record, selling is how people place their trust in you and your project. They buy or join because they resonate with your vision.</p><p><strong>Sales are the heart of every business.</strong> Selling is the link between your company and your customers. It provides you with valuable information about the market, your position, your evolution, and more. As a CEO, throughout your journey, you will need to sell continuously.</p><p><strong>Don’t worry, selling is hard.</strong> It takes time. As Guillaume Moubeche said,<br>sales = timing * trust.<br>Sometimes, you might not be in the right timing, or people may not trust you yet. That’s why, in companies, sales roles often have a variable salary component. Selling is challenging and not as straightforward as other jobs in the company.</p><p>Thanks for reading! Feel free to connect with me on <a href="https://www.linkedin.com/in/gatien-didry-8a4855188/">LinkedIn</a> 😃✌️.</p><p>I’m passionate about bringing ideas to life through mobile apps. If you have a project in mind, <a href="https://www.linkedin.com/in/gatien-didry-8a4855188/">let’s connect</a> and explore how we can make it happen together.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e12b43bbe95a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why You Shouldn’t Build a Startup Around Your Own ‘Revolutionary’ Idea]]></title>
            <link>https://medium.com/@gatien.didry_61288/why-you-shouldnt-build-a-startup-around-your-own-revolutionary-idea-79d7e9bfa01f?source=rss-d8e61fa16ade------2</link>
            <guid isPermaLink="false">https://medium.com/p/79d7e9bfa01f</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[entrepreneurship]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[tech]]></category>
            <dc:creator><![CDATA[Gatien Didry]]></dc:creator>
            <pubDate>Mon, 28 Oct 2024 09:14:12 GMT</pubDate>
            <atom:updated>2024-11-01T08:37:10.954Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="A drawed rocket on a wall" src="https://cdn-images-1.medium.com/max/1024/1*u7mSs-f2p50wf3HZsQb3IQ.png" /></figure><p>A few days ago, I celebrated my first year as a full-time entrepreneur. It felt like the perfect time to reflect on and share what I’ve learned about entrepreneurship as a software engineer.</p><p>In this article, I’ll explain why, in my opinion, ideas aren’t the key to building a successful business — and why revolutionary ideas usually don’t work.</p><p>About two years ago, I had a startup idea. I discovered a powerful iOS development tool that could scan apartments and rooms to create 3D floor plans. I thought this tool was incredible, and I was sure I could build an app around it. Maybe an app to help real estate agencies? Great idea! But how exactly? Could I export the 3D plans to the web to create virtual tours like the ones already used on real estate websites? I decided to build a proof of concept to see if the project was technically feasible. After a few days of work — success! It worked. This project had real potential.</p><p>At this point, I hadn’t spoken to any real estate agencies yet. My employer, Orange, along with other large companies, organized an entrepreneurship contest for apprentices like me. The contest included two pitch sessions, each followed by questions. I put together a solid presentation to increase my chances of being selected and discussed my project with a friend who worked as a real estate agent. I passed the first pitch session and was selected for the finals two months later. A colleague at Orange, whose job was to support employees in building their own businesses, offered me some advice. The first thing she said was, ‘<strong>You need to talk to your users.</strong>’ She became my mentor for the contest — and for my project.</p><p>She was absolutely right. Aside from my friend, I had only imagined my project in my own mind and hadn’t considered whether real estate agencies actually needed it. I assumed that real estate agents used virtual tours, and since I was building a similar solution, I thought there was a clear need. To sell my product, I figured I just needed to find a sales associate because that wasn’t within my skill set.</p><p>My mentor gave me two weeks to meet with real estate agencies. I approached this with a lot of fear. I visited agencies to speak with real estate agents in person for two main reasons:</p><ul><li>To ask why they don’t use virtual tours for all real estate properties.</li><li>To show them my proof of concept.</li></ul><p>Every time I opened the door, I felt extremely scared. It took a lot of my energy, and I was very anxious. Was it the right time? Would I disturb them? What would they think of my product?</p><p>I think I did about five visits — not more. It was too intimidating and draining. I fulfilled my goal of talking to real estate agents.</p><p>Out of the five doors I knocked on, I was able to speak with four real estate agents and one secretary. None of them were unkind; in fact, they were really nice. I introduced myself as a student working on an entrepreneurial project, explained what my project was about, and demonstrated the product. There were a few ‘wow’ moments, and they generally said my product was impressive and that they wanted to try it. I asked my questions and left without taking any contact information.</p><p>After that, I found a sales associate. I didn’t win, but I made it far in the entrepreneurship contest. I continued my journey by coding the product, all while remaining comfortable and sheltered from reality without speaking to my target audience.</p><p>When I released the product, I contacted the real estate agents I had met. I tried Google Ads and reached out to Quebecois real estate agents and interior designers…</p><p>I didn’t sell anything, and neither did my sales associate. Some users visited the app through ads, but none purchased the premium features. I couldn’t understand why. Some of them told me the product was incredible. It took several weeks before I realized the mistakes I had made. I thought my idea was groundbreaking and innovative, and that I would revolutionize the real estate industry. But in reality, I hadn’t built this product for my target audience. I hyped myself up, believing it was a good idea, without truly considering my future customers. When I met prospects to show them the project, they were kind. Maybe they didn’t want to discourage me, or perhaps they didn’t realize they wouldn’t use my product. I don’t know. My key learnings from this period are:</p><ul><li>Real market validation occurs when users pay — not before. (Though I could be more nuanced for certain types of businesses, like social media.)</li><li>You need to talk to users and learn about their problems.</li><li>Don’t discuss your idea before listening to your target audience’s problems, as it will create a bias.</li><li>Understand that you are trying to help your target audience. You need to offer them so much value that they will pay for it. Stop viewing commercial relationships as scams (is this a French bias?).</li><li>There are effective ways to reach out to your target audience; you need to find the best methods (LinkedIn, in person, Instagram, Reddit, Meetup).</li></ul><p>I then discovered that this is a very common mistake among young entrepreneurs (at least in France). The basic storytelling often goes: ‘I saw this problem, I started coding a solution on a Sunday afternoon, and I became a millionaire.’ I think it’s easier and quicker to convey the vision of a company this way, but it’s not (entirely) true. In my opinion, <strong>humans are naturally egocentric</strong>; they believe others think and behave as they do, often failing to envision how others perceive things. Entrepreneurs need to understand their markets to <strong>find product-market fit</strong> (PMF). In many cases, when people build an idea-based project, there may be a good product, but not necessarily a good market to support it. I have never heard anything about PMF in entrepreneurship storytelling. Creating a market like Uber is possible, but it costs a lot of money, and there’s no guarantee it will work. Do you know how many startups raised money to create a market and ultimately failed? We only hear about the successful companies.</p><p>The message I want to convey is that you need to build people-based projects, not idea-based ones. Be genuinely interested in your target audience. Talk to them, don’t just share your idea; learn about their problems. Help them and care about their needs.</p><p>Feel free to give me feedback and connect with me on <a href="https://www.linkedin.com/in/gatien-didry-8a4855188/">Linkedin</a>.</p><p>I’m passionate about bringing ideas to life through mobile apps. If you have a project in mind, <a href="https://www.linkedin.com/in/gatien-didry-8a4855188/">let’s connect</a> and explore how we can make it happen together.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=79d7e9bfa01f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Starting a Business Full-Time or Getting a Job: My Journey as a Young Entrepreneur]]></title>
            <link>https://medium.com/@gatien.didry_61288/starting-a-business-full-time-or-getting-a-job-my-journey-as-a-young-entrepreneur-4439051bba00?source=rss-d8e61fa16ade------2</link>
            <guid isPermaLink="false">https://medium.com/p/4439051bba00</guid>
            <category><![CDATA[entrepreneurship]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[graduate-school]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Gatien Didry]]></dc:creator>
            <pubDate>Mon, 21 Oct 2024 08:36:07 GMT</pubDate>
            <atom:updated>2024-11-01T08:30:40.602Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tSklGKa8LfTm1wEevoN6jA.png" /></figure><p>A few days ago, I celebrated my first year as a full-time entrepreneur. It’s a great moment to reflect and share what I’ve learned about entrepreneurship.</p><p>In this article, I’ll explain how and why I decided to launch a startup after finishing my studies.</p><p>One year ago, I finished my studies with a master’s degree in software engineering. For the last three years, I worked as an apprentice (in France, you can study and work as an employee at the same time through apprenticeship). I spent one year working at a startup and two years at a large company (Orange).</p><p>In 2021, when I started applying for jobs, I made a lot of mistakes. For example, I sent my CV with a link to my personal website, which hadn’t been published yet (I already had the ‘shipfast mindset’ 🤣), and my GitHub wasn’t updated. Many attractive companies rejected me and chose my friends instead — and that was totally understandable.</p><p>So, in September 2022, one year before the end of my contract with Orange, I knew that I had to take action to be ready for the best job offers in a year’s time:</p><ul><li>I worked on a few small iOS UI projects, which I found very important because you can showcase your work to tech recruiters in real-time — it’s very ‘visual.’ Back-end developers don’t have the same advantage.</li><li>I attended a few meetups, mainly in Bordeaux, and sometimes in Paris on Tuesdays. I would take the train on Tuesday afternoons from Bordeaux to attend Cocoaheads Paris in the evening. Then, I’d stay at a friend’s place (thanks, Lucas!) and catch the first train at 5:30 a.m. to make it back to school in Bordeaux by 9 a.m.<br>I remember one time when the train and bus drivers in France were on strike, and many trains were canceled. It was chaos, but I still managed to get to Paris and attend the conference. I think half of the other developers couldn’t make it, which gave me a great opportunity to talk with some (lead) developers I wouldn’t normally have had the chance to meet. <strong>From chaos, opportunities appeared.</strong></li><li>I built a personal project that I published on the app store: a mobile app to manage sports club training schedules. Through this project, I explored various technologies. I developed the backend with Laravel, set up the deployment pipeline, and built the mobile app using React Native, publishing it on both Google Play and the App Store.</li></ul><p>Then, I started to wonder, what is my ‘ideal’ company? Where do I really want to go? This was a conversation I had many times with my friends from graduate school. Who is your ideal employer, and why? It’s not an easy question to answer.<br>I have a friend whose goal was to work for Apple. He’s really ambitious and works hard for it. When he talks about Apple, he’s so passionate and engaging that I almost believed I wanted to be an Apple employee too — until I discovered another attractive company, and then another, and so on. I was constantly surrounded by noise, with so many amazing opportunities catching my attention. At the same time, entrepreneurship was always on my mind.</p><p>So, during April and May 2023, I wrote down all possible choices on post-it notes and classified my ideal companies. For most of the companies, it was very clear in my mind. However, it was less clear for the most attractive companies. At first, I prioritized the companies over entrepreneurship, thinking it was impossible for a young developer like me to work for them. But then I began to wonder, ‘What if it’s possible?’ and ‘What would happen if I had the opportunity to join one of them?’<br>There are two sides to this question. On one side, I could join a great team with exciting products and excellent salary benefits. On the other side, I want to build my own business, and I might feel frustrated not being able to do that while working as an employee. I was 25, didn’t have children, and could experiment with ideas without significant repercussions. If I joined a company as an employee, my personal situation might be different two years later (I might buy an apartment or a house and become indebted). Additionally, in France, after completing an apprenticeship, you can receive financial support from the government to get a job or start a business. If I took the employee opportunity, I wouldn’t have that financial support afterward.</p><p>One week before the end of my contract at Orange, some completely unexpected great opportunities from attractive companies appeared. At that moment, I had already made the decision to work full-time on my business. I reconsidered these opportunities, and even though I was very grateful to be in the process of accessing those jobs, I stood by my decision. Since then, I have had the time to make many mistakes and learn from them, but I don’t have any regrets.</p><p>Thanks for reading! Feel free to connect with me on <a href="https://www.linkedin.com/in/gatien-didry-8a4855188/">LinkedIn</a> 😃✌️.</p><p>I’m passionate about bringing ideas to life through mobile apps. If you have a project in mind, <a href="https://www.linkedin.com/in/gatien-didry-8a4855188/">let’s connect</a> and explore how we can make it happen together.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4439051bba00" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>