Q&A

Line Pay(v3, Sandbox) confirmUrlType が SERVER だと confirmUrl が呼ばれない

前提・実現したいこと

LINE Payで決済ができるBotを開発しております。 LINE Pay OnlineAPI(v3) を使って Sandbox 宛てに RequestAPI を呼び出しています。 このとき、redirectUrls.confirmUrlType に "CLIENT" を指定すると、決済後に redirectUrls.confirmUrl に指定した URL が呼ばれています。

ところが Server-to-Server を実現しようとして redirectUrls.confirmUrlType に "SERVER" を指定すると、決済しても redirectUrls.confirmUrl に指定した URL が呼ばれません。

redirectUrls.confirmUrlType に "SERVER" を指定して redirectUrls.confirmUrl が呼ばれるには、どうすればよいのでしょうか? 設定する項目が不足しているのでしょうか?

redirectUrls.confirmUrlType に "CLIENT" を指定したときのログ(JSON)

2021-11-18 13:06:33,561 [5    ][DEBUG] LINEBotApplication1.LineBotApp+<HandleTextAsync>d__20 MoveNext(374) - Reserve(ジュース)
2021-11-18 13:06:33,618 [5    ][DEBUG] LINEBotApplication1.LineBotApp+<HandleTextAsync>d__20 MoveNext(376) - {
  "amount": 1,
  "currency": "JPY",
  "orderId": "1afb29d6-c382-42d3-b549-ce7ab3c543f7",
  "packages": [
    {
      "products": [
        {
          "id": "104",
          "name": "ジュース",
          "imageUrl": null,
          "quantity": 1,
          "price": 1,
          "originalPrice": 1
        }
      ],
      "id": "1",
      "amount": 1,
      "userFee": 0,
      "userFeeAmount": 0,
      "name": null
    }
  ],
  "redirectUrls": {
    "appPackageName": null,
    "confirmUrl": "https://cdaf-183-177-200-198.jp.ngrok.io/api/confirm",
    "confirmUrlType": "CLIENT",
    "cancelUrl": "https://cdaf-183-177-200-198.jp.ngrok.io/api/cancel"
  },
  "options": {
    "payment": {
      "capture": true,
      "payType": "NORMAL"
    },
    "display": {
      "locale": "en",
      "checkConfirmUrlBrowser": false
    },
    "shipping": null,
    "extra": null
  }
}
2021-11-18 13:06:34,872 [5    ][DEBUG] LINEBotApplication1.LineBotApp+<HandleTextAsync>d__20 MoveNext(381) - ReserveResponse(ジュース)
2021-11-18 13:06:34,884 [5    ][DEBUG] LINEBotApplication1.LineBotApp+<HandleTextAsync>d__20 MoveNext(383) - {
  "info": {
    "transactionId": 2021111800696173810,
    "paymentAccessToken": "913262250024",
    "paymentUrl": {
      "app": "line://pay/payment/dWRhaldNaTFIc1c0cHN5TTBGT1dHWlQ0dlpGKzIrc1gwSHdrSHdsMDd2a2hmWlZrK2ZmQktjKzZydTltVzNmTg",
      "web": "https://sandbox-web-pay.line.me/web/payment/wait?transactionReserveId=dWRhaldNaTFIc1c0cHN5TTBGT1dHWlQ0dlpGKzIrc1gwSHdrSHdsMDd2a2hmWlZrK2ZmQktjKzZydTltVzNmTg"
    }
  },
  "returnCode": "0000",
  "returnMessage": "Success."
}
2021-11-18 13:07:01,425 [7    ][DEBUG] LINEBotApplication1.Controllers.PayConfirmController+<Confirm>d__9 MoveNext(62) - Confirm
2021-11-18 13:07:01,429 [7    ][DEBUG] LINEBotApplication1.Controllers.PayConfirmController+<Confirm>d__9 MoveNext(64) - {
  "amount": 1,
  "currency": "JPY"
}
2021-11-18 13:07:06,279 [6    ][DEBUG] LINEBotApplication1.Controllers.PayConfirmController+<Confirm>d__9 MoveNext(69) - ConfirmResponse
2021-11-18 13:07:06,287 [6    ][DEBUG] LINEBotApplication1.Controllers.PayConfirmController+<Confirm>d__9 MoveNext(71) - {
  "info": {
    "orderId": "1afb29d6-c382-42d3-b549-ce7ab3c543f7",
    "transactionId": 2021111800696173810,
    "authorizationExpireDate": "0001-01-01T00:00:00",
    "regKey": null,
    "payInfo": [
      {
        "method": "BALANCE",
        "amount": 1,
        "creditCardNickname": null,
        "creditCardBrand": "VISA"
      }
    ],
    "packages": [
      {
        "id": "1",
        "amount": 1,
        "userFee": 0,
        "userFeeAmount": 0,
        "name": null
      }
    ],
    "shipping": null
  },
  "returnCode": "0000",
  "returnMessage": "Success."
}

redirectUrls.confirmUrlType に "SERVER" を指定したときのログ(JSON)

2021-11-18 13:09:16,438 [6    ][DEBUG] LINEBotApplication1.LineBotApp+<HandleTextAsync>d__20 MoveNext(314) - Reserve(チョコレート)
2021-11-18 13:09:16,438 [6    ][DEBUG] LINEBotApplication1.LineBotApp+<HandleTextAsync>d__20 MoveNext(316) - {
  "amount": 1,
  "currency": "JPY",
  "orderId": "91ea4356-521a-49d9-a75d-f51da7680d63",
  "packages": [
    {
      "products": [
        {
          "id": "445",
          "name": "チョコレート",
          "imageUrl": null,
          "quantity": 1,
          "price": 1,
          "originalPrice": 1
        }
      ],
      "id": "1",
      "amount": 1,
      "userFee": 0,
      "userFeeAmount": 0,
      "name": null
    }
  ],
  "redirectUrls": {
    "appPackageName": null,
    "confirmUrl": "https://cdaf-183-177-200-198.jp.ngrok.io/api/confirm",
    "confirmUrlType": "SERVER",
    "cancelUrl": "https://cdaf-183-177-200-198.jp.ngrok.io/api/cancel"
  },
  "options": {
    "payment": {
      "capture": true,
      "payType": "NORMAL"
    },
    "display": {
      "locale": "en",
      "checkConfirmUrlBrowser": false
    },
    "shipping": null,
    "extra": null
  }
}
2021-11-18 13:09:17,979 [6    ][DEBUG] LINEBotApplication1.LineBotApp+<HandleTextAsync>d__20 MoveNext(321) - ReserveResponse(チョコレート)
2021-11-18 13:09:17,980 [6    ][DEBUG] LINEBotApplication1.LineBotApp+<HandleTextAsync>d__20 MoveNext(323) - {
  "info": {
    "transactionId": 2021111800696174210,
    "paymentAccessToken": "052616114030",
    "paymentUrl": {
      "app": "line://pay/payment/a2pTa1dKQ2tJY1Z3cFBpTW9DRmVIZC9Ha25Nc2NNdHI0T1YyYWNNVzNjVlBWNEhmeUl0Q2lRR0t4c3RMTFpsYQ",
      "web": "https://sandbox-web-pay.line.me/web/payment/wait?transactionReserveId=a2pTa1dKQ2tJY1Z3cFBpTW9DRmVIZC9Ha25Nc2NNdHI0T1YyYWNNVzNjVlBWNEhmeUl0Q2lRR0t4c3RMTFpsYQ"
    }
  },
  "returnCode": "0000",
  "returnMessage": "Success."
}

補足情報(FW/ツールのバージョンなど)

LINE Pay OnlineAPI v3 VS 2019 C# https://github.com/kenakamu/line-pay-csharp をv3向けに改修して用いています。 さらに https://github.com/pierre3/LineMessagingApi を用いて LINE Pay APIを使ってアプリに決済を組み込む方法 C# 編 を参考にして実装しています。

  • 0
  • 0
  • 1333
  • twitter facebook

Similar posts

    No similar posts

Are you sure? question.vm