Normally, when navigating directly from PayPay to the merchant site, the merchant does not need to handle one_time_token separately. After logging in to PayPay, PayPay redirects to the configured redirectUrl with one_time_token appended. Even when opening the URL with one_time_token in a WebView as is, no additional process is required to transfer the token.
However, if your configuration changes the return URL—for example, if the user returns to the app after logging in through an external browser and the app opens a payment page in a WebView that differs from the redirectUrl—you must pass one_time_token to the WebView. The initial pp.init initializes the JSSDK using this token.
Steps for returning to a WebView
- When returning from PayPay to the
redirectUrlconfigured withpp.getLoginUrl,pp.render, or/v2/smartpayment/qr/sessions, retrieve theone_time_tokenappended to the URL. - When constructing the URL to open in the app's WebView, pass the
one_time_tokenas a query parameter. For example, if the payment page to open in the WebView ishttps://example.com/checkout, usehttps://example.com/checkout?one_time_token={value}. - After launching the WebView, promptly execute the initial
pp.initwhile the token retained at the return destination is available for use.
Notes
one_time_tokenis a temporary token. The specific validity period in seconds has not been disclosed. Do not unnecessarily delay launching the WebView or executing the initialpp.initafter the redirect.- In the ticket case, in addition to passing
one_time_token, it was necessary to retain the cookie forppjssdk.codeVerifiergenerated whenpp.getLoginUrlwas executed untilpp.initafter login. If initialization fails even after passing the token, check whether the cookie has been deleted or changed. - If the return destination for the app is a Universal Link, you can use
pp.getLoginUrl. When using a Custom URL Scheme Deep Link,pp.getLoginUrlis not supported, so use/v2/smartpayment/qr/sessions.