兑换和接受
加密货币.
提高营业额,获得客户赞许。
使用 Flyp.me,掌控加密货币的力量。
目录
简介
Flyp.me API 可随时随地快速、高效且可靠地接受 30 多种加密货币。轻轻松松即可与网站、平台或现有服务整合。您与您的客户定会对它爱不释手。
如果您有关于 Flyp.me API 的任何技术问题,请发送电子邮件至 api@flyp.me。如欲成为合作伙伴或有其他相关问题,请发送电子邮件至 business@flyp.me 联系我们。
1. 创建
发起新订单
curl -X POST -d @file.txt https://flyp.me/api/v1/order/new --header "Content-Type:application/json"
file.txt:
{ "order": { "from_currency": "LTC", "to_currency": "ZEC", "ordered_amount": "0.01" } }
备注:
发起初始请求时也可以指定 invoiced_amount,替代 ordered_amount。
Response will always include based with values `INVOICED` or `ORDERED` respectively.
或者,您可以在请求中指定 destination 和 refund_address。
您还可以在请求中指定 referral_code。 请注意,您将需要使用有效的推荐代码,否则订单将会无效。
result.txt:
{ "order": { "uuid": "eeeeb105-d30d-43f1-bbb8-a9f8a237acf5", "destination": null, "exchange_rate": "0.4840738172", "ordered_amount": "0.01", "invoiced_amount": "0.02189749", "charged_fee": "0.0006", "based": "ORDERED", "from_currency": "LTC", "to_currency": "ZEC" }, "refund_address": "LajyQBeZaBA1NkZDeY8YT5RYYVRkXMvb2T", "expires": 1199 }
从 uuid 获取推荐代码,以便继续执行流程。
2. 更新
更新订单
curl -X POST -d @file.txt https://flyp.me/api/v1/order/update --header "Content-Type:application/json"
file.txt:
{ "order": { "uuid": "eeeeb105-d30d-43f1-bbb8-a9f8a237acf5", "ordered_amount": "0.02", "destination": "t1SBTywpsDMKndjogkXhZZSKdVbhadt3rVt", "refund_address": "LajyQBeZaBA1NkZDeY8YT5RYYVRkXMvb2T" } }
备注:
拥有与创建订单相同的参数,但现在,from_currency 和 to_currency 可供选择,且添加了其他强制性参数 uuid。
您还可以在请求中指定 referral_code。 请注意,您将需要使用有效的推荐代码,否则订单将会无效。
result.txt:
{ "order": { "uuid": "eeeeb105-d30d-43f1-bbb8-a9f8a237acf5", "destination": "t1SBTywpsDMKndjogkXhZZSKdVbhadt3rVt", "exchange_rate": "0.4881512527", "ordered_amount": "0.02", "invoiced_amount": "0.04220004", "charged_fee": "0.0006", "based": "ORDERED", "from_currency": "LTC", "to_currency": "ZEC" }, "refund_address": "LajyQBeZaBA1NkZDeY8YT5RYYVRkXMvb2T", "expires": 1199 }
备注:
charged_fee 返回参数是网络费用,以 to_currency 为单位。
3. 接受
接受订单
curl -X POST -d @file.txt https://flyp.me/api/v1/order/accept --header "Content-Type:application/json"
file.txt:
{"uuid": "eeeeb105-d30d-43f1-bbb8-a9f8a237acf5"}
result.txt:
{ "order": { "uuid": "eeeeb105-d30d-43f1-bbb8-a9f8a237acf5", "destination": "t1SBTywpsDMKndjogkXhZZSKdVbhadt3rVt", "exchange_rate": "0.4888796682", "ordered_amount": "0.02", "invoiced_amount": "0.04213716", "charged_fee": "0.0006", "based": "ORDERED", "from_currency": "LTC", "to_currency": "ZEC" }, "expires": 1145, "deposit_address": "M88aw1wCKvVP7EAmqviV8ggxM5ds8BypvQ", "refund_address": "LajyQBeZaBA1NkZDeY8YT5RYYVRkXMvb2T" }
4. 检查
按 uuid 检查订单状态
可能的状态为: WAITING_FOR_DEPOSIT, DEPOSIT_RECEIVED, DEPOSIT_CONFIRMED, EXECUTED, NEEDS_REFUND, REFUNDED, CANCELED and EXPIRED
curl -X POST -d @file.txt https://flyp.me/api/v1/order/check --header "Content-Type:application/json"
file.txt:
{"uuid": "9a14a8c2-cc2e-4156-bbdd-96437ef81bf6"}
result.txt:
{"status": "WAITING_FOR_DEPOSIT", payment_status: "PENDING"}
当订单状态为 EXECUTED 时,结果也会包括‘txid’和‘txurl’。
当付款状态为 XXX_RECEIVED 状态时,结果也会包含‘confirmations’。
{"status": "EXECUTED", "txid": "XXXXX", "txurl": "https://etherscan.io/tx/XXX"}
可能的 payment_status 为 PENDING、UNDERPAY_RECEIVED、UNDERPAY_CONFIRMED、PAYMENT_RECEIVED、PAYMENT_CONFIRMED、OVERPAY_RECEIVED、OVERPAY_CONFIRMED。系统将对多付或少付的订单退款。
5. 信息
获取完整订单信息
此命令速率受限,因此您不应将此命令用于连续监控订单,请使用‘check’替代
curl -X POST -d @file.txt https://flyp.me/api/v1/order/info --header "Content-Type:application/json"
file.txt:
{"uuid": "9a14a8c2-cc2e-4156-bbdd-96437ef81bf6"}
result.txt:
{ "order": { "uuid": "eeeeb105-d30d-43f1-bbb8-a9f8a237acf5", "destination": "t1SBTywpsDMKndjogkXhZZSKdVbhadt3rVt", "exchange_rate": "0.4888796682", "ordered_amount": "0.02", "invoiced_amount": "0.04213716", "charged_fee": "0.0006", "based": "ORDERED", "from_currency": "LTC", "to_currency": "ZEC" }, "expires": 746, "status": "WAITING_FOR_DEPOSIT", "payment_status": "PENDING", "deposit_address": "M88aw1wCKvVP7EAmqviV8ggxM5ds8BypvQ", "refund_address": "LajyQBeZaBA1NkZDeY8YT5RYYVRkXMvb2T" }
当订单状态为 EXECUTED 时,结果也会包括‘txid’和‘txurl’。
当付款状态为 XXX_RECEIVED 状态时,结果也会包含‘confirmations’。
{ "order": { "uuid": "eeeeb105-d30d-43f1-bbb8-a9f8a237acf5", (...) }, (...) "deposit_address": "M88aw1wCKvVP7EAmqviV8ggxM5ds8BypvQ", "txid": "XXXXX", "txurl": "https://etherscan.io/tx/..." }
6. 取消订单
取消暂挂订单
curl -X POST -d @file.txt https://flyp.me/api/v1/order/cancel --header "Content-Type:application/json"
file.txt:
{"uuid": "9a14a8c2-cc2e-4156-bbdd-96437ef81bf6"}
result.txt:
{"result":"ok"}
7. 添加订单退款
为没有退款地址的订单添加一个退款地址。
curl -X POST -d @file.txt https://flyp.me/api/v1/order/addrefund --header "Content-Type:application/json"
file.txt:
{"uuid": "9a14a8c2-cc2e-4156-bbdd-96437ef81bf6", "address": "LajyQBeZaBA1NkZDeY8YT5RYYVRkXMvb2T"}
result.txt:
{"result":"ok"}
8. 查询汇率
获取汇率
curl https://flyp.me/api/v1/data/exchange_rates
result.txt:
{"LTC-BTC":"0.0156975877", "BTC-LTC":"60.5139402396", "PPC-BTC":"0.0004053465", (...) "PPC-LTC":"0.024900034", "BTC-PPC":"2338.8025331034"}
备注:
您可以添加 referral_code 参数,以便获取特定推荐的汇率。
9. 查询活跃货币
获取可用货币信息
curl https://flyp.me/api/v1/currencies货币须将 exchange(交易)和 send(发送) 设置为 true,方可执行无账户交易。确认时间为预期时间,以分钟为单位(大致时间)。其他参数无需加以说明。
result.txt:
{"BTC": {"code":"BTC", "precision":8, "display_precision":4, "created_at":"2014-02-04T02:28:37.000Z", "updated_at":"2017-10-20T14:02:11.000Z", "name":"Bitcoin", "website":"https://bitcoin.org/", "confirmation_time":20, "default":false, "charged_fee":"0.0006", "currency_type":"CRYPTO", "exchange":true, "send":true}, (...) "CREA": {"code":"CREA", "precision":8, "display_precision":4, "created_at":"2017-10-24T09:36:39.000Z", "updated_at":"2017-10-24T13:05:29.000Z", "name":"Creativecoin", "website":"https://www.creativechain.org", "confirmation_time":5, "default":false, "charged_fee":"0.01", "currency_type":"CRYPTO", "exchange":false, "send":false}}
10. 查询限制
获取 {to_currency} 的最大和最小限制。
注意:如欲获取 {from_currency} 的限制,您必须使用汇率进行计算。
GET - /api/v1/order/limits/{from_currency}/{to_currency}
curl -X GET https://flyp.me/api/v1/order/limits/BTC/LTC
result.txt:
{"min":"0.015","max":"52.11198655"}
11. 更新记录
1.1.3: 2018/11/19 - Add NEEDS_REFUND status for orders. - Add refund_address in order results. - Add /order/addrefund api call to add a refund address. - Add payment_status inside order/info and order/check. - Add referral_code parameter to data/exchange_rates. 1.1.2: 2018/05/19 - Add txurl to order/info and order/check results. 1.1.1: 2018/03/12 - Add referral code parameter to create order. 1.1.0: 2017/12/13 - Introduce new limits and order creation api. - Introduce new order/new, order/update and GET order/limits methods. - order/create *deprecated* in favour of order/new and order/update pair. - This allows presenting the exact rate to the user before he accepts. - POST order/limits *deprecated* in favour of GET order/limits. - The new api gives more exact limits since it accepts limits between two currencies instead of limits for just one currency. - Add txid to order/info and order/check results. 1.0.0: 2017/11/21 - First api version on flyp.me release. NOTE about deprecated methods: We prefer api implementors will not be using these, so we removed documentation about them. Still the methods are not removed for backwards compatibility for now.