Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/Glench/ExtPay
Browse files Browse the repository at this point in the history
  • Loading branch information
Glench committed Jul 7, 2022
2 parents 48b67c8 + e39b25c commit 4f817af
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 3 deletions.
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Feature request
about: Please use our discussion forum for requesting features
title: ''
labels: ''
assignees: ''

---

We like to keep the ExtPay Github issues tracker for bugs only, not feature requests. If you'd like to request features, please head on over to the [discussions](https://github.com/Glench/ExtPay/discussions) page and make a new thread or upvote other threads for features you'd like added!
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# ExtPay.js — Payments in browser extensions
The JavaScript library for [ExtensionPay.com](https://extensionpay.com), a service to easily add payments to browser extensions without running your own server backend.
The JavaScript library for [ExtensionPay.com](https://extensionpay.com), a service to easily add payments to browser extensions.

```js
// Example code
// your-extension/background.js
const extpay = ExtPay('your-extension-id');
extpay.startBackground();

extpay.getUser().then(user => {
if (user.paid) {
// ...
} else {
extpay.openPaymentPage()
}
})
```

Below are directions for using this library in your browser extension. If you learn better by example, you can also view the code for a **[sample extension](sample-extension-mv3/)**. This library uses [Mozilla's webextension-polyfill library](https://github.com/mozilla/webextension-polyfill) internally for compatability across browsers which means it should work on almost all modern browsers.

Expand Down Expand Up @@ -194,7 +209,7 @@ The subscription management page looks something like this:

<img src="docs/subscription_management_screenshot.png" alt="Screenshot of example subscription management page." width="400">

Note: please read the [detailed docs on subscriptions here](/docs/how_subscriptions_work.md).
Note: please read the **[detailed docs on subscriptions here](/docs/how_subscriptions_work.md)**.


## 8. Use `extpay.openTrialPage()` to let the user sign up for a free trial
Expand Down
9 changes: 8 additions & 1 deletion sample-extension-mv3/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# [ExtensionPay.com](https://extensionpay.com) Sample Extension

This is the [ExtensionPay](https://extensionpay.com) Manifest v3 sample extension. Use this as a template or minimal example of how to use the [ExtPay JavaScript library](../) in your extension.
This is the [ExtensionPay](https://extensionpay.com) Manifest v3 sample extension. Use this as a template or minimal example of how to use the [ExtPay JavaScript library](/README.md) in your extension.

To play with this extension, install it and click the extension icon to open the popup.

### To install on Chrome
Open [chrome://extensions/](chrome://extensions/) and make sure `Developer Mode` is enabled in the top right corner. Then click the `Load unpacked` button and navigate to the sample extension folder. Once installed, click the extension's icon ("E") in the browser's top right toolbar to see popup.html. (It may be in the "puzzle piece" menu.)

### Change the extension ID to test payments
You'll need to sign up for an account and register an extension on [ExtensionPay.com](https://extensionpay.com) to test payments.

Once you've done that, change the extension ID from `sample-extension` to your extension's ID in `background.js` and `popup.js`.

0 comments on commit 4f817af

Please sign in to comment.