-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi.apib
58 lines (50 loc) · 2.34 KB
/
api.apib
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
FORMAT: 1A
HOST: http://localhost:3000
# Payments & Balance
The payment flow consists of two steps:
1. Initiate Payment: The customer initiates the payment through the service.
2. Confirm Payment: Payment confirmation can occur in two ways:
- Automatically via Stripe Webhook: Stripe sends a webhook to confirm the payment.
- Manually via Confirm Payment Endpoint: The payment is confirmed manually using the confirm payment endpoint.
## Payment [/payment]
### Initiate payment [PUT /payment]
+ Request (application/json)
+ Attributes (object, fixed-type)
+ amount (number, required)
+ currency (Currency, required)
+ Response 200 (application/json)
+ Attributes (Payment, fixed-type)
### Get payment [GET /payment/{id}]
+ Parameters
+ id: 1 (number, required) - Payment id
+ Response 200 (application/json)
+ Attributes (Payment, fixed-type)
### Manully confirm payment [POST /payment/{id}]
+ Parameters
+ id: 1 (number, required) - Payment id
+ Response 200 (application/json)
+ Attributes (Payment, fixed-type)
## Customer [/customer]
### Get customer balance [GET /customer/{id}/balance]
+ Parameters
+ id: 0 (number, required) - customer id, use 0 to get `Testing User` balance
+ Response 200 (application/json)
+ Attributes (Balance, fixed-type)
## Data structures
## Payment (object, fixed-type)
+ id (number, required) - unique identifier
+ created (number, required) - Time at which the object was created (taken from `stripe` response). Measured in seconds
+ amount (number, required) - amount in smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency).
+ currency (Currency, required) - three-letter ISO currency code, in lowercase. Must be a supported currency.
+ status (enum[string]) - status of this payment, when payment fully fullfiled, status will be changed toconfirmed
- wait_confirmation
- confirmed
- canceled
+ customer_id (number, required)
+ method_type (enum[string]) - Payment method type
- card
## Balance (object, fixed-type)
+ amount (number, required) - amount in smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency).
+ currency (Currency, required) - three-letter ISO currency code, in lowercase. Must be a supported currency.
## Currency (enum[string])
- usd