余额支付与充值
益安
1. 账户充值(客户端将充值结果通知服务器<后期这个过程需secret一下>)
Description
用户向自己的账户充值
Method and URL Structure
| Method |
Resource URL |
| PUT |
/pay/fill_in_balance/ |
Request Parameters
| Name |
Description |
Required |
Default |
| amount |
充值的具体金额 |
Yes |
|
| Name |
Description |
Required |
Default |
| Authorization |
Token 7309fabd207c22e0a00eada158989b89ffe839ef |
Yes |
|
*Authorization的值为登录成功后返回值
Request
{ "amount":100,}
cURL Example
curl -X PUT -H 'Authorization: Token 706a87288233ea2427cddb8a1bbce29369ac5073' -d 'amount=100' http://127.0.0.1:8000/pay/fill_in_balance/
JSON Response
{ "pk": 1, "username": "15201052252", "nickname": "晓辰", "location": "河南新乡", "avatar_url": "http://123.jpg", "website": "http://123.html", "point": 41, "birthday": "1993-09-22", "level": "fresh", "level_display": "益安新人", "credit": 28, "credit_level": "pupil", "credit_level_display": "益安小学生", "account": "200.50"}
2. 账户余额付款
Description
用户使用账户余额进行付款
Method and URL Structure
| Method |
Resource URL |
| PUT |
/pay/pay_in_balance/ |
Request Parameters
| Name |
Description |
Required |
Default |
| order_no |
订单号 |
Yes |
|
| channel |
支付方式 |
Yes |
|
balance(余额支付)
| Name |
Description |
Required |
Default |
| Authorization |
Token 7309fabd207c22e0a00eada158989b89ffe839ef |
Yes |
|
*Authorization的值为登录成功后返回值
Request
{ "order_no":12134676899915430002, "channel":"balance",}
cURL Example
curl -X PUT -H 'Authorization: Token 706a87288233ea2427cddb8a1bbce29369ac5073' -d 'order_no=12134676899915430002&channel=balance' http://127.0.0.1:8000/pay/pay_in_balance/
JSON Response Failure
第一种情况{ "status":-4, "message":"您的余额不足,请充值!"}第二种情况{ "status":-4, "message":"你已经购买过\"collection的使用1\"课程,不能重复购买"}第三种情况{ "status":-4, "message":"无效的支付通道"}
JSON Response Success
{ "pk": 1, "buyer": "15201052252", "order_no": "12134676899915430002", "courses": "1", "names": "collection的使用", "count": 1, "amount": "99.00", "status": 1, "flag": 1, "channel": "balance", "create_time": "2016-06-15T03:53:50.598744Z", "profile": { "pk": 1, "username": "15201052252", "nickname": "晓辰", "location": "河南新乡", "avatar_url": "http://123.jpg", "website": "http://123.html", "point": 41, "birthday": "1993-09-22", "level": "fresh", "level_display": "益安新人", "credit": 28, "credit_level": "pupil", "credit_level_display": "益安小学生", "account": "101.50" }}
3. 创建产品种类
Description
用户向ITunes Connect添加几个产品,并把产品信息存储到后台
Method and URL Structure
| Method |
Resource URL |
| POST |
/pay/products/ |
Request Parameters
| Name |
Description |
Required |
Default |
| product_id |
产品id |
Yes |
|
| price |
产品对应价格 |
Yes |
|
| Name |
Description |
Required |
Default |
| Authorization |
Token 7309fabd207c22e0a00eada158989b89ffe839ef |
Yes |
|
*Authorization的值为登录成功后返回值
Request
{ "product_id":"com.51ean.test.product1", "price":6,}
cURL Example
curl -X POST -H 'Authorization: Token 706a87288233ea2427cddb8a1bbce29369ac5073' -d 'product_id=com.51ean.test.product1&price=6' http://127.0.0.1:8000/pay/products/
JSON Response
{ "pk": 1, "product_id": "com.51ean.test.product1", "price": 6, "create_time": "2016-06-15T06:26:36.422585Z"}
4. 获取所有产品种类
Description
用户获取所有产品的种类
Method and URL Structure
| Method |
Resource URL |
| GET |
/pay/products/ |
| Name |
Description |
Required |
Default |
| Authorization |
Token 7309fabd207c22e0a00eada158989b89ffe839ef |
Yes |
|
*Authorization的值为登录成功后返回值
cURL Example
curl -X GET -H 'Authorization: Token 706a87288233ea2427cddb8a1bbce29369ac5073' http://127.0.0.1:8000/pay/products/
JSON Response
[ { "pk": 1, "product_id": "com.51ean.test.product1", "price": 6, "create_time": "2016-06-15T06:26:36.422585Z" }]