<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Yusuke Kawabata</title>
    <description>The latest articles on Forem by Yusuke Kawabata (@ku_suke).</description>
    <link>https://forem.com/ku_suke</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F637241%2Fb3230cae-914c-452b-9c93-57e8a4564ee0.jpg</url>
      <title>Forem: Yusuke Kawabata</title>
      <link>https://forem.com/ku_suke</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/ku_suke"/>
    <language>en</language>
    <item>
      <title>A Note to Developers: Considerations for Using "Acme" in Japanese Market</title>
      <dc:creator>Yusuke Kawabata</dc:creator>
      <pubDate>Fri, 12 Jan 2024 12:09:46 +0000</pubDate>
      <link>https://forem.com/ku_suke/a-note-to-developers-considerations-for-using-acme-in-japanese-market-3p75</link>
      <guid>https://forem.com/ku_suke/a-note-to-developers-considerations-for-using-acme-in-japanese-market-3p75</guid>
      <description>&lt;p&gt;Hello, Dev.to community! In this post, I'd like to discuss a significant cultural aspect concerning the use of the term "Acme," particularly when your products or content are intended for users in Japan.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Global Understanding of "Acme"
&lt;/h2&gt;

&lt;p&gt;"Acme" is a term well-recognized in many parts of the world as representing the pinnacle or peak, often associated with the highest level of quality or achievement. Its popularization can be largely attributed to the fictional "Acme Corporation" from the Looney Tunes cartoons, epitomizing a generic, universal business entity. This term is humorously embedded in Western media and culture.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Different Meaning of "Acme" in Japan
&lt;/h2&gt;

&lt;p&gt;In Japan, however, "Acme," when phonetically translated to "アクメ," adopts a distinctly different meaning, closely associated with sexual climax or orgasm. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9wiue048e4va6j05k2kr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9wiue048e4va6j05k2kr.png" alt="Online dictionary"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is particularly evident in google searches within Japan, where "アクメ" predominantly directs to adult-oriented content. This stark difference in interpretation highlights the need for cultural sensitivity and awareness in translation and localization efforts.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqoz7gf8ra4xhr0f7b39g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqoz7gf8ra4xhr0f7b39g.png" alt="Google Image Search"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  A Message from a Japanese Engineer
&lt;/h2&gt;

&lt;p&gt;As a Japanese engineer, I recognize that "Acme" is an innocuous term in many parts of the world. However, I urge those involved in creating or translating content into Japanese to consider its unique cultural connotation. While not advocating for its complete avoidance, sensitivity in its use, especially in professional or educational contexts, is crucial. In Japan, fictional company names are often created by amalgamating names of well-known corporations, providing a culturally appropriate alternative.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Implementing Coupon/Promocode discount in Stripe, Laravel, Cashier</title>
      <dc:creator>Yusuke Kawabata</dc:creator>
      <pubDate>Tue, 25 May 2021 05:15:14 +0000</pubDate>
      <link>https://forem.com/ku_suke/implementing-coupon-promocode-discount-in-stripe-laravel-cashier-3e1j</link>
      <guid>https://forem.com/ku_suke/implementing-coupon-promocode-discount-in-stripe-laravel-cashier-3e1j</guid>
      <description>&lt;p&gt;I implemented a discount feature in my service this week, but I didn't find much information on how to implement it in the tech forums, so I'm sharing it here. &lt;/p&gt;

&lt;h1&gt;
  
  
  Environment
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Laravel 6 LTS&lt;/li&gt;
&lt;li&gt;Cashier 12&lt;/li&gt;
&lt;li&gt;Stripe SDK 7.70 depends from Cashier&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  What does it mean to give a "discount" in Stripe?
&lt;/h1&gt;

&lt;p&gt;There are two main ways to offer price promotions to users on Stripe: Trial and Coupon. Trial offers a free trial for the first N days of the contract, while Coupon offers a discount of N dollars or N %. &lt;/p&gt;

&lt;p&gt;I referred to this issue comments, but although it mentions Coupons, there was no explanation about Promotion Codes. Therefore, this article will explain about Promotion Code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/laravel/cashier-stripe/issues/167"&gt;https://github.com/laravel/cashier-stripe/issues/167&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  What is Promotion Code ?
&lt;/h1&gt;

&lt;p&gt;Promotion codes are human readable codes that can be issued in multiples of one Coupon. Both can be applied when creating a subscription, but where the Coupon defaults to a random ID, the Promotion code can be given any name (such as DEVTO90OFF).&lt;/p&gt;

&lt;p&gt;Although the discount conditions are determined by the Coupon object, Promocode allows you to set the number of coupons available and their duration arbitrarily (within the limits of the Coupon itself), so the following configuration is possible&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Coupon 90% off until 01/31/2022 Unlimited number of uses

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;DEVTO90&lt;/strong&gt; Until 01/31/2022 (Coupon value will be set if empty) Unlimited number of uses&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SUMMER90&lt;/strong&gt; Until 2021/08/31 Limit of 10 copies&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this way, it is possible to add "color" to the coupon by determining the location and conditions of distribution. For example, "Twitter only! 50% off coupon for 7 days only! and so on.&lt;/p&gt;

&lt;p&gt;Then, let's implement it.&lt;/p&gt;

&lt;h1&gt;
  
  
  Issue a coupon on Stripe console
&lt;/h1&gt;

&lt;p&gt;You can issue a coupon from this URL.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dashboard.stripe.com/test/coupons"&gt;https://dashboard.stripe.com/test/coupons&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At the bottom of the screen where you enter the coupon conditions, there is a switch that says "Use customer-facing coupon codes". This is the promotion code.&lt;/p&gt;

&lt;p&gt;You can also add a Promotion code to a coupon you have already issued. Just open the coupon detail page and click "Add a promotion code".&lt;/p&gt;

&lt;p&gt;You can give the Promotion code any name you like. It should have an exciting name, preferably with a number so that customers can expect a discount.&lt;/p&gt;

&lt;h1&gt;
  
  
  Create a method to check if Promocode is valid.
&lt;/h1&gt;

&lt;p&gt;In Laravel/Cashier, when you create a subscription, you can apply a promo code by simply adding the method &lt;code&gt;withPromotionCode($code)&lt;/code&gt; . &lt;br&gt;
But you need to be careful here. The argument $code is not "FRIENDS20" for humans, but an API ID starting with "promo_".&lt;/p&gt;

&lt;p&gt;I don't want to manage this synchronously between Stripe and my own application, and if possible, it would be helpful to be able to check if Promocode is valid.&lt;/p&gt;

&lt;p&gt;So, I created the following method to check if the promo code exists, and if so, to return the API-ID.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;private function validatePromocode($code)
{
    try {
        $promoCodes = Cache::remember('stripe-cache-promocodes', 600, function () {
            \Stripe\Stripe::setApiKey(YOUR_STRIPE_API_SECRET);
            return \Stripe\PromotionCode::all(["active"=&amp;gt;true]);
        });
        foreach ($promoCodes-&amp;gt;data as $promoCode) {
            if ($code==$promoCode-&amp;gt;code) {
                // valid
                return $promoCode-&amp;gt;id;
            }
        }
        return false;
    } catch (\Exception $e) {
        return false;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This method retrieves all valid, unexpired Promocodes (cached for 10 minutes) and returns the ID for Stripe if the human code matches.&lt;/p&gt;

&lt;h1&gt;
  
  
  Create a subscription with Promotion code
&lt;/h1&gt;

&lt;p&gt;You can then create a subscription based on the ID that comes back.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$user-&amp;gt;newSubscription('default', STRIPE_PRICE_API_ID )
        -&amp;gt;withPromotionCode($promoCodeId)
        -&amp;gt;create();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  How to notify the user of the result of the promotion being applied
&lt;/h1&gt;

&lt;p&gt;Since I couldn't to spend much time, I decided to have them visit the Customer Portal that Stripe provides during the trial period. &lt;/p&gt;

&lt;p&gt;In the Customer Portal, they can see that they are scheduled to be charged at a discounted price after the actual trial is over, which is a relief.&lt;/p&gt;

&lt;p&gt;If you want to be even more helpful, you can create the validate API to check the Promocode that I mentioned earlier on the subscription application page.&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>php</category>
      <category>stripe</category>
    </item>
  </channel>
</rss>
