-
Notifications
You must be signed in to change notification settings - Fork 1
Add JavaScript code example #35
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
# CH-Payments | ||
Welcome to CH Payments, a simple paymentprovider wrapper for stuff you want CH to get money for. | ||
Payments makes it easy to create products, and implement it in your own website. | ||
No hassle with keys, accounts and webhooks, just a single call to initiate a payment. | ||
No hassle with keys, accounts and webhooks, just a single call to initiate a payment. | ||
|
||
Below you can find some ready-to-use code examples for your website. | ||
|
||
The administration panel (for now) is only available for board members. | ||
The administration panel (for now) is only available for board members. | ||
They can create products to generate the keys required. | ||
|
||
# Code examples | ||
No idea how to code, but still want to sell tickets on your CH site? | ||
Use one of these code examples to get going. | ||
No idea how to code, but still want to sell tickets on your CH site? | ||
Use one of these code examples to get going. | ||
|
||
#### Python 3.5 | ||
```python | ||
|
@@ -31,23 +31,42 @@ print(response.json()) | |
``` | ||
|
||
#### JavaScript | ||
[Code example required](https://github.com/WISVCH/payments/issues/6) | ||
|
||
Creating an order: | ||
```js | ||
fetch('http://localhost:9000/api/orders', { | ||
method: 'POST', | ||
body: { | ||
name: 'Thomas Ticket', | ||
email: '[email protected]', | ||
returnUrl: 'https://www.ch.tudelft.nl/payments/ordercompleted', | ||
productKeys: ['e44685c5-a360-467c-960d-29843a101bb1', '879941f4-43d1-4ff2-ad66-cbdf3b141cab'] | ||
} | ||
}); | ||
``` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd add a print statement for the result of the request, this way the user is immediately able to see what the response contains. |
||
|
||
Obtaining the status: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we also add this to the python section? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes 😄 |
||
```js | ||
const request = await fetch('http://localhost:9000/api/orders/status/e44685c5-a360-467c-960d-29843a101bb1'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this example should use the order id from the request you have done above |
||
const response = await request.json(); | ||
console.log(response); | ||
``` | ||
|
||
#### PHP | ||
[Code example required](https://github.com/WISVCH/payments/issues/6) | ||
|
||
# HootHub | ||
This project currently is quite minimal, and offers lots of opportunities for great features built by you! | ||
Check out the issue page for HootHub issues, and start earning Uilenballen. | ||
Check out the issue page for HootHub issues, and start earning Uilenballen. | ||
|
||
First, pick an issue and self-assign it. Make your changes in a new branch, with the following naming convention: | ||
|
||
- Fixing a bug? > "fix-description_of_bug" | ||
- Implementing a new feature? > "feature-description_of_feature" | ||
|
||
Once you're satisfied with your changes, create a pull request and give it the label "Ready for review". | ||
You can assign someone in specific or wait for someone to pick it up. | ||
Make sure to include tests and documentation. | ||
Once you're satisfied with your changes, create a pull request and give it the label "Ready for review". | ||
You can assign someone in specific or wait for someone to pick it up. | ||
Make sure to include tests and documentation. | ||
If Travis isn't happy, we're not happy. | ||
|
||
# Running | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a note that fetch is not supported everywhere yet?