https://github.com/ghmeier/coinage
:moneybag: Expresso's Billing microservice, written in Go
https://github.com/ghmeier/coinage
Last synced: 5 months ago
JSON representation
:moneybag: Expresso's Billing microservice, written in Go
- Host: GitHub
- URL: https://github.com/ghmeier/coinage
- Owner: ghmeier
- License: mit
- Created: 2016-11-02T22:39:36.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-20T19:18:54.000Z (over 9 years ago)
- Last Synced: 2025-10-13T06:47:37.380Z (10 months ago)
- Language: Go
- Homepage:
- Size: 131 KB
- Stars: 6
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# coinage
[](https://travis-ci.org/ghmeier/coinage)
[](https://coveralls.io/github/ghmeier/coinage?branch=master)
[](https://goreportcard.com/report/github.com/ghmeier/coinage)
A go service for handling Expresso billing
## Quick Start
```bash
$ docker run jonnykry/coinage:latest
```
## Setup
```bash
$ go get github.com/jonnykry/coinage
$ cd $GOPATH/src/github.com/jonnykry/coinage
$ make deps
$ make run
```
## API
### Roaster
### Customer
#### `POST /api/customer` creates a new stripe customer and stores its token.
Example:
*Request:*
```
POST localhost:8081/api/customer
{
"userId": "",
"token": ""
}
```
*Response:*
```
{
"data": {
"id": ,
"userId": ,
"customerId": ,
"subscriptions": {},
"sources": {},
"meta": {}
}
}
```
#### `GET /api/customer?offset=0&limit=20` gets stripe `limit` customers starting at `offset`
Example:
*Request:*
```
GET localhost:8081/api/customer?offset=0&limit=20
```
*Response:*
```
{
"data": [
{
"id": ,
"userId": ,
"customerId": ,
"subscriptions": {},
"sources": {},
"meta": {}
}, ...
]
}
```
#### `GET /api/customer/:id` gets a stripe customer by userId
Example:
*Request:*
```
GET localhost:8081/api/customer/1
```
*Response:*
```
{
"data": {
"id": ,
"userId": "1",
"customerId": ,
"subscriptions": {},
"sources": {},
"meta": {}
}
}
```
#### `DELETE /api/customer/:id` removes the stripe customer
Example:
*Request:*
```
DELETE localhost:8081/api/customer/1
```
*Response:*
```
{
"data": true
}
```
#### `POST /api/customer/:id/source` updates a user's default payment option by userId
Example:
*Request:*
```
POST localhost:8081/api/customer/1/source
{
"token": ""
}
```
*Response:*
```
{
"data": {
"id": ,
"userId": ,
"customerId": ,
"subscriptions": {},
"sources": {},
"meta": {}
}
}
```
#### `POST /api/customer/:id/subscription` subscribes the user to a new stripe plan
*NOT IMPLEMENTED*
Example:
*Request:*
```
POST localhost:8081/api/customer/1/subscription
```
#### `DELETE /api/customer/:id/subscription/:pid` unsubscribes the user from the plan where id=:pid
*NOT IMPLEMENTED*
Example:
*Request:*
```
POST localhost:8081/api/customer/1/subscription/2
```