View
760
Download
3
Category
Preview:
Citation preview
PayPal Reference Transaction API をお財布ケータイぽく使ってみる
Junichi Okamura @API Meetup #12 February 4 2016
©2015 PayPal Inc. Confidential and proprietary.
Who am I?
©2015 PayPal Inc. Confidential and proprietary. 2
岡村 純一 Junichi OkamuraPayPal Integration Manager/EvangelistScala/Java/Ruby/Python/Node.js/PHP/../Mobile/../ppt
Rock/Wine/DQ/JOJO/I18N/Marketing/Payment
API Lover/Midnight Creator
@benzookapi
jokamura@paypal.com
今日お話ししたいこと
PayPal Reference Transaction API の画期的な使い方!
©2016 PayPal Inc. Confidential and proprietary.
PayPal Reference Transaction とは?
• 買い手に一度承認をもらえれば、その承認の ID だけで、任意の金額(通貨)を任意のタイミングで買い手から決済できる強力な API です。
• 強力な API なので実用には審査が要りますが、テスト環境( Sandbox )では、「 Upgrade to Pro 」ボタン一発で使えるようになります。
https://developer.paypal.com/docs/classic/express-checkout/integration-guide/ECReferenceTxns/
https://developer.paypal.com/developer/accounts/
©2016 PayPal Inc. Confidential and proprietary.
通常のユースケ ス−• ゲームや各種プラットフォーム向けの従量課金が一般的
• 2回目以降の支払いを自動化したり、月額定期払いに応用したりすることもできます
• 日本でも導入しているマーチャント(売り手)さんが続々増えています
©2016 PayPal Inc. Confidential and proprietary.
• ペイパルクリップ( https://www.paypal.jp/jp/clip_cp/)の TOP ページ
• ※ 全てが Reference Transaction を導入しているわけではありません。
©2016 PayPal Inc. Confidential and proprietary. 6
リファレンストランザクション 支払い同意取得( 支払い同意だけを単独で取得する場合 )
マーチャント様プログラムPayPal サイト
1. SetExpressCheckout → 決済金額を0円で送信 → MerchantInitiatedbilling を指定 ← token が返却される
決済選択PayPal
PayPalログイン
マーチャント様画面
PayPal 画面
Thank you
リファレンストランザクション同意画面
2. CreateBillingAgreement → token を送信 ← BillingAgreementD が返却されるのでシステムに 保存
PayPal サイトにリダイレクト( パラメタに token を付加する )
(1) (2)
PayPal からマーチャントサイトにリダイレクト( パラメタに token が付加される )
©2016 PayPal Inc. Confidential and proprietary. 7
リファレンストランザクション 支払い同意取得( 初回の決済と同時に同意を取得する場合 )
マーチャント様プログラムPayPal サイト
1. SetExpressCheckout → 決済情報 ( 金額、商品名など ) を送信 → MerchantInitiatedbilling を指定 ← token が返却される
決済選択PayPal
PayPalログイン
マーチャント様画面
PayPal 画面
Thank you
支払い承認画面
2. DoExpressCheckoutPayment → 最終決済指示 ( 金額など ) を送信 ← TRANCTIONID 、決済結果、 BillingAgreementID が返却されるので、 BillingAgreementID を保存
PayPal サイトにリダイレクト( パラメタに token を付加する )
(1) (2)
PayPal からマーチャントサイトにリダイレクト( パラメタに token が付加される )
©2016 PayPal Inc. Confidential and proprietary. 8
リファレンストランザクション 毎回決済時
マーチャント様プログラム
1. DoReferenceTransaction → BillingAgreementID 、金額などを送信 ← TRANSACTIONID 、決済情報などが返却される
マーチャント様画面
決済選択PayPal Thank you
マーチャント様プログラム
リファレンストランザクション API 詳細
• SetExpressCheckout − AMT = 0 ( 初回の決済と同時に同意を得る場合は、初回の決済額を指定 )− BILLINGTYPE = ‘MerchantInitiatedBilling’
• CreateBillingAgreement ( 支払い同意を単独で取得する場合 )− TOKEN = SetExpressCheckout で返却された token を指定
• DoExpressCheckoutPayment ( 初回決済と同時に支払い同意を取得の場合 )− TOKEN = SetExpressCheckout で返却された token を指定
− AMT = 初回決済額を指定
• DoReferenceTransaction− REFERENCEID = CreateBillingAgreement もしくは DoExpressCheckoutPayment で返却された
BillingAgreementID を指定
− AMT = 決済金額を指定
©2016 PayPal Inc. Confidential and proprietary. 9
リファレンストランザクションを組込む場合は、それぞれの API に以下のパラメタを設定します ( その他のパラメタについてはデベロッパーサイトを参照 ) 。
僕の Demo でも確認できます
https://jo-pp-ruby-demo.herokuapp.com/cl
©2016 PayPal Inc. Confidential and proprietary.
きっかけその①
味しめた
https://thinkit.co.jp/story/2015/11/12/6534
http://togetter.com/li/867390?page=8©2016 PayPal Inc. Confidential and proprietary.
きっかけその②
BitCoin
http://gigazine.net/news/20131224-bitcoin-stolen-on-air/
©2016 PayPal Inc. Confidential and proprietary.
思いつき
Billing Agreement ID を QR コード化すれば限定的だがハード非依存の
お財布ケータイができるのでは?
©2016 PayPal Inc. Confidential and proprietary.
イメージしたユーザー体験
JAL さんのタッチアンドゴー
https://www.jal.co.jp/k-tai/appli/touchandgo/©2016 PayPal Inc. Confidential and proprietary.
1.Billing Agreement 2. Reference Transaction2. Reference Transaction
決済できる ID を QR コード化って危ないのでは?
• クレジットカードとの比較−そもそも固定の生番号をいつも携帯している => 書き留められたり写されたら終わり−いろんなところで使える => 万能なゆえの被害拡散−止めるまで時間かかる => カスタマーセンターに電話して…
• BitCoin との比較−口座番号をそもそも QR コード化してるし…
• Billing Agreement は−自動生成のテキストデータ => エンコード( QR 化)しやすく再発行もしやすい−承認したマーチャントさんでしかつかえない => 盗まれても被害が小さい−PayPal にログインすればいつでも無効化できる=>買い手さんの方でいつでも止めれる
割とありなんではなかろうか…©2016 PayPal Inc. Confidential and proprietary.
今後の展望
• ①PayPal の支払いボタンのようにガジェット化して事前承認を簡単に組み込めるようする
• ②QR チェックアウトが使えるマーチャントのポータルサイトの構築
• ③POS レジやチックイン・アウトサービスとの連携
• ④TDD ( Talk Driven Development=登壇により自らを追い詰め強制的に突貫工事で作ること)で作ったソースコードを誰かに清書してほしい
イノベーションを目指す開発者さんのインスピレーションになれば嬉しいです!
©2016 PayPal Inc. Confidential and proprietary.
最後に…
PayPal の公式ソリューションではなく、単なるアイディアです!
(実用には審査がいります)https://www.paypal.jp/merchant/service/reference-transaction/
©2016 PayPal Inc. Confidential and proprietary.
告知①
Qiita 、スタックオーバーフローで投稿、質問受付中!http://qiita.com/tags/PayPal
http://ja.stackoverflow.com/questions/tagged/paypal
©2016 PayPal Inc. Confidential and proprietary.
告知②
明日パネルディスカッションに登壇します!http://2016.cross-party.com/program/d4
©2016 PayPal Inc. Confidential and proprietary.
Recommended