WooCommerceなしでも導入できる!Stripe+WordPressで手軽に決済機能を導入する方法

E1ab278e65a01d6cd55385de579a9ad1?s=47 crebow
October 26, 2018

 WooCommerceなしでも導入できる!Stripe+WordPressで手軽に決済機能を導入する方法

「JP_Stripes (Stripe ユーザーグループ)in 広島 Vol.3 」にて発表したスライドです。
1.決済機能を実装する場合の選択肢とプラグイン
2.StripeCheckoutの実装について
3.Crebow Stripe JP Paymentプラグインを利用したチケット販売サイトの作成例の紹介と解説

E1ab278e65a01d6cd55385de579a9ad1?s=128

crebow

October 26, 2018
Tweet

Transcript

  1. https://crebow.info/ 4USJQF 8PSE1SFTTͰखܰʹܾࡁػೳΛ ಋೖ͢Δํ๏ 8PP$PNNFSDFͳ͠Ͱ΋ಋೖͰ͖Δʂ &

  2. & ϒϧʔϜϏδϣϯגࣜձࣾ୅දऔక໾ ༗ݶձࣾϏίʔζ΢Σϒ୲౰ ࣾஂ๏ਓ೔ຊλΠϙάϥϑΟʔڠձਖ਼ձһ ݸਓϒϩάEPJOGP ࣗݾ঺հ σβΠφʔɾϑϩϯτΤϯυΤϯδχΞ ϩΰϚʔΫʴλΠϓϑΣΠεσβΠϯ ֤छൢଅπʔϧɾΩϟϥΫλʔɾΠϥετ ·ͭ΋ͱͱ΋΍

    ΢ΣϒαΠτ
  3. https://crebow.info/ ΢ΣϒαΠτΛ׆༻ͯ͠ࣄۀ׆ಈΛߦ͏ݸਓ΍খن໛ͳࣄۀऀ͞·ͷॿ͚ʹͳΔΑ͏ͳαʔϏεΛఏڙ͠·͢ɻ & Ϩϙʔτ ૉࡐ഑෍ ϓϥάΠϯ഑෍ ςʔϚ഑෍ ϝʔϧϚΨδϯ ಋೖαϙʔτ Ϗδλʔ

    ແྉձһ ༗ྉձһ ແྉձһ ༗ྉձһ ແྉձһ ܖ໿ Ϗδλʔ ࣗݾ঺հ
  4. & WordPressར༻ऀ ΤϯδχΞɾ։ൃऀ ։ൃɾ࣮૷ྫ ຊ೔ͷ಺༰ ܾࡁػೳΛ࣮૷͢Δ৔߹ͷબ୒ࢶͱϓϥάΠϯ 4USJQF$IFDLPVUͷ࣮૷ʹ͍ͭͯ νέοτൢചαΠτͷ࡞੒ྫͷ঺հͱղઆ $SFCPX4USJQF+11BZNFOUϓϥάΠϯΛར༻ͨ͠

  5. & ܾࡁػೳΛ ࣮૷͢Δ৔߹ͷ બ୒ࢶͱϓϥάΠϯ WordPressར༻ऀ

  6. & ͋ Γ · ͤ Μ ͔ ʁ ͜ Μ

    ͳ ͜ ͱ
  7. & ΠϯλʔωοτͰൢച͍ͨ͠Μ͚ͩͲ ۜߦৼࠐ͸໘౗ͳΜͰΧʔυܾࡁͱ͔Ͱ͖ͳ͍ʁ ωοτγϣοϓͱ͔ϞʔϧͷαʔϏεͱ͔͸ݏʂ ϩΠϠϦςΟΛ෷͏ͷ͕ݏ ଞࣾͷϓϥοτϑΥʔϜ্Ͱ΍Γͨ͘ͳ͍ ࣗࣾͷαΠτͰͳΜͱ͔ͳΒͳ͍ʁ ͦ͏ͦ͏ɺ8PSE1SFTTͬͯ΍ͭͰ ͭͬͯ͘ΔΜͩͬͯɺ͏ͪͷαΠτ ͦΜͳେ͛͞ͳϞϊ͡Όͳ͍͍͔ͯ͘Β͞ʂ

    ηϛφʔͷνέοτൢചͱ͔Ͱ͖ͨΒ͍͍ͳʔ ঎඼ΞΠςϜ਺ͳΜͯ਺఺͘Β͍͔͠ͳ͍͠ʔ ָఱͱ͔ΞϚκϯͱ͔ʁ ࠷ۙͩͱ#"4&ͱ͔Ͳ͏Ͱ͢ʁ &$αΠτ࡞Δͬͯ͜ͱͰ͔͢ʁ ӡ༻ͱ͔Ͳ͏͠·͠ΐ͏ʁ 8PSE1SFTTͰ͔͢ɾɾɾ
  8. & 8PSE1SFTTͰωοτγϣοϓΛߏங͢Δʹ͸&$ϓϥάΠϯ ੈքͰҰ൪ར༻͞Ε͍ͯΔ&$γεςϜ 8PSE1SFTTͰΧʔυܾࡁΛಋೖ͢Δࡍɺ ඞͣީิʹڍ͕ΔϓϥάΠϯ

  9. & ΞυΦϯϓϥάΠϯ͕๛෋ ͳͲͳͲɾɾɾ ͷ͍͍ͱ͜Ζ

  10. & ςʔϚ͕๛෋ɾΧελϚΠζͷ೉қ౓͕௿͍ ςʔϚ͕๛෋ IUUQTKBXPSEQSFTTPSHUIFNFTTFBSDI8PP$PNNFSDF ೥݄຤ݱࡏެࣜςʔϚ਺छྨ ͷ͍͍ͱ͜Ζ ΧελϚΠζͷ೉қ౓͕௿͍ ରԠ͍ͯ͠ͳ͍ςʔϚͰ΋ɺ ͍͔ͭ͘௥ՃͱมߋΛߦ͏͚ͩͰରԠͰ͖Δɻ GVODUJPOTQIQ

    XPPDPNNFSDFQIQ GVODUJPOTQIQ XPPDPNNFSDFQIQ
  11. & Λಋೖͨ͘͠ͳ͍ ͱ͸͍͑ɾɾɾɾ ͱ͍ͬͨέʔε΋ɾɾɾ

  12. & Λಋೖ͠ͳ͍ɾಋೖͰ͖ͳ͍ཧ༝ ೉ղͰෳࡶͳ࡞ۀΛߦ͍ͨ͘ͳ͍ අ༻ରޮՌΛߟ͑Δͱֶशίετ͕ߴ͗͢Δ 8PSE1SFTTͷϓϥάΠϯ΍ςʔϚͷ੍࡞͕Ͱ͖ΔϨϕϧͰͳ͍ͱ ΧελϚΠζͷ೉қ౓͕௿͍ͱ͸ࢥ͑ͳ͍ʂ

  13. & γϣοϓԽͯ͠΋ӡӦӡ༻Ͱ͖ͳ͍ طଘͷϒϩάͰӡ༻͍ͨ͠ ςʔϚΛ৮Δͷ͸ۤख Χʔτ͸ඞཁͳ͍ ϒϩάͷதʹܾࡁϘλϯ͕͋Ε͹͍͍ Λಋೖ͠ͳ͍ɾಋೖͰ͖ͳ͍ཧ༝ ΄ͲͷػೳΛ๬·ͳ͍έʔε΋͋Δ

  14. & ΧʔυܾࡁΛಋೖ͍ͨ͠ ϛογϣϯ ΧʔυܾࡁΛಋೖ͢Δ  Ͱ͋Δ ཧ༝͸ͳ͍

  15. & ΧʔυܾࡁΛಋೖ͍ͨ͠ ϛογϣϯ Χʔυܾࡁ͕Ͱ͖Ε͹͍͍ Χʔυ৘ใ͸อ༗ͨ͘͠ͳ͍ վਖ਼ׂොൢച๏ ࣮૷ɾ΍ΓͱΓ͕؆୯ "1* తͳԿ͔ 8PSE1SFTTͰ࢖͑ΔϓϥάΠϯ͕͋ΓɺΑ͘ީิʹڍ͕ΔαʔϏε

  16. & ͱ ൺֱͯ͠ΈΔ Λ 8PSE1SFTTͰ࢖͑ΔϓϥάΠϯ͕͋ΓɺΑ͘ީิʹڍ͕ΔαʔϏε

  17. & ࠃ಺ ࢿۚҠಈۀऀؔ౦ࡒ຿ہ௕ୈ߸ 1BZNFOU1SPDFTTPS 1BZNFOU1SPDFTTPS 1BZNFOUHBUFXBZ 1BZNFOU1SPDFTTPSɿখചళ΍ফඅऀ͔Β௚઀ࢧ෷͍৘ ใΛड͚औΓۜߦ΍ΫϨδοτΧʔυձࣾͷγεςϜʹ௚ ઀ΞΫηεͯ͠ॲཧΛߦ͏͜ͱ͕Ͱ͖Δ ࣄۀܗଶ

    ܾࡁख਺ྉ ສԁҎԼ ສԁ௒ສԁҎԼ ສԁ௒ ສԁҎԼ  ສԁ௒  ԁ݅  ԁ݅  ԁ݅  ԁ݅ ܾࡁ੒ཱ͝ͱ  ➤ ॳظඅ༻͸ແྉɺֹ݄අ·ͨ͸ӅΕͨख਺ྉ͸ Ұ੾ͳ͠ ➤ ࢖ͬͨ෼͚ͩͷख਺ྉ ➤ ϦΞϧλΠϜͷख਺ྉϨϙʔτ ͱ ͷൺֱ ➤ ւ֎͸ख਺ྉ͕มΘΓ·͢ɻ গֹܾࡁ ➤ ݄ؒച্͕ສԁΛ௒͑Δͱ͓τΫʹͳΔϚʔ νϟϯτϨʔτͷద༻ʹ͸ਃ੥͕ඞཁͰ͢ɻ ➤ ւ֎͸ख਺ྉ͕มΘΓ·͢ɻ ➤ গֹܾࡁΛ͝ར༻͍ͨͩ͘ʹ͸ਃ੥͕ඞཁͰ͢ɻ ճͷऔҾֹ͕ࠃ಺औҾ ԁҎԼ ʴԁ
  18. & ৚݅෇͖ແྉ ۜߦޱ࠲΁ ͷҾ͖ग़͠ ➤ ࢒ߴΛۜߦޱ࠲΁Ҿ͖ग़ֹ͕ۚ͢ສԁະຬͷ ৔߹ԁ݅ͷख਺ྉ͕͔͔Γ·͢ɻ ➤ ۚ༥ػؔʹΑΓผ్ख਺ྉ͕͔͔Δ৔߹͕͋Γɺ ࣗ਎Ͱར༻͢Δۚ༥ػؔʹ͓໰͍߹ΘΔඞཁ͕

    ͋Γ·͢ɺ Ҿ͖ग़͠ʹ ཁ͢Δظؒ ग़ۚਃ੥͔ΒʙӦۀ೔ ➤ ۚ༥ػؔʹΑΓҟͳΓ·͢ ि·ͨ͸݄୯Ґͷબ୒ͷࣗಈৼࠐ ར༻Մೳ Χʔυ 7*4".BTUFS+$#  ".&9%JOFST "MJQBZ8F$IBU1BZ "QQMF1BZ(PPHMF1BZ 7*4".BTUFS+$# ".&9%JOFST࿆ۜ +$#͸ผ్ਃ੥͕ඞཁ 7*4".BTUFS+$# ࢧ෷͍ऀ΋ΞΧ΢ϯτొ࿥͕ඞཁɻϝʔϧͰͷܾࡁ੥ ٻ͸ΞΧ΢ϯτొ࿥ෆཁͰܾࡁՄೳɻ ΞΧ΢ϯτొ࿥ෆཁͰܾࡁՄೳ ֹ݄ར༻ྉ ԁ͕͔͔Γ·͢ ΢ΣϒϖΠϝϯτϓϥεΛར༻ͨ͠৔߹ ແྉ
  19. Λબ୒͠·ͨ͠ & ͔ΜͨΜܾࡁϘλϯ )5.-  8PSE1SFTTϓϥάΠϯ༗Γ 1BZ1BMNFΛ࢖͏ख΋͋Δ ಋೖͷ͠΍͢͞ ʢ"1*ͷ஌ࣝͳ͠ʣ 8PSE1SFTTϓϥάΠϯ༗Γ

    ςΫχΧϧ αϙʔτ ಋೖͷ͠΍͢͞ ʢ"1*ͷ஌ࣝ͋Γʣ υΩϡϝϯτͷ ॆ࣮౓ º ˕ º ˕ ˚ ˕ ࣮૷·Ͱʹ ͔͔Δ৹ࠪ࣌ؒ 1BZ1BM࣍ୈ ଈ೔ ໰୊͕ൃ֮ͨ࣌͠఺Ͱࣄޙௐࠪ͋Γ ࢲͷ৔߹
  20. & αʔϏε͕Θ͔Γʹ͍͘ ৹ࠪʹ͕͔͔࣌ؒΓ͗͢Δˠ։ൃεέδϡʔϧʹ΋Өڹ ςΫχΧϧαϙʔτ͕ͳ͍ʢ࣭໰ʹର͢Δճ౴͕໌֬Ͱͳ͍ʣ ӅΕͨඅ༻Λ೺Ѳͮ͠Β͍ ސ٬΋Ϣʔβʔొ࿥͕ඞཁʢϝʔϧ΍༗ྉαʔϏεͩͱෆཁʣ ࢲͷ৔߹ ྉ͕ۚ໌֬ ಋೖ·Ͱ͕ૣ͍ υΩϡϝϯτ͕ॆ࣮͍ͯ͠Δʢαϯϓϧίʔυͷॆ࣮ʣ

    ͱ 1BZ1BMNFͳͲ৽͍͠αʔϏεʹ͸ັྗ͸͋Γ·͕͢ɾɾɾ
  21. & TUSJQFQBZNFOU IUUQTHUJDPKQ 4USJQFϓϥάΠϯͬͯ͋Δͷʁ $SFCPX4USJQF+11BZNFOU IUUQTDSFCPXJOGP ݸͷ߲໨ ެࣜʹొ࿥͞Ε͍ͯΔϓϥάΠϯ ೔ຊͰ࡞੒͞ΕͨϓϥάΠϯ

  22. & IUUQTTQMVHJOTDPN IUUQTKBXPSEQSFTTPSHQMVHJOTTUSJQFQBZNFOUT IUUQTDSFCPXJOGP IUUQTHJUIVCDPNDSFCPX 4USJQF͕࢖͑ͯ ςʔϚͷΧελϚΠζ͕ෆཁͳϓϥάΠϯ Stripe Payments Crebow

    Stripe JP Payment γϣʔτίʔυΛ౤ߘʹషΓ෇͚Δ͚ͩ ͲͪΒͷϓϥάΠϯ΋ ࢲ͕ͭ͘Γ·ͨ͠
  23. & Stripe Payments IUUQTTQMVHJOTDPN IUUQTKBXPSEQSFTTPSHQMVHJOTTUSJQFQBZNFOUT

  24. & 4USJQF1BZNFOUTͷಛ௕ γϣʔτίʔυΛར༻ͯ͠ߪೖϘλϯΛ αΠτͷͲ͜ʹͰ΋ઃஔͰ͖ΔΑ͏ʹ͢Δ ΞυΦϯͰ༷ʑͳػೳΛఏڙ͍ͯ͠Δ

  25. & 4USJQF1BZNFOUTͷಛ௕ σδλϧ঎඼ʢϑΝΠϧɺԻָɺϏ σΦɺిࢠॻ੶ɺ1%'ͳͲʣΛൢച ͢Δ͜ͱ͕Ͱ͖·͢ɻߪೖ͕׬ྃ͠ ͨΒɺϢʔβʔ͸ࣗಈతʹσδλϧ ϑΝΠϧΛμ΢ϯϩʔυͰ͖·͢ɻ ΧʔτϓϥάΠϯ΍γϣοϐϯάܥ ͷϓϥάΠϯΛೖΕͳͯ͘΋ࢧ෷͍ ػೳ͕ಋೖɻ


    ੥ٻઌॅॴͷऩूΛ༗ޮʹ͢ΔΦϓ γϣϯ͕͋Γ·͢ɻ د෇ϘλϯΛ࡞੒͢Δ͜ͱ͕Ͱ͖· ͢ɻΧελϜՁ֨ΛೖྗͰ͖ΔΑ͏ ʹ͢ΔΦϓγϣϯ͕͋Γ·͢ɻ σδλϧϝσΟΞͷൢച ෺ൢʹ΋ར༻Մ د෇ػೳʢ౤͛મػೳʣ ͢΂ͯͷτϥϯβΫγϣϯ͸ɺϓϥ άΠϯͷ஫จϝχϡʔʹอଘ͞Ε· ͢ɻ8PSE1SFTT؅ཧμογϡϘʔυ Ͱߪೖ಺༰ΛݟΔ͜ͱ͕Ͱ͖·͢ɻ ड஫؅ཧ ސ٬ऩू ੡඼͝ͱʹαϯΩϡʔϖʔδ ྖऩॻΛૹΔ ϘλϯςΩετͷΧελϚΠζ 4USJQF͔Βސ٬ʹྖऩॻΛࣗಈతʹૹ৴͢ΔΦϓγϣϯ ߪೖϘλϯͷςΩετมߋ ੡඼͝ͱʹ࡞੒Մೳ νΣοΫΞ΢τϑΥʔϜʹͯऩू
  26. & ఆظߪಡͱఆظࢧ෷͍Λઃఆͯ͠ ސ٬ʹൢച͢Δ͜ͱ͕Ͱ͖·͢ɻ 4VCTDSJQUJPO1BZNFOUT  "QQMFͱ(PPHMF1BZΛ࢖༻ͯ͠ ސ٬͔Βͷࢧ෷͍Λड͚ೖΕΔ͜ ͱ͕Ͱ͖·͢ɻ "QQMFBOE(PPHMF1BZ 

    ΢ΣϒαΠτ্ͷ"MJQBZܦ༝Ͱࢧ ෷͍Λड͚ೖΕΔ͜ͱ͕Ͱ͖·͢ɻ "MJQBZ"EEPO GSFF ෳ਺௨՟ͷΞυΦϯʹΑΓɺސ٬ ͸௨՟Λબ୒͠ɺͦͷ௨՟Ͱ঎඼ Λࢧ෷͏͜ͱ͕Ͱ͖·͢ɻ .VMUJ$VSSFODZ"EEPO  ސ٬ʹൢച͞Εͨσδλϧ੡඼͸ɺ ࣗಈతʹظݶ੾ΕʹͳΔ҉߸Խ͞ Εͨμ΢ϯϩʔυϦϯΫʹΑͬͯ อޢ͞Ε·͢ɻ 4FDVSF%PXOMPBET  4USJQF1BZNFOUT1MVHJOʹΑͬ ͯදࣔ͞ΕΔଟ͘ͷڞ௨ϝοηʔ δΛΧελϚΠζͰ͖·͢ɻ $VTUPN.FTTBHFT"EEPO  ΞϑΟϦΤΠτϓϥάΠϯ͸ɺΞ ΠςϜΛߪೖ͢Δސ٬Λ௥੻͠঺ հऀʹద੾ͳख਺ྉΛत༩͠·͢ɻ 81"GGJMJBUF*OUFHSBUJPO GSFF ސ٬͕ετϥΠϓࢧ෷͍ϘλϯΛ ΫϦοΫ͢ΔͱSF$"15$)"ϙο ϓΞοϓ͕දࣔ͞Ε·͢ɻ SF$"15$)""EEPO GSFF 4USJQF1BZNFOUTͷಛ௕ʲ"EEPOTʳ
  27. & IUUQTDSFCPXJOGP IUUQTHJUIVCDPNDSFCPX Crebow Stripe JP Payment

  28. & $SFCPX4USJQF+11BZNFOUͷಛ௕ αΫοͱ࢖͑ΔϓϥάΠϯʹ͍ͨ͠ Ͱ͖Δ͚ͩ೉͍͠ૢ࡞Λͤ͞ͳ͍ ͓٬͞Μʹ߹ΘͤͯΧελϚΠζ͍ͨ͠ ϓϥάΠϯΛར༻ͯ͠ಠࣗʹػೳ֦ு͕Ͱ͖Δ࢓૊Έ

  29. & $SFCPX4USJQF+11BZNFOUͷಛ௕ ঎༻ɾඇ঎༻໰Θͣࣗ༝ʹ͝ར༻͍ ͚ͨͩΔ͚ͩͰͳ͘ɺίʔυͷվม ͯ͠࠶ར༻͢Δ͜ͱ͕Ͱ͖·͢ɻ ঎༻ɾඇ঎༻໰Θͣࣗ༝ʹ͝ར༻͍ ͚ͨͩΔ͚ͩͰͳ͘ɺίʔυͷվม ͯ͠࠶ར༻͢Δ͜ͱ͕Ͱ͖·͢ɻ ΧʔτϓϥάΠϯ΍γϣοϐϯάܥ ͷϓϥάΠϯΛೖΕͳͯ͘΋ࢧ෷͍

    ػೳ͕ಋೖ ແྉͰར༻Մೳ ೔ຊਓ޲͚ʹղઆ ෺ൢʹ΋ར༻Մ هࣄʢΞΠςϜʣ͝ͱʹӾཡ੍ݶ͕ Ͱ͖ΔͨΊɺձһ੍αΠτͳͲʹ׆ ༻Ͱ͖·͢ɻ ༗ྉίϯςϯπ഑৴ ঎༻ɾඇ঎༻໰Θͣࣗ༝ʹ͝ར༻͍ ͚ͨͩΔ͚ͩͰͳ͘ɺίʔυͷվม ͯ͠࠶ར༻͢Δ͜ͱ͕Ͱ͖·͢ɻ ࡏݿ؅ཧ ঎༻ɾඇ঎༻໰Θͣࣗ༝ʹ͝ར༻͍ ͚ͨͩΔ͚ͩͰͳ͘ɺίʔυͷվม ͯ͠࠶ར༻͢Δ͜ͱ͕Ͱ͖·͢ɻ ߪೖऀ؅ཧ ઃஔ΍ΧελϚΠζ͕೉͍͠ํʹ͸ νϟοτπʔϧʮTMBDLʯΛར༻͠ ͯಋೖαϙʔτʢ༗ঈʣΛߦ͍·͢ɻ ·݄ͨʑͷӡ༻αϙʔτʢ༗ঈʣ΋ ʹͯରԠ͍ͨ͠·͢ɻ ಋೖαϙʔτ ϓϥάΠϯΛར༻ͨ͠αΠτߏஙͷ ͓ख఻͍΋͍͖ͤͯͨͩ͞·͢ʂ ϑϧΧελϚΠζ (1-ϥΠ ηϯε 8FCIPPL 8FCIPPL 8FCIPPL /&8 /&8
  30. & σδλϧϝσΟΞ ͷൢച ˓ ˓ γεςϜ 4USJQF$IFDLPVU 4USJQF$IFDLPVU ຒΊࠐΈํ๏ γϣʔτίʔυ

    γϣʔτίʔυ ෺ൢར༻ ˓ ˓ ΧελϜֹۚ ˓ ೔ຊޠରԠ - - ೔ຊޠӳޠ ௨՟ ೔ຊԁͷΈ ଞ௨՟ରԠ ϘλϯςΩετ ΧελϜՄ ΧελϜՄ ෳ਺ߪೖ ˓ ˓ ݸผʹରԠʢ༗ྉʣ μ΢ϯϩʔυ 8PSEQSFTTެࣜ (JU)VC 8PSE1SFTTެࣜ΁͸ਃ੥༧ఆ ސ٬؅ཧ ࡏݿ؅ཧ 4USJQF͔Βސ٬ʹ ྖऩॻΛૹΔ 4USJQFʹ Χʔυ৘ใΛอଘ data-allow-remember-me #*--*/(ͷར༻ ʢαϒεΫϦϓγϣϯʣ "QQMF1BZ (PPHMF1BZ ௨஌ϝʔϧ "EEPO<༗ྉ> "EEPO<༗ྉ> "EEPO<༗ྉ> "EEPO<ແྉ> ։ൃத ະఆ ະఆ ະఆ ରԠ༧ఆͳ͠ ݸผରԠʢ༗ྉʣ ˓ ˓ ˓ ˓ ˓ ˓ ˓ ˓ Λൺֱͯ͠Έͨ ͱ
  31. & ·ͱΊ ܾࡁػೳΛ࣮૷͢Δ৔߹ͷબ୒ࢶͱϓϥάΠϯͷ ΧʔυܾࡁΛಋೖ͢Δ  Ͱ͋Δ ཧ༝͸ͳ͍ ྉ͕ۚ໌֬ ಋೖ·Ͱ͕ૣ͍ υΩϡϝϯτ͕ॆ࣮͍ͯ͠Δʢαϯϓϧίʔυͷॆ࣮ʣ

    ଞࣾͱൺֱ͢Δͱ 4USJQF͸ѱ͍໘͕গͳ͍ 8PSE1SFTTͰ࢖͑ΔαʔϏεΛબͿ
  32. & 4USJQF$IFDLPVUͷ ࣮૷ʹ͍ͭͯ ΤϯδχΞɾ։ൃऀ

  33. & આ໌͢Δ͜ͱ͕ͳ͍ ಋೖ͢Δͷ͕ͱͯ΋ָ υΩϡϝϯτ͕ॆ࣮͍ͯ͠Δ

  34. https://stripe.com/docs & docs https://stripe.com/docs/checkout (PPHMFݕࡧͰௐ΂Δ 2JJUBͰௐ΂Δ +1@4USJQFTͰௐ΂Δɾฉ͘ ΄΅໰୊͕ղܾ͢Δ

  35. & ॳ৺ऀͷࢲ͕ϋϚͬͨ ༻ҙ͞Ε͍ͯΔύϥϝʔλҎ֎͸Ͳ͏͢Δͷʁ 4USJQFʹه࿥ͨ͠৘ใ͕࡟আͰ͖ͳ͍ʁ ΧελϚΠζͷপ஍ͰṆΕΔɾɾɾ ͱ͸͍͑ɻɻɻ ૹ৴ͨ͠ͷʹ4USJQFଆͰ͸σʔλΛड͚औ͍ͬͯͳ͍ʁ

  36. & ૹ৴ͨ͠ͷʹɾɾɾ 4USJQFଆͰ͸σʔλΛड͚औ͍ͬͯͳ͍ʁ

  37. 8&# αʔόʔ & ܾࡁ׬ྃ·Ͱͷϑϩʔ checkout.js ܾࡁ׬ྃ ར༻͢Δ σʔλΛૹΔ ϖʔδભҠ σʔλΛॲཧ

    4USJQFଆͰ৘ใΛड͚औ͍ͬͯͳ͍
  38. https://github.com/stripe/stripe-php Stripe PHP bindings & ͕ඞཁ ͔Βμ΢ϯϩʔυ͢Δ ͦ͏͍͹ɺόΠϯσΟϯά͕ඞཁͱ͔ॻ͍͍ͯͨΑ͏ͳɾɾɾ

  39. 8&# αʔόʔ & 4USJQF1)1CJOEJOHTΛར༻͢Δͱ͜Ζ checkout.js ܾࡁ׬ྃ STRIPE PHP BINDINGS ར༻͢Δ

    σʔλΛૹΔ ϖʔδભҠ ར༻͢Δ σʔλΛॲཧ
  40. & 4USJQF1)1CJOEJOHTΛར༻͢Δ <?php require_once( dirname(__FILE__).'/stripe-php-6.16.0/init.php'); \Stripe\Stripe::setApiKey('secretkeyxxxxxxxxxxxxxxxxxxxxxxxx'); $token = $_POST[ 'stripeToken'

    ]; $email = $_POST[ 'stripeEmail' ]; $amount = $_POST[ 'amount' ]; $description = $_POST[ 'description' ]; $currency = $_POST[ 'currency' ]; try { $charge = \Stripe\Charge::create(array( 'amount' => $amount, 'currency' => $currency, 'source' => $token, 'description' => $description, 'receipt_email' => $email, )); }ɾɾɾɾɾɾ SFRVJSF@PODFͰJOJUQIQΛಡΈࠐΉ
  41. & ༻ҙ͞Ε͍ͯΔύϥϝʔλҎ֎͸Ͳ͏͢Δͷʁ

  42. & ·ͣ͸Ұൠతͳܾࡁϑϩʔʢߏ੒ʣ ܾࡁ׬ྃ 8FCIPPL 8&# αʔόʔ %# αʔόʔ "KBY ߪೖը໘

    σʔλͷॲཧ ܾࡁޙͷը໘
  43. & DIFDLPVUKTͷهड़ྫ <form action = "xxxxxxxxxxxxxxxxxx" method = “POST"> <script

    src = "https://checkout.stripe.com/checkout.js" class = "stripe-button" data-key = "pk_test_xxxxxxxxxxxxxxxxxxxxx" data-amount = "800" data-name = "ൢചݩ໊" data-description = "঎඼໊" data-image = "https://xxxxxxxxxxx/xxxxxxxxxx.png" data-locale = "auto" data-currency = "jpy" data-zip-code = "false" data-allow-remember-me = "false" data-label = "ࠓ͙͢ߪೖ "> </script> </form>
  44. & طଘͷύϥϝʔλ EBUBLFZ EBUBBNPVOU EBUBOBNF EBUBEFTDSJQUJPO EBUBJNBHF EBUBMPDBMF EBUBDVSSFODZ EBUBBMMPXSFNFNCFSNF

    EBUBMBCFM 1VCMJTIBCMF,FZΛهड़͠·͢ɻඞਢ߲໨Ͱ͢ ܾࡁֹ͍ͤͨۚ͞Λೖྗ͠·͢ɻ γϣοϓ໊΍αΠτ໊Λೖྗ͠·͢ɻ EBUBOBNFͷԼʹදࣔͤ͞Δઆ໌จɻࣈʙࣈఔ౓ ϑΥʔϜͷ্෦ʹදࣔ͞ΕΔΞΠίϯը૾ͷ63-Λೖྗ͢Δ ࢖༻͢Δݴޠ ࢖༻͢Δ௨՟୯Ґͷઃఆ ܾࡁ৘ใͷอଘػೳʢ஫ɿ4USJQFʹอଘ͞Ε·͕͢؅ཧऀ͕؅ཧͰ͖ΔΘ͚Ͱ͸ͳ͍ʣ Ϙλϯͷ໊લ
  45. & ΍Γ͍ͨ͜ͱ ܾࡁ׬ྃ 8FCIPPL 8&# αʔόʔ %# αʔόʔ "KBY ߪೖը໘

    σʔλͷॲཧ ܾࡁޙͷը໘ ಠࣗͷύϥϝʔλΛૹͬͯಈ࡞Λ੍ޚ͍ͨ͠ ঎඼ͷ*%΍঎඼ίʔυϢʔβʔ*%ͳͲಠࣗͷύϥϝʔλ
  46. & ಠࣗύϥϝʔλ͸JOQVUUZQFIJEEFOͰରԠ <input type="hidden" name="amount" value="xxxxx"> <input type="hidden" name="description" value="xxxxx">

    <input type="hidden" name="currency" value="xxxxx"> <input type="hidden" name="userid" value="xxxxx"> <input type="hidden" name="itemname" value="xxxxx"> <input type="hidden" name="daytime" value="xxxxx"> <input type="hidden" name="itemmpostid" value="xxxxx"> <input type="hidden" name="stockuse" value="xxxxx"> <input type="hidden" name="stockcount" value="xxxxx"> <input type="hidden" name="productcode" value=“xxxxx"> </form> ಠࣗύϥϝʔλ͸DIFDLPVUKTͷதʹ͸ؚΊͳ͍
  47. & 4USJQFʹσʔλʹಠࣗύϥϝʔλΛૹΕΔΑ͏ʹ͢Δ $metadata = array( 'userid' => $_POST[ 'userid' ],

    'daytime' => $_POST[ 'daytime' ], 'itemname' => $_POST[ 'itemname' ], 'productcode' => $_POST[ 'productcode' ], 'itemmpostid' => $_POST[ 'itemmpostid' ], 'stockuse' => $_POST[ 'stockuse' ], 'stockcount' => $_POST[ 'stockcount' ], ); ૹΔલʹσʔλΛ഑ྻʹ͢Δ try { $charge = \Stripe\Charge::create(array( 'amount' => $amount, 'currency' => $currency, 'source' => $token, 'description' => $description, 'receipt_email' => $email, 'metadata' => $metadata, )); }ɾɾɾɾɾɾ NFUBEBUBͱͯ͠ૹΔ
  48. & XFCIPPLͰಠࣗύϥϝʔλΛड͚औΕΔΑ͏ʹ͢Δ $webhook_stripeid = $json->data->object->id; $webhook_userid = $json->data->object->metadata->userid; $webhook_itemname =

    $json->data->object->metadata->itemname; $webhook_user = $json->data->object->source->name; $webhook_receipt_email = $json->data->object->receipt_email; $webhook_productcode = $json->data->object->metadata->productcode; $webhook_daytime = $json->data->object->metadata->daytime; $webhook_amount = $json->data->object->amount; $webhook_status = $json->data->object->status; //ࡏݿ؅ཧ $webhook_itemmpostid = $json->data->object->metadata->itemmpostid; $webhook_stockuse = $json->data->object->metadata->stockuse; $webhook_stockcount = $json->data->object->metadata->stockcount; GJMF@HFU@DPOUFOUT QIQJOQVU Ͱ+40/ຊจͷCPEZΛड͚औͬͯ KTPO@EFDPEFؔ਺ͰจࣈྻΛ഑ྻʹมߋ
  49. & 4USJQFʹه࿥ͨ͠৘ใ͕࡟আͰ͖ͳ͍ʁ

  50. & EBUBBMMPXSFNFNCFSNFύϥϝʔλΛઃఆͨ͠৔߹ ܾࡁ৘ใΛอଘ͢ΔΛΫϦοΫͯ͠Ϋ ϨδοτΧʔυ৘ใΛ҆શʹอଘ͢Δͱɺ ଞͷαΠτͰ΋؆୯ʹܾࡁ͕ՄೳͰ͢ ܾࡁ৘ใΛ4USJQFʹ อଘ͞ΕΔ 4USJQFΛར༻͍ͯ͠ΔଞͷαΠτͰৄ͠ ͍৘ใΛೖΕͳͯ͘΋ࣗಈతʹೖྗͯ͠ ར༻Ͱ͖ΔΑ͏ʹͳΔɻ

  51. & IUUQTTUSJQFDPNDIFDLPVUJOGP EBUBBMMPXSFNFNCFSNFύϥϝʔλΛઃఆͨ͠৔߹ ͓٬༷ͷΫϨδοτΧʔυ൪߸͸ɺ͓٬༷ͷϝʔϧΞυϨεͱܞଳి࿩൪߸ ʹϦϯΫ͍ͯ͠·͢ɻ ҧ͏ίϯϐϡʔλ্Ͱͷ4USJQFʹΑΔ͓ࢧ෷͍ɺ·ͨ͸ϩάΞ΢τͨ͠৔ ߹͸ɺܾࡁ࣌ʹϝʔϧΞυϨεΛೖྗ͢Ε͹4USJQF͔Βຊਓ֬ೝ༻ͷςΩ ετ͕ૹ৴͞Ε·͢ɻ ͜Εɾɾɾ࡟আ͸Ͳ͏͢Δͷʁ

  52. & +1@4USJQFT 4USJQFϢʔβʔίϛϡχςΟʣ'BDFCPPLϖʔδ ೥݄೔λΠϜϥΠϯΑΓ ࡟আґཔ͕ඞཁͱͷ͜ͱͰ͢ɻ +1@4USJQFTͰฉ͍ͯΈͨ

  53. & νέοτൢചαΠτͷ ࡞੒ྫͷ঺հͱղઆ ։ൃɾ࣮૷ྫ $SFCPX4USJQF+11BZNFOU ϓϥάΠϯΛར༻ͨ͠

  54. & ߏஙલʹܾΊ͓ͯ͘͜ͱ ձ৔Ͱͷνέοτ֬ೝͷํ๏ʹ͍ͭͯ ໨ࢹͰ֬ೝ νέοτͷߪೖ੍ݶ ਓຕݶΓ ਓຕͷఆٛ͸ʁਓ͸Ϣʔβʔʁ ؅ཧػೳ͕ඞཁ ߪಡऀొ࿥ͤͯ͞Ϣʔβʔͷ؅ཧ͢Δඞཁ͕͋Δ ౎౓ߪೖ

    طଘͷػೳͰ0, ෳ਺ߪೖ ෳ਺ߪೖͰ͖ΔΑ͏ͳ࢓૊Έ͕ඞཁ ϝʔϧ΍ྖऩॻΛর߹͢Δ࡞ۀ͕ඞཁ 23ͳͲΛൃߦͯ֬͠ೝ ؅ཧػೳ͕ඞཁ $384+1Ͱ͸ߪೖͨ͠Ϣʔβʔ͚ͩʹίϯςϯπΛදࣔͤ͞Δػೳ͋Γ
  55. & τοϓϖʔδʹൢചνέοτͷҰཡදࣔ ࠓճ࡞੒ͨ͠νέοτൢചαΠτͷϙΠϯτ νέοτͷࡏݿ؅ཧػೳ ຕͣͭߪೖͤ͞Δύλʔϯͱෳ਺ߪೖύλʔϯͷछྨ ೖ৔࣌ͷνέοτ֬ೝ͸ྖऩॻͷఏࣔͰ֬ೝ ฦۚɾΩϟϯηϧ͸खಈʢ͓໰͍߹Θ͔ͤΒड෇Š81͓Αͼ4USJQFʹͯखಈͰमਖ਼ʣ αΠτͷ࢓༷ʹ͍ͭͯ νέοτ໊։࠵೔։৔࣌ؒ։ԋ࣌ؒ8&#લചνέοτֹۚ౰೔ձ৔νέοτֹۚ νέοτߪೖ਺ɿຕߪೖɾෳ਺ߪೖ

    εςʔλεɿελϯόΠɾൃചதɾൃചٳࢭɾൃചऴྃɾചΓ੾Ε ৄࡉϖʔδʹ͸ҎԼͷ৘ใΛܝࡌ͢Δ
  56. & ঎඼ొ࿥ ྖऩॻൃߦ ྖऩॻΛϝʔϧͰૹ৴ 8&# αʔόʔ %# αʔόʔ ৘ใૹ৴ Χʔυܾࡁ

    ߪೖ৘ใͷૹ৴ 8FCIPPL "KBY ܾࡁ·ͰͷྲྀΕ " #
  57. & " ૉਓ͕ೖྗ͢Δ͜ͱΛ૝ఆ͓ͯ͘͠ ࢓༷͕มΘͬͨࡍɺαΠτ͕දࣔ͞Εͳ͍౳ͷෆ۩߹Λ ճආͰ͖Δઃܭʹ͓ͯ͘͠ αΠτ؅ཧऀ ɾ)5.-ͳͲͷ஌ࣝ͸๡ͯ͘͠΋࢖͑ΔΑ͏ʹ͓ͯ͘͠ ੍࡞ձࣾ ϓϥάΠϯʹ͸खΛೖΕͣ ͦͷ··࢖༻͢Δ

    ΧελϜϑΟʔϧυͳͲϓ ϥάΠϯԽͯ͠࢖༻͢Δ Ξοϓσʔτ͖ΔΑ͏ʹ͓ͯ͘͠ ௥Ճػೳ͸ෆ۩߹͕ग़ͨࡍɺϓϥάΠϯΛఀ ࢭ͢Δ͚ͩͰɺαΠτશମΛࢭΊͳ͍࢓૊Έ ʹ͓ͯ͘͠ ؅ཧը໘ μογϡϘʔυ Ͱ ௥Ճͨ͠ػೳΛ࢖͑ΔΑ͏ʹ͢Δ
  58. & $4+1$SFCPX4USJQF+11BZNFOUͷུ $4+1ϓϥάΠϯͰొ࿥ͨ͠৘ใΛ ΧελϜ౤ߘλΠϓͰ΋ར༻͢Δ " ؅ཧը໘ μογϡϘʔυ Ͱ ௥Ճͨ͠ػೳΛ࢖͑ΔΑ͏ʹ͢Δ

  59. & ·ͱΊ 4USJQF$IFDLPVUͷ࣮૷ʹ͍ͭͯͷ εςʔλε TUBOECZ TBMF QBVTF FOE TPMEPVU ελϯόΠ

    ൃചத ൃചٳࢭ ൃചऴྃ ചΓ੾Ε νέοτ໊ νέοτ໊ TJOHMF NVMUJQMF ຕߪೖ ෳ਺ߪೖ UJDLFU@TUBUVT UJDLFU@TUSJQF@JE UJDLFU@UZQF ։࠵೔ UJDLFU@EBZ ։৔࣌ؒ UJDLFU@PQFO ։ԋ࣌ؒ UJDLFU@TUBSU લചνέοτֹۚ UJDLFU@BEWBODF@TBMF ౰೔νέοτֹۚ UJDLFU@UIBUEBZ XQ@FORVFVF@TDSJQU KRVFSZVJDPSF  XQ@FORVFVF@TDSJQU KRVFSZVJEBUFQJDLFS  XQ@FORVFVF@TUZMF KRVFSZVJDTT BKBYHPPHMFBQJTDPNBKBYMJCTKRVFSZVJUIFNFTTNPPUIOFTTKRVFSZVJDTT  XQ@FORVFVF@TDSJQU KRVFSZVJKTKB BKBYHPPHMFBQJTDPNBKBYMJCTKRVFSZVJJOKRVFSZVJEBUFQJDLFSKBNJOKT  ։࠵೔͸K2VFSZ6*%BUFQJDLFS
  60. & ·ͱΊ 4USJQF$IFDLPVUͷ࣮૷ʹ͍ͭͯͷ QPTU@TUBUVT͕QVCMJTIɺQPTU@UZQF͕DSXTKQ@TUSJQF@JUFNͷσʔλΛऔಘ͠·͢ $query_ITEM = <<<SQL SELECT * FROM

    {$wpdb->posts} WHERE post_status = 'publish' AND post_type = 'crwsjp_stripe_item' SQL; $results_ITEM = $wpdb->get_results($query_ITEM); get_results ʹ͍ͭͯɹhttps://wpdocs.osdn.jp/ؔ਺ϦϑΝϨϯε/wpdb_Classࢀর $4+1ϓϥάΠϯͰอଘ͍ͯ͠ΔσʔλΛऔಘ͢Δ $4+1ϓϥάΠϯͰ͸ΧελϜ౤ߘλΠϓΛར༻ͯ͠σʔλΛอଘ͍ͯ͠·͢ɻ ֤छઃఆ৘ใ͸XQ@PQUJPOTʹอଘ͍ͯ͠·͢ɻ ͜ΕΒͷσʔλΛ͏·͘ར༻͢Ε͹ɺػೳΛͲΜͲΜ֦ு͢Δ͜ͱ͕Ͱ͖·͢ɻ
  61. & ·ͱΊ 4USJQF$IFDLPVUͷ࣮૷ʹ͍ͭͯͷ foreach($results_ITEM as $for_id){ $postid = $for_id ->

    ID; $valueid = $for_id -> ID; if(!isset($results_ITEM_id)){ $results_ITEM_id = array( $postid => $valueid ); }else{ $results_ITEM_id += array( $postid => $valueid ); } }
  62. & ·ͱΊ 4USJQF$IFDLPVUͷ࣮૷ʹ͍ͭͯͷ foreach($results_ITEM as $for_title){ $post_title = $for_title ->

    ID; $value_title = $for_title -> post_title; if(!isset($results_ITEM_title)){ $results_ITEM_title = array( $post_title => $value_title ); }else{ $results_ITEM_title += array( $post_title => $value_title ); } }
  63. # & ΧελϜ౤ߘλΠϓͱΧελϜϑΟʔϧυΛ࢖༻͍ͯ͠Δ ొ࿥ͨ͠৘ใΛදࣔͤ͞Δ 8PSE1SFTTͷجຊతͳΧελϚΠζͷ஌ࣝͰදࣔͰ͖Δɻ ଞऀ͕ϝϯςφϯεΛ୲౰͢Δ͜ͱʹͳͬͯ΋େৎ෉

  64. & ཁ๬ͷଟ͍૬ஊͱ ࠓޙͷ՝୊ʹ͍ͭͯ ࠷ޙʹɾɾɾ

  65. & ཁ๬ͷଟ͍૬ஊ νέοτΛൢച͍ͨ͠ͱ͍͏૬ஊ͸ҙ֎ʹଟ͍ ɾϥΠϒόʔΛܦӦ͞Ε͍ͯΔํ ɾηϛφʔ΍ϫʔΫγϣοϓΛ։࠵͍ͯ͠Δߨࢣͷํ ҿ৯ళ͞Μͷ৔߹ɺ༧໿ͱܾࡁʹ࢖༻͍ͨ͠ ɾϗοτϖούʔͰͷ༧໿ˠܾࡁͷ୅ସʹͳΒͳ͍͔ʁ क़΍͓ڭࣨͳͲɺαϒεΫϦϓγϣϯಋೖͷݕ౼

  66. & ཁ๬ͷଟ͍૬ஊ ػೳΛ࣋ͬͨαΠτ࡞Γ͕ࠓޙ͸ΑΓॏཁʹͳΔ ݸਓࣄۀऀ΍খن໛ձࣾͳͲ ͜Ε·ͰߴίετͰಋೖͰ͖ͳ͔ͬͨ૚΋ ܾࡁػೳ͕׆༻Ͱ͖ΔΑ͏ʹͳΔ

  67. & ࠓޙͷ՝୊ʹ͍ͭͯ 4USJQF#JMMJOHʢܧଓ՝ۚɾαϒεΫϦϓγϣϯʣͷ࣮૷ ੥ٻΛ͢ΔλΠϛϯά αʔϏε։࢝࣌ͳͷ͔ैྔ՝ۚʢͦͷ݄ͷར༻෼Λ݄࣍ͷ಄ʹ੥ٻ͢ΔͳͲʣ ஈ֊੍ྉۚ UJFSFEQSJDJOH ϥΠηϯε΍Ϣʔβ਺ɺར༻ϘϦϡʔϜͳͲʹԠͯ͡୯ՁΛม͑Δॲཧʹ͍ͭͯ ੥ٻαΠΫϧ ੥ٻ೔

    ຖिɺຖ݄ɺຖ೥ɺ࢛൒ظʹҰճͳͲ ຖ݄೔ɺ4VCTDSJQUJPOΛ։࢝ͨ͠೔෇Λى఺ʹ͢ΔFUD 8PSE1SFTT΁ͷରԠνΣοΫ ؅ཧը໘6*ͷݕ౼
  68. & ࣸਅͷఏڙ Ѫඤদࢁʹ͓ӽ͠ͷࡍ͸ɾɾɾ গ͠଍Λ৳͹ͯ͠ দࢁࢢӺ͔ΒλΫγʔͰ෼ Ѫඤݝদࢁࢢ৿দொ େͷ஍μΠϊδ

  69. & ͝ਗ਼ௌ͋ Γ ͕ ͱ ͏ ͝ ͟ ͍ ·

    ͠ ͨ