Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

Add JavaScript code example #35

Merged
merged 2 commits into from
Mar 18, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 28 additions & 9 deletions README.md
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
Expand All @@ -31,23 +31,42 @@ print(response.json())
```

#### JavaScript
Copy link
Contributor

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?

[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']
}
});
```
Copy link
Contributor

Choose a reason for hiding this comment

The 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:
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we also add this to the python section?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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');
Copy link
Member

Choose a reason for hiding this comment

The 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
Expand Down