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

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

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

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

Takehito Tanabe

April 10, 2018
Tweet

More Decks by Takehito Tanabe

Other Decks in Technology

Transcript

  1. 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
  2. 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
  3. 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
  4. 35,(/44 (14 *P5 AgriBus-G+ ʢ։ൃதʣ ߴਫ਼౓ͳ (14 ͱ೶ۀػցͱͷ௨৴ػೳΛ ซͤ࣋ͪɺ ҆ՁͰଟ໨తͳར༻͕Մೳ

    ɾ35,(/44 (14  ɾ(*P5.PEVMF ɾ.BDIJOF$POUSPM *40#64"(1035 ʢ Φϓγϣϯͷ௥ՃͰϩϘο τԽ *P5ԽʹରԠ
  5. ૹ৴͞Εͯ͘Δ+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"}
  6. "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" }
  7. "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"
  8. { "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*.Λࣝผ͢Δ ͨΊͷ৘ใ