Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pay with pi README.md #202

Open
wants to merge 11 commits into
base: PI-6743-a-user-can-refund-an-order
Choose a base branch
from

Conversation

Juma-creator
Copy link

Pay with Pi App

Pay with Pi App is an example of how you can implement the various required flows in your app's code. It aims to show you how to use Pi Platform API on the backend side and Pi SDK on the frontend side of your app.

It is composed of two major parts:

  • backend: a backend app (a very simple JSON API built using Node and ExpressJS)
  • frontend: a single-page frontend app (built using React and create-react-app)

Initial Development

Read doc/development.md to get started and learn how to run this app in development.

WARNING

The Pay with Pi App uses express session cookies which, in the Sandbox environment, are not correctly saved on the client on some browsers.
To properly test all of the features of the Pay with Pi App
, we recommend you to open the sandbox app using Mozilla Firefox.

Deployment

Read doc/deployment.md to learn how to deploy this app on a server using Docker and docker-compose.

Flows

To dive into the implementation of the flows that support the demo app features, please refer to Pay with Pi App Flows.

Juma-creator and others added 2 commits September 2, 2024 08:58
# Pay with Pi App

Pay with Pi App is an example of how you can implement the various required flows in your app's code.
It aims to show you how to use Pi Platform API on the backend side and Pi SDK on the frontend side of your app.


It is composed of two major parts:

* **backend**: a backend app (a very simple JSON API built using Node and ExpressJS)
* **frontend**: a single-page frontend app (built using React and create-react-app)


## Initial Development

Read [`doc/development.md`](./doc/development.md) to get started and learn how to run this app in development.

> **WARNING**
>
> The Pay with Pi App uses express session cookies which, in the Sandbox environment, are not correctly saved on the client on some browsers.
> To properly test all of the features of the Pay with Pi App
, we recommend you to open the sandbox app using Mozilla Firefox.


## Deployment

Read [`doc/deployment.md`](./doc/deployment.md) to learn how to deploy this app on a server using Docker and docker-compose.


## Flows

To dive into the implementation of the flows that support the demo app features, please refer to
[Pay with Pi App Flows](./FLOWS.md).


Signed-off-by: Pay with Pi <[email protected]>
Bumps the npm_and_yarn group with 4 updates in the /backend directory: [axios](https://github.com/axios/axios), [express](https://github.com/expressjs/express), [mongodb](https://github.com/mongodb/node-mongodb-native) and [braces](https://github.com/micromatch/braces).
Bumps the npm_and_yarn group with 10 updates in the /frontend directory:

| Package | From | To |
| --- | --- | --- |
| [axios](https://github.com/axios/axios) | `0.27.2` | `0.28.0` |
| [express](https://github.com/expressjs/express) | `4.18.1` | `4.19.2` |
| [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) | `7.18.6` | `7.25.6` |
| [browserify-sign](https://github.com/crypto-browserify/browserify-sign) | `4.2.1` | `4.2.3` |
| [decode-uri-component](https://github.com/SamVerschueren/decode-uri-component) | `0.2.0` | `0.2.2` |
| [elliptic](https://github.com/indutny/elliptic) | `6.5.4` | `6.5.7` |
| [es5-ext](https://github.com/medikoo/es5-ext) | `0.10.61` | `0.10.64` |
| [tar](https://github.com/isaacs/node-tar) | `6.1.11` | `6.2.1` |
| [tough-cookie](https://github.com/salesforce/tough-cookie) | `4.0.0` | `4.1.4` |
| [word-wrap](https://github.com/jonschlinkert/word-wrap) | `1.2.3` | `1.2.5` |



Updates `axios` from 0.21.4 to 0.28.0
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v0.28.0/CHANGELOG.md)
- [Commits](axios/axios@v0.21.4...v0.28.0)

Updates `express` from 4.18.1 to 4.19.2
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](expressjs/express@4.18.1...4.19.2)

Updates `mongodb` from 4.7.0 to 4.17.0
- [Release notes](https://github.com/mongodb/node-mongodb-native/releases)
- [Changelog](https://github.com/mongodb/node-mongodb-native/blob/v4.17.0/HISTORY.md)
- [Commits](mongodb/node-mongodb-native@v4.7.0...v4.17.0)

Updates `braces` from 3.0.2 to 3.0.3
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](micromatch/braces@3.0.2...3.0.3)

Updates `follow-redirects` from 1.15.1 to 1.15.6
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](follow-redirects/follow-redirects@v1.15.1...v1.15.6)

Updates `axios` from 0.27.2 to 0.28.0
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v0.28.0/CHANGELOG.md)
- [Commits](axios/axios@v0.21.4...v0.28.0)

Updates `express` from 4.18.1 to 4.19.2
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](expressjs/express@4.18.1...4.19.2)

Updates `follow-redirects` from 1.15.1 to 1.15.6
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](follow-redirects/follow-redirects@v1.15.1...v1.15.6)

Updates `@babel/traverse` from 7.18.6 to 7.25.6
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.25.6/packages/babel-traverse)

Updates `browserify-sign` from 4.2.1 to 4.2.3
- [Changelog](https://github.com/browserify/browserify-sign/blob/main/CHANGELOG.md)
- [Commits](browserify/browserify-sign@v4.2.1...v4.2.3)

Updates `decode-uri-component` from 0.2.0 to 0.2.2
- [Release notes](https://github.com/SamVerschueren/decode-uri-component/releases)
- [Commits](SamVerschueren/decode-uri-component@v0.2.0...v0.2.2)

Updates `elliptic` from 6.5.4 to 6.5.7
- [Commits](indutny/elliptic@v6.5.4...v6.5.7)

Updates `es5-ext` from 0.10.61 to 0.10.64
- [Release notes](https://github.com/medikoo/es5-ext/releases)
- [Changelog](https://github.com/medikoo/es5-ext/blob/main/CHANGELOG.md)
- [Commits](medikoo/es5-ext@v0.10.61...v0.10.64)

Updates `tar` from 6.1.11 to 6.2.1
- [Release notes](https://github.com/isaacs/node-tar/releases)
- [Changelog](https://github.com/isaacs/node-tar/blob/main/CHANGELOG.md)
- [Commits](isaacs/node-tar@v6.1.11...v6.2.1)

Updates `tough-cookie` from 4.0.0 to 4.1.4
- [Release notes](https://github.com/salesforce/tough-cookie/releases)
- [Changelog](https://github.com/salesforce/tough-cookie/blob/master/CHANGELOG.md)
- [Commits](salesforce/tough-cookie@v4.0.0...v4.1.4)

Updates `word-wrap` from 1.2.3 to 1.2.5
- [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
- [Commits](jonschlinkert/word-wrap@1.2.3...1.2.5)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:production
  dependency-group: npm_and_yarn
- dependency-name: express
  dependency-type: direct:production
  dependency-group: npm_and_yarn
- dependency-name: mongodb
  dependency-type: direct:production
  dependency-group: npm_and_yarn
- dependency-name: braces
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: follow-redirects
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: axios
  dependency-type: direct:production
  dependency-group: npm_and_yarn
- dependency-name: express
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: follow-redirects
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: "@babel/traverse"
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: browserify-sign
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: decode-uri-component
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: elliptic
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: es5-ext
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: tar
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: tough-cookie
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: word-wrap
  dependency-type: indirect
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <[email protected]>
Juma-creator and others added 4 commits September 23, 2024 17:46
…nd/npm_and_yarn-8e13212ace

Bump the npm_and_yarn group across 2 directories with 13 updates
Bumps the npm_and_yarn group with 1 update in the /backend directory: [express](https://github.com/expressjs/express).
Bumps the npm_and_yarn group with 1 update in the /frontend directory: [express](https://github.com/expressjs/express).


Updates `express` from 4.19.2 to 4.20.0
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](expressjs/express@4.19.2...4.20.0)

Updates `body-parser` from 1.20.2 to 1.20.3
- [Release notes](https://github.com/expressjs/body-parser/releases)
- [Changelog](https://github.com/expressjs/body-parser/blob/master/HISTORY.md)
- [Commits](expressjs/body-parser@1.20.2...1.20.3)

Updates `path-to-regexp` from 0.1.7 to 0.1.10
- [Release notes](https://github.com/pillarjs/path-to-regexp/releases)
- [Changelog](https://github.com/pillarjs/path-to-regexp/blob/master/History.md)
- [Commits](pillarjs/path-to-regexp@v0.1.7...v0.1.10)

Updates `serve-static` from 1.15.0 to 1.16.0
- [Release notes](https://github.com/expressjs/serve-static/releases)
- [Changelog](https://github.com/expressjs/serve-static/blob/master/HISTORY.md)
- [Commits](expressjs/serve-static@v1.15.0...1.16.0)

Updates `express` from 4.19.2 to 4.21.0
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](expressjs/express@4.19.2...4.20.0)

Updates `body-parser` from 1.20.2 to 1.20.3
- [Release notes](https://github.com/expressjs/body-parser/releases)
- [Changelog](https://github.com/expressjs/body-parser/blob/master/HISTORY.md)
- [Commits](expressjs/body-parser@1.20.2...1.20.3)

Updates `path-to-regexp` from 0.1.7 to 0.1.10
- [Release notes](https://github.com/pillarjs/path-to-regexp/releases)
- [Changelog](https://github.com/pillarjs/path-to-regexp/blob/master/History.md)
- [Commits](pillarjs/path-to-regexp@v0.1.7...v0.1.10)

Updates `send` from 0.18.0 to 0.19.0
- [Release notes](https://github.com/pillarjs/send/releases)
- [Changelog](https://github.com/pillarjs/send/blob/master/HISTORY.md)
- [Commits](pillarjs/send@0.18.0...0.19.0)

Updates `serve-static` from 1.15.0 to 1.16.2
- [Release notes](https://github.com/expressjs/serve-static/releases)
- [Changelog](https://github.com/expressjs/serve-static/blob/master/HISTORY.md)
- [Commits](expressjs/serve-static@v1.15.0...1.16.0)

---
updated-dependencies:
- dependency-name: express
  dependency-type: direct:production
  dependency-group: npm_and_yarn
- dependency-name: body-parser
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: path-to-regexp
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: serve-static
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: express
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: body-parser
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: path-to-regexp
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: send
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: serve-static
  dependency-type: indirect
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <[email protected]>
Pay with Pi leading payment app
Use Pay with pi for the fastest, most secure online and in-store payments! Pay for movie tickets, food, coffee, fashion, gas, and many more in Pay with Pi.

Quick, easy, convenient and secure.

**Send / Receive Payments**

Pay in store or send money to friends. No need to carry cash or worry about loose change!

**Online Top-Ups and Utility Bill Payments**

Top-up your mobile phone, pay your utility and internet bills or settle your monthly insurance premiums bills through Pay with Pi.

**Add Money to your Pay with Pi Wallet**

Add money to your Pay with pi app via Pay&Go machines or transfer from multiple online banking apps cash-in at all Banks branches and agent world wide.

**Explore Nearby**

Explore places near you that accept payment through Pay with pi wallet. Cinemas, restaurants, coffee shops, supermarkets, and gas stations are all joining forces with Pay with Pi to make your life more connected and more mobile.

Don’t forget to look out for great deals exclusively for Pay with pi users! Start enjoying the amazing benefits of Pay with Pi. Download it now.

Signed-off-by: Pay with Pi <[email protected]>
Copy link
Author

@Juma-creator Juma-creator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's perfect!

…nd/npm_and_yarn-a6abaa1e0c

Bump the npm_and_yarn group across 2 directories with 5 updates
Copy link
Author

@Juma-creator Juma-creator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<script src="https://sdk.minepi.com/pi-sdk.js"></script> <script>Pi.init({ version: "2.0" })</script>

// Authenticate the user, and get permission to request payments from them:
const scopes = ['payments'];

// Read more about this callback in the SDK reference:
function onIncompletePaymentFound(payment) { /* ... */ };

Pi.authenticate(scopes, onIncompletePaymentFound).then(function(auth) {
console.log(Hi there! You're ready to make payments!);
}).catch(function(error) {
console.error(error);
});
Pi.createPayment({
// Amount of π to be paid:
amount: 314159,
// An explanation of the payment - will be shown to the user:
memo: "...", // e.g: "Digital kitten #1234",
// An arbitrary developer-provided metadata object - for your own usage:
metadata: { /* ... / }, // e.g: { kittenId: 1234 }
}, {
// Callbacks you need to implement - read more about those in the detailed docs linked below:
onReadyForServerApproval: function(paymentId) { /
... / },
onReadyForServerCompletion: function(paymentId, txid) { /
... / },
onCancel: function(paymentId) { /
... / },
onError: function(error, payment) { /
... */ },
});

@Juma-creator Juma-creator changed the base branch from main to PI-6743-a-user-can-refund-an-order September 26, 2024 06:06
Copy link
Author

@Juma-creator Juma-creator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect

Pay with Pi leading payment app
Use Pay with pi for the fastest, most secure online and in-store payments! Pay for movie tickets, food, coffee, fashion, gas, and many more in Pay with Pi.

Quick, easy, convenient and secure.

**Send / Receive Payments**

Pay in store or send money to friends. No need to carry cash or worry about loose change!

**Online Top-Ups and Utility Bill Payments**

Top-up your mobile phone, pay your utility and internet bills or settle your monthly insurance premiums bills through Pay with Pi.

**Add Money to your Pay with Pi Wallet**

Add money to your Pay with pi app via Pay&Go machines or transfer from multiple online banking apps cash-in at all Banks branches and agent world wide.

**Explore Nearby**

Explore places near you that accept payment through Pay with pi wallet. Cinemas, restaurants, coffee shops, supermarkets, and gas stations are all joining forces with Pay with Pi to make your life more connected and more mobile.

Don’t forget to look out for great deals exclusively for Pay with pi users! Start enjoying the amazing benefits of Pay with Pi. Download it now.


Signed-off-by: Pay with Pi <[email protected]>
Pay with Pi leading payment app
Use Pay with pi for the fastest, most secure online and in-store payments! Pay for movie tickets, food, coffee, fashion, gas, and many more in Pay with Pi.

Quick, easy, convenient and secure.

**Send / Receive Payments**

Pay in store or send money to friends. No need to carry cash or worry about loose change!

**Online Top-Ups and Utility Bill Payments**

Top-up your mobile phone, pay your utility and internet bills or settle your monthly insurance premiums bills through Pay with Pi.

**Add Money to your Pay with Pi Wallet**

Add money to your Pay with pi app via Pay&Go machines or transfer from multiple online banking apps cash-in at all Banks branches and agent world wide.

**Explore Nearby**

Explore places near you that accept payment through Pay with pi wallet. Cinemas, restaurants, coffee shops, supermarkets, and gas stations are all joining forces with Pay with Pi to make your life more connected and more mobile.

Don’t forget to look out for great deals exclusively for Pay with pi users! Start enjoying the amazing benefits of Pay with Pi. Download it now..


https://forms.gle/NBzpicuQ1SXQSH4e6



Signed-off-by: truth&knowledge tube <[email protected]>
{
  "_links": {
    "self": {
      "href": "https://api.mainnet.minepi.com/accounts/GBBB3DGTFM5AGPCJIIBH5QGSBLVEBB4GKQ7AV2JDT2ITMU7ZQKKOA2N7"
    },
    "transactions": {
      "href": "https://api.mainnet.minepi.com/accounts/GBBB3DGTFM5AGPCJIIBH5QGSBLVEBB4GKQ7AV2JDT2ITMU7ZQKKOA2N7/transactions{?cursor,limit,order}",
      "templated": true
    },
    "operations": {
      "href": "https://api.mainnet.minepi.com/accounts/GBBB3DGTFM5AGPCJIIBH5QGSBLVEBB4GKQ7AV2JDT2ITMU7ZQKKOA2N7/operations{?cursor,limit,order}",
      "templated": true
    },
    "payments": {
      "href": "https://api.mainnet.minepi.com/accounts/GBBB3DGTFM5AGPCJIIBH5QGSBLVEBB4GKQ7AV2JDT2ITMU7ZQKKOA2N7/payments{?cursor,limit,order}",
      "templated": true
    },
    "effects": {
      "href": "https://api.mainnet.minepi.com/accounts/GBBB3DGTFM5AGPCJIIBH5QGSBLVEBB4GKQ7AV2JDT2ITMU7ZQKKOA2N7/effects{?cursor,limit,order}",
      "templated": true
    },
    "offers": {
      "href": "https://api.mainnet.minepi.com/accounts/GBBB3DGTFM5AGPCJIIBH5QGSBLVEBB4GKQ7AV2JDT2ITMU7ZQKKOA2N7/offers{?cursor,limit,order}",
      "templated": true
    },
    "trades": {
      "href": "https://api.mainnet.minepi.com/accounts/GBBB3DGTFM5AGPCJIIBH5QGSBLVEBB4GKQ7AV2JDT2ITMU7ZQKKOA2N7/trades{?cursor,limit,order}",
      "templated": true
    },
    "data": {
      "href": "https://api.mainnet.minepi.com/accounts/GBBB3DGTFM5AGPCJIIBH5QGSBLVEBB4GKQ7AV2JDT2ITMU7ZQKKOA2N7/data/{key}",
      "templated": true
    }
  },
  "id": "GBBB3DGTFM5AGPCJIIBH5QGSBLVEBB4GKQ7AV2JDT2ITMU7ZQKKOA2N7",
  "account_id": "GBBB3DGTFM5AGPCJIIBH5QGSBLVEBB4GKQ7AV2JDT2ITMU7ZQKKOA2N7",
  "sequence": "14441973562198312",
  "subentry_count": 0,
  "last_modified_ledger": 17326236,
  "last_modified_time": "2024-10-21T15:49:58Z",
  "thresholds": {
    "low_threshold": 0,
    "med_threshold": 0,
    "high_threshold": 0
  },
  "flags": {
    "auth_required": false,
    "auth_revocable": false,
    "auth_immutable": false,
    "auth_clawback_enabled": false
  },
  "balances": [
    {
      "balance": "58583234.9568162",
      "buying_liabilities": "0.0000000",
      "selling_liabilities": "0.0000000",
      "asset_type": "native"
    }
  ],
  "signers": [
    {
      "weight": 1,
      "key": "GBBB3DGTFM5AGPCJIIBH5QGSBLVEBB4GKQ7AV2JDT2ITMU7ZQKKOA2N7",
      "type": "ed25519_public_key"
    }
  ],
  "data": {},
  "num_sponsoring": 14421790,
  "num_sponsored": 0,
  "paging_token": "GBBB3DGTFM5AGPCJIIBH5QGSBLVEBB4GKQ7AV2JDT2ITMU7ZQKKOA2N7"
}

Signed-off-by: truth&knowledge tube <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants