You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| `uid` | An app-local identifier for the user. This is specific to this user, and this app. It will change if the user revokes the permissions they granted to your app. | (none) |
76
69
| `username` | The user's Pi username. | `username` |
70
+
| `payments` | Required if your app needs to make payments between your app and the users | `payments` |
71
+
| `wallet_address` | The wallet address of the user who authenticates on your app. | `wallet_address` |
77
72
78
73
### `onIncompletePaymentFound`
79
74
80
75
Signature: `(payment:PaymentDTO) =>void`
81
76
82
77
Every time when the user is authenticated, and when they try to start a new payment flow, the SDK checks that there is no
83
78
incomplete payment for this user. An incomplete payment, in this context, is a payment which has been submitted to
84
-
the Pi blockchain, but where `status.developer_completed` is still `false` (i.e. the developer has not called the
79
+
the Pi Blockchain, but where `status.developer_completed` is still `false` (i.e. the developer has not called the
85
80
`/complete` endpoint on this payment).
86
81
87
82
If an incomplete payment is found, this callback will be invoked with the payment's `PaymentDTO`.
@@ -168,7 +163,7 @@ Read more about Server-Side Approval and the full payment flow in the dedicated
This is called when the user has submitted the transaction to the Pi blockchain. During the completion time period, this callback will be invoked multiple times in case of failure.
166
+
This is called when the user has submitted the transaction to the Pi Blockchain. During the completion time period, this callback will be invoked multiple times in case of failure.
172
167
If the initial trial fails, the Pi SDK will continue to invoke the function roughly every 10 seconds until the completion timer ends.
173
168
174
169
Use this callback to send the blockchain transaction identifier (txid), along with the paymentId
@@ -197,37 +192,63 @@ Otherwise, only the first argument will be provided.
197
192
198
193
### Type `PaymentDTO`
199
194
200
-
This type is used in the arguments that are passed to `onIncompletePaymentFound` and `onError`.
195
+
This type is for the arguments that are passed to `onIncompletePaymentFound` and `onError`.
201
196
202
197
```typescript
203
198
typePaymentDTO= {
204
199
// Payment data:
205
-
identifier:string, // The payment identifier
206
-
user_uid:string, // The user's app-specific ID
207
-
amount:number, // The payment amount
208
-
memo:string, // A string provided by the developer, shown to the user
209
-
metadata:Object, // An object provided by the developer for their own usage
210
-
to_address:string, // The recipient address of the blockchain transaction
211
-
created_at:string, // The payment's creation timestamp
200
+
identifier:string, // payment identifier
201
+
user_uid:string, // user's app-specific ID
202
+
amount:number, // payment amount
203
+
memo:string, // a string provided by the developer, shown to the user
204
+
metadata:Object, // an object provided by the developer for their own usage
205
+
from_address:string, // sender address of the blockchain transaction
206
+
to_address:string, // recipient address of the blockchain transaction
This is a simple walkthrough on handling user authentication using Pi SDK and API endpoint. For a detailed explanation, please refer to [Pi.authenticate](./SDK_reference.md#authentication) for SDK reference and [/me](./platform_API.md#authentication) for API reference.
4
+
## Guide
5
+
6
+
Here is a list of steps you can follow when you authenticate users for your app:
7
+
### 1. Call `authenticate()` of Pi SDK
8
+
9
+
Using the Pi SDK `authenticate()`, you can obtain user information along with the access token.
### 2. Make a GET request to `/me` Pi API endpoint using the access token for verification
15
+
To verify the data you got in step 1, you need to make a GET request to `/me` Pi API endpoint, with the access token included in the header. If the access token is valid, it will return a response with [UserDTO](./platform_API#UserDTO). However, if the token is invalid, it will return HTTP 401 Unauthorized code.
Copy file name to clipboardExpand all lines: developer_portal.md
+45-35Lines changed: 45 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,78 +4,88 @@ With the help of Pi SDK and Pi API, you can create applications that run within
4
4
5
5
## How to register your app
6
6
7
-
1. The Pi Developer Portal can be accessed using the Pi Browser. Go to `pi://develop.pi` to visit the Pi Developer Portal. To register a new app, click on `New App` button at the bottom of the page.
7
+
1. The Pi Developer Portal can be accessed using the Pi Browser. Go to `pi://develop.pi` to visit the Pi Developer Portal. When you first get to the main page, you won't see any app. To register your app, tab on the "New App" button.
2.You can fill in the required fields. One important field is selecting the host network that the app is connecting to. Depending on this option, Pi SDK will automatically connect your app to the corresponding network. An app can only connect to one network at a time, and once you register the app, this option cannot be changed.
14
+
2.Initially you're asked to fill in 3 required fields. The "App Network" option lets you select the host network that your app is connecting to. Depending on this option, Pi SDK will automatically connect your app to the corresponding network, either to Pi Mainnet or Pi Testnet. Note that an app can only connect to one network at a time, and once you register the app, this option cannot be changed. What this means is you're advised to create two different apps, one with testnet for testing purpose and one with mainnet for your production usage.
> When the app is connecting to the Pi Testnet, you can maintain a list of whitelisted users. Your testnet app will only be accessible by users you allowed, and if you leave this field empty, anyone can access your test app.
21
+
3. After you register your app, you can see your app in detail. Each app has its own "App Checklist", which helps you keep track of required steps to successfully set up your app. To see the checklist, tab on "App Checklist" button.
> When the app is connecting to the Pi Mainnet, you can pair one of your testnet apps to the mainnet app. More specific usage is coming soon in the future.
28
+
4. The checklist steps will be unlocked sequentially as you complete each step. The first step is to configure the hosting option.
> When you're hosting the app on your server, you will also need to provide the url. Notice that you'll be asked to verify the ownership of the url after you register the app. After you filled in the required fields, you can submit to register your app by clicking on `Submit` button at the bottom of the page.
35
+
5. Once you configure the hosting option, you'll see that "App Wallet" button is now enabled, and the next step for checklist is connecting a wallet to the app. Follow the instruction to create the app and connect it to your app.
32
36
33
-
3. After you register your app, you can see your apps in the main page. If you selected the paired app for your mainnet app, it will show like the following.
6. When you connect your app wallet to your app, the checklist will show you documentations that you can go over to get started. From here, you can have a look and follow the remaining steps to fully configure the app.
If you registered your app to connect to the Pi Testnet and if you visit your app in the Pi Browser, it will show the black and yellow stripe at the top to indicate that this app is connected to the Pi Testnet.
Projects that existed prior to the launch of the Pi Mainnet SDK will point to the Pi Testnet
60
+
52
61
- This cannot be changed or updated
53
62
- It is best practice to create new Developer Portal Projects
54
63
55
64
### Developers and Teams with previously created Legacy Projects
56
65
57
-
1. Create a new Developer Portal Project
58
-
- Select Mainnet - This will be the Mainnet Version of the App
59
-
- URL
60
-
- This project should contain the desired URL that Pioneers will access the app with through the Pi Browser
61
-
- URL ownership will be determined through verification process
62
-
- Payment Wallet
63
-
- Until developer/app wallets are created the wallet address of the developer who creates the new project page will be used to process all transactions
64
-
- If the project page creator does not have a Pi Wallet Address which has been created in a Mainnet Migration all transactions will fail.
66
+
1. Create a new Developer Portal Project
67
+
- Select Mainnet - This will be the Mainnet Version of the App
68
+
- URL
69
+
- This project should contain the desired URL that Pioneers will access the app with through the Pi Browser
70
+
- URL ownership will be determined through verification process
71
+
- Payment Wallet
72
+
- Until developer/app wallets are created the wallet address of the developer who creates the new project page will be used to process all transactions
73
+
- If the project page creator does not have a Pi Wallet Address which has been created in a Mainnet Migration all transactions will fail.
65
74
2. Create a second new Developer Project Page
66
-
- Select Testnet - This will be for testing purposes
67
-
- URL
68
-
- Cannot be the same as the Mainnet URL
69
-
- Must be owned by the developer as well
70
-
- Set the desired access permissions
71
-
- This project can be linked to the previously created Mainnet Project from step 1
75
+
- Select Testnet - This will be for testing purposes
76
+
- URL
77
+
- Cannot be the same as the Mainnet URL
78
+
- Must be owned by the developer as well
79
+
- Set the desired access permissions
80
+
- This project can be linked to the previously created Mainnet Project from step 1
72
81
3. Link Mainnet Project to the Brainstorm project (if applicable)
73
-
- As of July 2022 it is possible to link only one developer portal project to a brainstorm project
82
+
- As of July 2022 it is possible to link only one developer portal project to a brainstorm project
74
83
75
84
### Special Considerations
85
+
76
86
- If an app team has no members with a Mainnet Wallet
77
-
- Please reach out to the Pi CT through the <ahref="https://pinetwork.atlassian.net/servicedesk/customer/portal/1/group/3/create/20"target="_blank">Pi Support Portal</a>
78
-
- For the question “What does your question relate to? ”
79
-
- Select “Pi Mainnet SDK Wallet”
80
-
- Submit contact information
81
-
- A member of the Pi CT will follow up
87
+
- Please reach out to the Pi CT through the <ahref="https://pinetwork.atlassian.net/servicedesk/customer/portal/1/group/3/create/20"target="_blank">Pi Support Portal</a>
88
+
- For the question “What does your question relate to? ”
0 commit comments