Upgrade to Pro — share decks privately, control downloads, hide ads and more …

決済のその先へ、顧客DBとして考えるStripe / Beyond payments, Stripe as a customer DB

決済のその先へ、顧客DBとして考えるStripe / Beyond payments, Stripe as a customer DB

JP_Stripes 大阪 Vol.7 - 新サービス開発・収益化を加速するStripe活用法
https://jpstripes.connpass.com/event/294284/

shiro seike

October 17, 2023
Tweet

More Decks by shiro seike

Other Decks in Programming

Transcript

  1. DB Stripe
    JP_Stripes

    Vol.
    7

    Stripe

    2
    0
    23
    .
    10
    .
    17
    @seike
    4
    60
    1

    View full-size slide

  2. 自己
    @seike
    46
    0
    -
    - @seike
    46
    0
    - AWS Community Builder Serverless
    - Fusic
    - /

    - /
    -
    - PHP Japan
    - JAWS Days AWS Dev Day
    - Serverless Days Tokyo
    -
    - JP_Stripes
    - PHP 2023
    行 長
    - JAWS Festa

    - Cloudflare Meet-up Fukuoka Serverless Meetup Fukuoka Fukuoka.php Fukuoka.go
    2

    View full-size slide

  3. Agenda
    1
    .
    2
    .
    3
    .
    4
    . DB Stripe
    3

    View full-size slide

  4. https://fusic.co.jp/works/
    4 7
    用 自 自

    行 行
    自 行
    x SaaS
    5

    View full-size slide

  5. - Windows
    人 手 自 行
    -
    用 行
    Linux
    -
    -
    -
    用 用
    - Stripe
    用 入
    8

    View full-size slide

  6. 入力
    Email
    入力
    Stripe Payment Links

    9

    View full-size slide

  7. 12 入力

    Amazon S
    3
    Stripe Payment Links
    Stripe

    Web hook


    View full-size slide

  8. Web Amazon S
    3
    13 入力
    OrderID

    UUID

    - API OrderID

    - OrderID
    - OrderID
    JSON
    - OrderID.kaiseki OrderID.json
    OrderID Key

    Amazon S
    3 …
    Cloudfront

    CDN
    AWS Lambda

    FaaS

    View full-size slide

  9. Event( ) -> Amazon S
    3
    14 行
    JSON
    OrderID.json -> OrderID
    OrderID -> OrderID.kaiseki
    入 力 用 行
    AWS Fargate

    Amazon EventBridge

    View full-size slide

  10. http
    15
    Amazon S
    3 入力
    Email Stripe Payment Links
    Payment Link

    OrderID -> client_reference_id
    Email -> prefilled_email
    Email

    OrderID
    Amazon SES

    Email

    View full-size slide

  11. Payment Links
    16
    Stripe

    Payment Links 築
    client_reference_id = OrderID
    prefilled_email = Email

    Webhook 築

    View full-size slide

  12. 築 築
    17
    Web hook


    Payload OrderID Email

    OrderID 築

    View full-size slide

  13. Stripe

    Webhook
    Webhook

    SDK

    18
    \Stripe\Stripe::setApiKey(

    sk_test_hoge

    hoge');
    $endpoint_secret =

    whsec_hoge

    hoge ;
    $payload = @file_get_contents('php://input');
    $sig_header = $_SERVER['HTTP_STRIPE_SIGNATURE'];
    $event = null;
    try {
    $event = \Stripe\Webhook::constructEvent(
    $payload, $sig_header, $endpoint_secret
    );
    } catch(\UnexpectedValueException $e) {
    // Invalid payload
    http_response_code(
    400
    );
    exit();
    } catch(\Stripe\Exception\SignatureVerificationException $e) {
    // Invalid signature
    http_response_code(
    400
    );
    exit();
    }

    View full-size slide

  14. DB
    Stripe DB
    API
    AWS

    DB
    20
    Stripe

    View full-size slide

  15. 21
    Stripe Email OrderID
    Email OrderID
    OrderID

    Stripe 築
    Email

    View full-size slide

  16. Stripe
    22
    AWS Amplify

    Stripe DB

    - Payment Links

    - Email
    AWS Amplify

    View full-size slide

  17. PaymentLink -> CheckOut
    23
    Email PaymentLink
    CheckOut

    View full-size slide

  18. customer

    27

    View full-size slide

  19. Checkout Session clientReferenceId = OrderID
    28

    View full-size slide

  20. URL
    用 行
    29

    View full-size slide


  21. 30
    Email =
    Email

    AWS Amplify

    View full-size slide

  22. AWS Amplify Cognito
    32
    Next.js
    Email
    AWS Amplify

    Amazon Cognito
    用 面
    Amazon Cognito

    View full-size slide

  23. API Stripe
    33
    Amazon Cognito
    Email Stripe
    sessions

    -> OrderId

    View full-size slide

  24. Stripe Stripe Session -> OrderId
    34
    Stripe ID
    Session
    OrderID

    View full-size slide

  25. 35
    Next API
    NEXT_PUBLIC
    env
    Stripe
    AWS Lambda
    build
     
     
    API Lambda

    View full-size slide

  26. Stripe

    DB
    DB SaaS
    非 用
    SaaS

    36

    View full-size slide

  27. Thank You
    We are Hiring !
    https://recruit.fusic.co.jp/

    View full-size slide