@paypay/mini-app-js-sdk
v2.41.0
Published
## Installation
Downloads
1,240
Readme
mini-app-js-sdk
Installation
Option 1 (recommended): NPM Package
The SDK is provided as NPM package. Please add it to your project by:
npm i @paypay/mini-app-js-sdk -S
# OR
yarn add @paypay/mini-app-js-sdk
To use the Javascript API, please add the following import:
import pp from "@paypay/mini-app-js-sdk";
Option 2: HTML
The SDK can also be used by simply including it in your HTML code:
<script src="https://static.paypay.ne.jp/libs/mini-app-js-sdk/<version#>/mini-app-js-sdk.js"></script>
Getting started
The Javascript automatically detects if you are running your website inside PayPay's Mini App environment or inside a browser.
Please initialize the SDK with the following command:
pp.init({
clientId: 'YOUR_CLIENT_ID',
env: 'sandbox', //default: 'production'
success() {
console.log('init successful')
},
fail() {
console.log('init failed')
},
})
After initializing, the Mini App JS SDK is ready to use.
You can verify it by getting a success
callback with a sample call, i.e.:
pp.getUAID({
success: (res) => {
console.log(JSON.stringify(res))
},
fail: (error) => {
console.log(JSON.stringify(error))
},
complete: () => {}
})