SORACOMを利用した自社開発農業IoTデバイスの課金をStripeでやってみた

 SORACOMを利用した自社開発農業IoTデバイスの課金をStripeでやってみた

JP_Stripes (Stripe ユーザーグループ)in サッポロ キックオフで発表した資料です。
#JP_Stripes
http://eventregist.com/e/JP_Stripes_CTS

312cc773dc86206cf9e494c3f413a8a9?s=128

Takehito Tanabe

April 10, 2018
Tweet

Transcript

  1. 4.
  2. 5.
  3. 6.
  4. 7.
  5. 9.
  6. 10.
  7. 11.
  8. 12.
  9. 13.
  10. 17.

    35,(/44 (14 *P5 AgriBus-G+ ʢ։ൃதʣ ߴਫ਼౓ͳ (14 ͱ೶ۀػցͱͷ௨৴ػೳΛ ซͤ࣋ͪɺ ҆ՁͰଟ໨తͳར༻͕Մೳ

    ɾ35,(/44 (14  ɾ(*P5.PEVMF ɾ.BDIJOF$POUSPM *40#64"(1035 ೶࡞ۀ৘ใϋϒαʔϏε AgriBus-Connect ะ৔৘ใɺ ࡞ۀཤྺɺ ػցͷௐࢠͳͲΛ ࣗಈه࿥͠Ϋϥ΢υ্ʹอଘ طଘͷ֤छ೶ۀ *5γεςϜ ࣗಈૢ଩Φϓγϣϯ AgriBus-AutoSteer ʢ։ൃதʣ ϞʔλʔۦಈͰϢʔβʵ͕؆୯ʹ୤ணՄೳ ઃܭਤ͸Φʔ ϓϯιʔ εͰެ։ ܗঢ়ʹ߹ΘͤͨΧελϚΠζ͕Մೳ "OESPJE04εϚϗ ɾ λϒϨο τ༻ τϥΫλʔӡసࢧԉΞϓϦ˞ AgriBus-NAVI ը໘දࣔΛݟͳ͕Β޿͍ะ৔಺Ͱ΋ ·͙ͬ͢౳ִؒʹ࡞ۀՄೳ AgriBus-NAVI ぇத৺〝「〔 ʢגʣ ೶ۀ৘ใઃܭࣾ〣औ〿૊〴 ˞ AgriBus-NAVI͸ಠཱߦ੓๏ਓ೶ۀɾ৯඼࢈ۀٕज़૯߹ݚڀػߏ ʢ೶ݚػߏʣ ͷݚڀ։ൃ੒ՌͰ͋Διϑ τ ΢ΤΞ ʮ೶༻ं྆࡞ۀφϏήʔγ ϣ ϯιϑ τ ΢ΤΞʯ ٴͼಛڐ ʢಛڐୈ ߸ʣ Λج൫ͱ ͯ͠։ൃ͞Ε͍ͯ·͢ɻ ˞ (PPHMF1MBZ͓Αͼ(PPHMF1MBZϩΰ͸ɺ (PPHMF*ODͷ঎ඪͰ͢ɻ Φϓγϣϯͷ௥ՃͰϩϘο τԽ ɾ *P5ԽʹରԠ ͜Ε·Ͱะ৔ʹࣺ͖ͯͯͨܭଌ ੍ޚ৘ใΛ ʮऩ֭ʯ ͯ͠༗ޮར༻ ʂ ৘ใఏڙɾ࿈ܞ ˟๺ւಓଳ޿ࢢ੢̔৚ೆ̐̌ஸ໨̍൪̒߸ IUUQBHSJJOGPEFTJHODPNDPOUBDU!BHSJJOGPEFTJHODPN
  11. 19.
  12. 20.
  13. 21.
  14. 22.

    35,(/44 (14 *P5 AgriBus-G+ ʢ։ൃதʣ ߴਫ਼౓ͳ (14 ͱ೶ۀػցͱͷ௨৴ػೳΛ ซͤ࣋ͪɺ ҆ՁͰଟ໨తͳར༻͕Մೳ

    ɾ35,(/44 (14  ɾ(*P5.PEVMF ɾ.BDIJOF$POUSPM *40#64"(1035 ೶࡞ۀ৘ใϋϒαʔϏε AgriBus-Connect ะ৔৘ใɺ ࡞ۀཤྺɺ ػցͷௐࢠͳͲΛ ࣗಈه࿥͠Ϋϥ΢υ্ʹอଘ طଘͷ֤छ೶ۀ *5γεςϜ ࣗಈૢ଩Φϓγϣϯ AgriBus-AutoSteer ʢ։ൃதʣ ϞʔλʔۦಈͰϢʔβʵ͕؆୯ʹ୤ணՄೳ ઃܭਤ͸Φʔ ϓϯιʔ εͰެ։ ܗঢ়ʹ߹ΘͤͨΧελϚΠζ͕Մೳ "OESPJE04εϚϗ ɾ λϒϨο τ༻ τϥΫλʔӡసࢧԉΞϓϦ˞ AgriBus-NAVI ը໘දࣔΛݟͳ͕Β޿͍ะ৔಺Ͱ΋ ·͙ͬ͢౳ִؒʹ࡞ۀՄೳ AgriBus-NAVI ぇத৺〝「〔 ʢגʣ ೶ۀ৘ใઃܭࣾ〣औ〿૊〴 ˞ AgriBus-NAVI͸ಠཱߦ੓๏ਓ೶ۀɾ৯඼࢈ۀٕज़૯߹ݚڀػߏ ʢ೶ݚػߏʣ ͷݚڀ։ൃ੒ՌͰ͋Διϑ τ ΢ΤΞ ʮ೶༻ं྆࡞ۀφϏήʔγ ϣ ϯιϑ τ ΢ΤΞʯ ٴͼಛڐ ʢಛڐୈ ߸ʣ Λج൫ͱ ͯ͠։ൃ͞Ε͍ͯ·͢ɻ ˞ (PPHMF1MBZ͓Αͼ(PPHMF1MBZϩΰ͸ɺ (PPHMF*ODͷ঎ඪͰ͢ɻ Φϓγϣϯͷ௥ՃͰϩϘο τԽ ɾ *P5ԽʹରԠ ͜Ε·Ͱะ৔ʹࣺ͖ͯͯͨܭଌ ੍ޚ৘ใΛ ʮऩ֭ʯ ͯ͠༗ޮར༻ ʂ ৘ใఏڙɾ࿈ܞ ˟๺ւಓଳ޿ࢢ੢̔৚ೆ̐̌ஸ໨̍൪̒߸ IUUQBHSJJOGPEFTJHODPNDPOUBDU!BHSJJOGPEFTJHODPN
  15. 28.
  16. 29.
  17. 30.
  18. 31.

    35,(/44 (14 *P5 AgriBus-G+ ʢ։ൃதʣ ߴਫ਼౓ͳ (14 ͱ೶ۀػցͱͷ௨৴ػೳΛ ซͤ࣋ͪɺ ҆ՁͰଟ໨తͳར༻͕Մೳ

    ɾ35,(/44 (14  ɾ(*P5.PEVMF ɾ.BDIJOF$POUSPM *40#64"(1035 ೶࡞ۀ৘ใϋϒαʔϏε AgriBus-Connect ะ৔৘ใɺ ࡞ۀཤྺɺ ػցͷௐࢠͳͲΛ ࣗಈه࿥͠Ϋϥ΢υ্ʹอଘ طଘͷ֤छ೶ۀ *5γεςϜ ࣗಈૢ଩Φϓγϣϯ AgriBus-AutoSteer ʢ։ൃதʣ ϞʔλʔۦಈͰϢʔβʵ͕؆୯ʹ୤ணՄೳ ઃܭਤ͸Φʔ ϓϯιʔ εͰެ։ ܗঢ়ʹ߹ΘͤͨΧελϚΠζ͕Մೳ "OESPJE04εϚϗ ɾ λϒϨο τ༻ τϥΫλʔӡసࢧԉΞϓϦ˞ AgriBus-NAVI ը໘දࣔΛݟͳ͕Β޿͍ะ৔಺Ͱ΋ ·͙ͬ͢౳ִؒʹ࡞ۀՄೳ AgriBus-NAVI ぇத৺〝「〔 ʢגʣ ೶ۀ৘ใઃܭࣾ〣औ〿૊〴 ˞ AgriBus-NAVI͸ಠཱߦ੓๏ਓ೶ۀɾ৯඼࢈ۀٕज़૯߹ݚڀػߏ ʢ೶ݚػߏʣ ͷݚڀ։ൃ੒ՌͰ͋Διϑ τ ΢ΤΞ ʮ೶༻ं྆࡞ۀφϏήʔγ ϣ ϯιϑ τ ΢ΤΞʯ ٴͼಛڐ ʢಛڐୈ ߸ʣ Λج൫ͱ ͯ͠։ൃ͞Ε͍ͯ·͢ɻ ˞ (PPHMF1MBZ͓Αͼ(PPHMF1MBZϩΰ͸ɺ (PPHMF*ODͷ঎ඪͰ͢ɻ Φϓγϣϯͷ௥ՃͰϩϘο τԽ ɾ *P5ԽʹରԠ ͜Ε·Ͱะ৔ʹࣺ͖ͯͯͨܭଌ ੍ޚ৘ใΛ ʮऩ֭ʯ ͯ͠༗ޮར༻ ʂ ৘ใఏڙɾ࿈ܞ ˟๺ւಓଳ޿ࢢ੢̔৚ೆ̐̌ஸ໨̍൪̒߸ IUUQBHSJJOGPEFTJHODPNDPOUBDU!BHSJJOGPEFTJHODPN
  19. 32.

    35,(/44 (14 *P5 AgriBus-G+ ʢ։ൃதʣ ߴਫ਼౓ͳ (14 ͱ೶ۀػցͱͷ௨৴ػೳΛ ซͤ࣋ͪɺ ҆ՁͰଟ໨తͳར༻͕Մೳ

    ɾ35,(/44 (14  ɾ(*P5.PEVMF ɾ.BDIJOF$POUSPM *40#64"(1035 ʢ Φϓγϣϯͷ௥ՃͰϩϘο τԽ *P5ԽʹରԠ
  20. 46.
  21. 53.
  22. 54.

    ૹ৴͞Εͯ͘Δ+40/ʢসʣ {"id":"evt_1CEzuXLC79AVHbbSSM9FOEW0","object":"event","api_version":"2018-02-06","created":1523279993,"data": {"object":{"id":"in_1CEzuWLC79AVHbbSlqvJ7CQ5","object":"invoice","amount_due":2160,"amount_paid": 2160,"amount_remaining":0,"application_fee":null,"attempt_count": 0,"attempted":true,"billing":"charge_automatically","charge":"ch_1CEzuWLC79AVHbbSHUQueAhk","closed":true,"cur rency":"jpy","customer":"cus_CRNAwZ99jgut59","date": 1523279992,"description":null,"discount":null,"due_date":null,"ending_balance":0,"forgiven":false,"lines": {"object":"list","data":[{"id":"sub_CeIVB5oPxpPWw1","object":"line_item","amount": 2000,"currency":"jpy","description":"1×AgriBus-G+(at¥2,000/ month)","discountable":true,"livemode":false,"metadata":

    {"aid_my_product_type":"GPlus","aid_username":"dev-0000000000000048","aid_my_product_number":"AGBGP- SN-1","aid_my_product_sim_imsi":"4401031451227xx"},"period":{"end":1525871992,"start":1523279992},"plan": {"id":"plan_gplus-cellular-monthly-jpy","object":"plan","amount":2000,"billing_scheme":"per_unit","created": 1520220039,"currency":"jpy","interval":"month","interval_count":1,"livemode":false,"metadata": {},"nickname":"3G/LTE通信:月払 い","product":"prod_gplus","tiers":null,"tiers_mode":null,"transform_usage":null,"trial_period_days":null,"us age_type":"licensed"},"proration":false,"quantity": 1,"subscription":null,"subscription_item":"si_CeIVUuNNkIFvGi","type":"subscription"}],"has_more":false,"total _count":1,"url":"/v1/invoices/in_1CEzuWLC79AVHbbSlqvJ7CQ5/lines"},"livemode":false,"metadata": {},"next_payment_attempt":null,"number":"804791B-0004","paid":true,"period_end":1523279992,"period_start": 1523279992,"receipt_number":null,"starting_balance": 0,"statement_descriptor":null,"subscription":"sub_CeIVB5oPxpPWw1","subtotal":2000,"tax":160,"tax_percent": 8,"total":2160,"webhooks_delivered_at":null}},"livemode":false,"pending_webhooks":1,"request": {"id":"req_puvLaeHmQT4OKC","idempotency_key":null},"type":"invoice.payment_succeeded"}
  23. 55.

    "tax": 160, "tax_percent": 8, "total": 2160, "webhooks_delivered_at": null } },

    "livemode": false, "pending_webhooks": 1, "request": { "id": "req_puvLaeHmQT4OKC", "idempotency_key": null }, "type": "invoice.payment_succeeded" }
  24. 56.

    "aid_my_product_number": "AGBGP-SN-1", "aid_my_product_sim_imsi": "4401031451227xx" }, "period": { "end": 1525871992, "start":

    1523279992 }, "plan": { "id": "plan_gplus-cellular-monthly-jpy", "object": "plan", "amount": 2000, "billing_scheme": "per_unit", "created": 1520220039, "currency": "jpy", "interval": "month", "interval_count": 1, "livemode": false, "metadata": {}, "nickname": "3G/LTE通信: 月払い", "product": "prod_gplus", "tiers": null, "tiers_mode": null, "transform_usage": null, "trial_period_days": null, "usage_type": "licensed"
  25. 57.

    { "id": "sub_CeIVB5oPxpPWw1", "object": "line_item", "amount": 2000, "currency": "jpy", "description":

    "1 × AgriBus-G+ (at ¥2,000 / month)", "discountable": true, "livemode": false, "metadata": { "aid_my_product_type": "GPlus", "aid_username": "dev-0000000000000048", "aid_my_product_number": "AGBGP-SN-1", "aid_my_product_sim_imsi": "4401031451227xx" }, "period": { "end": 1525871992, "start": 1523279992 }, "plan": { "id": "plan_gplus-cellular-monthly-jpy", "object": "plan", "amount": 2000, "billing_scheme": "per_unit", "created": 1520220039, "currency": "jpy", 4*.Λࣝผ͢Δ ͨΊͷ৘ใ