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

Enhance Customers Payment Experience with LINE Pay API

Enhance Customers Payment Experience with LINE Pay API

LINE Thailand Developer Conference 2019
https://www.facebook.com/events/410021356453349/

LINE Developers
PRO

June 04, 2019
Tweet

More Decks by LINE Developers

Other Decks in Technology

Transcript

  1. SITTHI THIAMMEKHA LINE API Expert EMETWORKS CO., LTD. ENHANCE CUSTOMER'S

    PAYMENT EXPERIENCE WITH RABBIT LINE PAY API
  2. “LINE API EXPERT” (LAE) LINE API Expert is a program

    that recognizes skilled engineers who have a deep understanding of the APIs provided by LINE and are influential in the community by giving them the title of "LINE API experts"
  3. LINE API EXPERT RESPONSIBILITIES A : API Expert

  4. LINE API EXPERT RESPONSIBILITIES A : API Expert B :

    Blog
  5. LINE API EXPERT RESPONSIBILITIES A : API Expert B :

    Blog C : Contribution
  6. LAE IN THAILAND Annop Kobkij Winn Voravuthikunchai Teerachart Kortrakul Aeknarin

    Sirisub Sitthi Thiammekha
  7. • LINE Messaging API • LINE Frontend Framework • LINE

    Beacon • Rabbit LINE Pay API LAE IN THAILAND
  8. ENHANCE CUSTOMER'S PAYMENT EXPERIENCE WITH RABBIT LINE PAY API

  9. ENHANCE CUSTOMER'S PAYMENT EXPERIENCE WITH RABBIT LINE PAY API

  10. None
  11. PAYMENT IS EASY

  12. RABBIT LINE PAY API OVERVIEW

  13. RABBIT LINE PAY API OVERVIEW RESERVE API

  14. RABBIT LINE PAY API OVERVIEW

  15. RABBIT LINE PAY API OVERVIEW SERVER / CLIENT CALLBACK

  16. RABBIT LINE PAY API OVERVIEW SERVER / CLIENT CONFIRM API

  17. RABBIT LINE PAY API OVERVIEW SERVER / CLIENT CONFIRM API

    CAPTURE API
  18. RABBIT LINE PAY API OVERVIEW

  19. LET’S START • Create Sandbox Account • API Endpoint &

    Headers • Reserve API • Confirm API • Others API • Transaction ➩
  20. CREATE SANDBOX ACCOUNT https://pay.line.me/th/ developers/techsupport/ sandbox/creation?locale=th_TH

  21. CREATE SANDBOX ACCOUNT

  22. CREATE SANDBOX ACCOUNT

  23. CREATE SANDBOX ACCOUNT

  24. CREATE SANDBOX ACCOUNT

  25. CREATE SANDBOX ACCOUNT

  26. CREATE SANDBOX ACCOUNT

  27. • Create Sandbox Account • API Endpoint & Headers •

    Reserve API • Confirm API • Others API • Transaction ➩ API ENDPOINT & HEADERS
  28. API ENDPOINT & HEADERS API Endpoint Sandbox https://sandbox-api-pay.line.me Production https://api-pay.line.me

    Headers Content-Type application/json X-LINE-ChannelId {channel-id} X-LINE-ChannelSecret {channel-secret-key}
  29. • Create Sandbox Account • API Endpoint & Headers •

    Reserve API • Confirm API • Others API • Transaction ➩ RESERVE API
  30. RESERVE API HTTP Request POST /v2/payments/request

  31. RESERVE API Request JSON Body Params Required Description productName Y

    Product name (charset: UTF-8) productImageUrl Product image URL amount Y Payment amount currency Y [USD / JPY / TWD / THB] orderId Y Unique reference number confirmUrl Y Callback/Redirect URL confirmUrlType [CLIENT / SERVER] payType [NORMAL / PREAPPROVED] langCd [en / ko / ja / th / zh-Hans /zh-Hant] capture [true / false]
  32. RESERVE API Request JSON Body Params Required Description productName Y

    Product name (charset: UTF-8) productImageUrl Product image URL amount Y Payment amount currency Y [USD / JPY / TWD / THB] orderId Y Unique reference number confirmUrl Y Callback/Redirect URL confirmUrlType [CLIENT / SERVER] payType [NORMAL / PREAPPROVED] langCd [en / ko / ja / th / zh-Hans /zh-Hant] capture [true / false]
  33. RESERVE API Request JSON Body Params Required Description productName Y

    Product name (charset: UTF-8) productImageUrl Product image URL amount Y Payment amount currency Y [USD / JPY / TWD / THB] orderId Y Unique reference number confirmUrl Y Callback/Redirect URL confirmUrlType [CLIENT / SERVER] payType [NORMAL / PREAPPROVED] langCd [en / ko / ja / th / zh-Hans /zh-Hant] capture [true / false]
  34. RESERVE API Request JSON Body Params Required Description productName Y

    Product name (charset: UTF-8) productImageUrl Product image URL amount Y Payment amount currency Y [USD / JPY / TWD / THB] orderId Y Unique reference number confirmUrl Y Callback/Redirect URL confirmUrlType [CLIENT / SERVER] payType [NORMAL / PREAPPROVED] langCd [en / ko / ja / th / zh-Hans /zh-Hant] capture [true / false]
  35. RESERVE API Request JSON Body Params Required Description productName Y

    Product name (charset: UTF-8) productImageUrl Product image URL amount Y Payment amount currency Y [USD / JPY / TWD / THB] orderId Y Unique reference number confirmUrl Y Callback/Redirect URL confirmUrlType [CLIENT / SERVER] payType [NORMAL / PREAPPROVED] langCd [en / ko / ja / th / zh-Hans /zh-Hant] capture [true / false]
  36. RESERVE API Request JSON Body Params Required Description productName Y

    Product name (charset: UTF-8) productImageUrl Product image URL amount Y Payment amount currency Y [USD / JPY / TWD / THB] orderId Y Unique reference number confirmUrl Y Callback/Redirect URL confirmUrlType [CLIENT / SERVER] payType [NORMAL / PREAPPROVED] langCd [en / ko / ja / th / zh-Hans /zh-Hant] capture [true / false]
  37. RESERVE API Request JSON Body Params Required Description productName Y

    Product name (charset: UTF-8) productImageUrl Product image URL amount Y Payment amount currency Y [USD / JPY / TWD / THB] orderId Y Unique reference number confirmUrl Y Callback/Redirect URL confirmUrlType [CLIENT / SERVER] payType [NORMAL / PREAPPROVED] langCd [en / ko / ja / th / zh-Hans /zh-Hant] capture [true / false]
  38. RESERVE API Request JSON Body Params Required Description productName Y

    Product name (charset: UTF-8) productImageUrl Product image URL amount Y Payment amount currency Y [USD / JPY / TWD / THB] orderId Y Unique reference number confirmUrl Y Callback/Redirect URL confirmUrlType [CLIENT / SERVER] payType [NORMAL / PREAPPROVED] langCd [en / ko / ja / th / zh-Hans /zh-Hant] capture [true / false]
  39. RESERVE API Request JSON Body Params Required Description productName Y

    Product name (charset: UTF-8) productImageUrl Product image URL amount Y Payment amount currency Y [USD / JPY / TWD / THB] orderId Y Unique reference number confirmUrl Y Callback/Redirect URL confirmUrlType [CLIENT / SERVER] payType [NORMAL / PREAPPROVED] langCd [en / ko / ja / th / zh-Hans /zh-Hant] capture [true / false]
  40. RESERVE API Request JSON Body Params Required Description productName Y

    Product name (charset: UTF-8) productImageUrl Product image URL amount Y Payment amount currency Y [USD / JPY / TWD / THB] orderId Y Unique reference number confirmUrl Y Callback/Redirect URL confirmUrlType [CLIENT / SERVER] payType [NORMAL / PREAPPROVED] langCd [en / ko / ja / th / zh-Hans /zh-Hant] capture [true / false]
  41. RESERVE API function reservePayment(req, res) { const { productName, amount,

    orderId } = req.body; const url = `…/v2/payments/request`; const payload = { productImageUrl:IMAGE_URL, productName, amount, orderId, currency: 'THB', confirmUrl: `${config.apiUrl}/confirmPayment`, langCd: 'th', confirmUrlType: 'SERVER', };
  42. RESERVE API { "returnCode": "0000", "returnMessage": "Success.", "info": { "paymentUrl":

    { "web": "https://sandbox-web-pay.line.me/web/ payment/wait?transactionReserveId=xxxxx", "app": "line://pay/payment/xxxxx" }, "transactionId": 2019052400052785400, "paymentAccessToken": "636329400726" } } Response
  43. RESERVE API { "returnCode": "0000", "returnMessage": "Success.", "info": { "paymentUrl":

    { "web": "https://sandbox-web-pay.line.me/web/ payment/wait?transactionReserveId=xxxxx", "app": "line://pay/payment/xxxxx" }, "transactionId": 2019052400052785400, "paymentAccessToken": "636329400726" } } Response
  44. RESERVE API confirmUrlType CLIENT SERVER

  45. • Create Sandbox Account • API Endpoint & Headers •

    Reserve API • Confirm API • Others API • Transaction ➩ CONFIRM API
  46. CONFIRM API HTTP Request POST /v2/payments/{transactionId}/confirm Request JSON Body Params

    Required Description amount Y Payment amount currency Y [USD / JPY / TWD / THB]
  47. CONFIRM API function confirmPayment(req, res) { const { transactionId }

    = req.body; const url = `…/v2/payments/${transactionId}/confirm`; const order = await readDB(transactionId); const body = { amount: order.amount, currency: order.currency, }; return rp({ method: 'POST', uri: url, body, headers, json: true, }); };
  48. CONFIRM API { "returnCode": "0000", "returnMessage": "Success.", "info": { "transactionId":

    2019052400052787200, "orderId": "1558643411038", "payInfo": [ { "method": "CREDIT_CARD", "amount": 138 } ] } } Response
  49. CONFIRM API if (response && response.returnCode === '0000') { data.status

    = 'paid'; saveOrder(orderId, data); line.pushMessage(data.userId, { type: 'text', text: 'ได้รับชําระเงินเรียบร้อยแล้ว', }); }
  50. • Create Sandbox Account • API Endpoint & Headers •

    Reserve API • Confirm API • Others API • Transaction ➩ OTHERS API
  51. OTHERS API RESERVE

  52. OTHERS API RESERVE Reserve API

  53. OTHERS API RESERVE AUTH CANCEL Reserve API User

  54. OTHERS API RESERVE AUTH CANCEL Reserve API User Confirm API

  55. OTHERS API RESERVE CAPTURE_WAIT AUTH CANCEL CAPTURE Reserve API User

    Confirm API capture=true capture=false
  56. RESERVE API Request JSON Body Params Required Description productName Y

    Product name (charset: UTF-8) productImageUrl Product image URL amount Y Payment amount currency Y [USD / JPY / TWD / THB] orderId Y Unique reference number confirmUrl Y Callback/Redirect URL confirmUrlType [CLIENT / SERVER] payType [NORMAL / PREAPPROVED] langCd [en / ko / ja / th / zh-Hans /zh-Hant] capture [true / false]
  57. OTHERS API RESERVE CAPTURE_WAIT AUTH CANCEL CAPTURE Reserve API User

    Confirm API capture=true capture=false
  58. CAPTURE API RESERVE CAPTURE_WAIT AUTH CANCEL CAPTURE Reserve API User

    Confirm API capture=true capture=false Capture API
  59. CAPTURE API HTTP Request POST /v2/payments/authorizations/{transactionId}/capture Request JSON Body Params

    Required Description amount Y Payment amount currency Y [USD / JPY / TWD / THB]
  60. CAPTURE API { "returnCode": "0000", "returnMessage": "OK", "info": { "transactionId":

    20140101123123123, "orderId": "order_210124213", "payInfo": [{ "method": "BALANCE", "amount": 10 },{ "method": "DISCOUNT", "amount": 10 }] } } Response
  61. CAPTURE API RESERVE CAPTURE_WAIT AUTH CANCEL CAPTURE Reserve API User

    Confirm API capture=true capture=false Capture API
  62. VOID API RESERVE CAPTURE_WAIT AUTH CANCEL CAPTURE Reserve API User

    Confirm API capture=true capture=false Void API VOID Capture API
  63. VOID API HTTP Request POST /v2/payments/authorizations/{transactionId}/void { "returnCode": "0000", "returnMessage":

    "OK" } Response
  64. VOID API RESERVE CAPTURE_WAIT AUTH CANCEL CAPTURE Reserve API User

    Confirm API capture=true capture=false Void API VOID Capture API
  65. REFUND API RESERVE CAPTURE_WAIT AUTH CANCEL CAPTURE Reserve API User

    Confirm API capture=true capture=false Void API VOID Capture API
  66. REFUND API RESERVE CAPTURE_WAIT AUTH CANCEL CAPTURE Reserve API User

    Confirm API capture=true capture=false REFUND Refund API Void API VOID Capture API
  67. REFUND API HTTP Request POST /v2/payments/{transactionId}/refund Request JSON Body Params

    Required Description refundAmount Full refund if params not passed
  68. REFUND API { "returnCode": "0000", "returnMessage": "success", "info": { "refundTransactionId":

    123123123123, "refundTransactionDate": "2014-01-01T06:17:41Z" } } Response
  69. REFUND API RESERVE CAPTURE_WAIT AUTH CANCEL CAPTURE Reserve API User

    Confirm API capture=true capture=false REFUND Refund API Void API VOID Capture API
  70. PREAPPROVED API RESERVE CAPTURE_WAIT AUTH CANCEL CAPTURE Reserve API User

    Confirm API capture=true capture=false Capture API Void API VOID REFUND Refund API Preapproved API
  71. RESERVE API Request JSON Body Params Required Description productName Y

    Product name (charset: UTF-8) productImageUrl Product image URL amount Y Payment amount currency Y [USD / JPY / TWD / THB] orderId Y Unique reference number confirmUrl Y Callback/Redirect URL confirmUrlType [CLIENT / SERVER] payType [NORMAL / PREAPPROVED] langCd [en / ko / ja / th / zh-Hans /zh-Hant] capture [true / false]
  72. CONFIRM API (PREAPPROVED) { "returnCode": "0000", "returnMessage": "Success.", "info": {

    "transactionId": 2019052400052787200, "orderId": "1558643411038", "payInfo": [ { "method": "CREDIT_CARD", "amount": 138 } ], "regKey": "RKf930b19XTF1TX" } } Response
  73. PREAPPROVED API RESERVE CAPTURE_WAIT AUTH CANCEL CAPTURE Reserve API User

    Confirm API capture=true capture=false Capture API Void API VOID REFUND Refund API Preapproved API
  74. PREAPPROVED API HTTP Request POST /v2/payments/preapprovedPay/{regKey}/payment Request JSON Body Params

    Required Description productName Y Product name (charset: UTF-8) amount Y Payment amount currency Y [USD / JPY / TWD / THB] orderId Y Unique reference number capture [true / false]
  75. PREAPPROVED API { "returnCode": "0000", "returnMessage": "OK", "info": { "transactionId":

    123123123123, "transactionDate": "2014-01-01T06:17:41Z" } } Response
  76. PREAPPROVED API RESERVE CAPTURE_WAIT AUTH CANCEL CAPTURE Reserve API User

    Confirm API capture=true capture=false Capture API Void API VOID REFUND Refund API Preapproved API
  77. GET API HTTP Request GET /v2/payments Request JSON Body Params

    Required Description transactionId[] List of transaction IDs orderId[] List of order IDs
  78. GET API { "returnCode": "0000", "returnMessage": "success", "info": [{ "transactionId":

    1020140728100001997, "transactionDate": "2014-07-28T09:48:43Z", "transactionType": "PAYMENT", "payInfo": [{ "method": "BALANCE", "amount": 10 },{ "method": "DISCOUNT", "amount": 10 }], "productName": "tes production", "currency": "USD", "orderId": "20140101123123123", } ] } { "returnCode": "0000", "returnMessage": "success", "info": [ { "transactionId": 1020140728100001997, "transactionDate": "2014-07-28T09:48:43Z", "transactionType": "PARTIAL_REFUND", "amount": -5, "productName": "", "currency": "USD", "orderId": "20140101123123123", "originalTransactionId": 1020140728100001999 } ] } Response Response
  79. • Create Sandbox Account • API Endpoint & Headers •

    Reserve API • Confirm API • Others API • Transaction ➩ TRANSACTIONS
  80. TRANSACTIONS

  81. TRANSACTIONS

  82. DEMO

  83. REFERENCES https://github.com/kamnan43/linepay-demo Demo source code https://pay.line.me/th/developers/documentation/download/tech?locale=th_TH Rabbit LINE Pay API

    Document https://pay.line.me/th/developers/documentation/download/logo?locale=th_TH Rabbit LINE Pay Logo
  84. SEE YOU @ ASK LINE API EXPERT BOOTH

  85. THANK_YOU