{"_id":"5d1d8bb82d46d1004a025820","version":{"_id":"56326e9cdf556c0d00cd08ca","project":"544fc17e698ab40800b4f891","__v":22,"createdAt":"2015-10-29T19:08:12.724Z","releaseDate":"2015-10-29T19:08:12.724Z","categories":["56326e9ddf556c0d00cd08cb","56326e9ddf556c0d00cd08cc","56326e9ddf556c0d00cd08cd","56326e9ddf556c0d00cd08ce","56326e9ddf556c0d00cd08cf","56326e9ddf556c0d00cd08d0","56326e9ddf556c0d00cd08d1","56326e9ddf556c0d00cd08d2","56326e9ddf556c0d00cd08d3","56326e9ddf556c0d00cd08d4","56d942ac337fd11300d6a251","5ab2fcf66a1d77001230b47e","5afc2943bd2ef4000330bca7","5d1d87419a969a00141c6b4c","5d1d8948ef26b2002c6468d1","5d1d8afe7b2b24005bec7de0","5d1d8b24f5cfcb00201490bb","5d1d8bb82d46d1004a02581f","5d1d8de1e4edb0019ed63acd","5d1d8f6b613fb90050d0d3e0","5d1d934ed377870191039d28","5d1d99810b2e4600500eb5ff","5d1da14e613fb90050d0d491","5d229a846cf323005a7fa998","5d229a8c8abf65001cc4768d","5d229a9494b856002e26b6e1","5d229a9bf77bb900507ccb04","5d229aa88abf65001cc4768e","5d24310a9ca8c80054786177","5d24359101cc3a00508e7482","5d24418fa791b20050733b32"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"collector","version_clean":"2.1.0","version":"2.1"},"updatedAt":"2019-07-04T07:57:18.792Z","category":{"_id":"5d1d8bb82d46d1004a02581f","project":"544fc17e698ab40800b4f891","version":"56326e9cdf556c0d00cd08ca","apiSetting":"5d1d8bb82d46d1004a02581d","isAPI":true,"__v":0,"sync":{"url":"","isSync":false},"reference":true,"createdAt":"2019-07-04T05:16:40.670Z","from_sync":false,"order":15,"slug":"cash-in-1","title":"Cash In"},"project":"544fc17e698ab40800b4f891","__v":3,"user":"5d19a189b4596f0072f571d4","parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2019-07-04T05:16:40.698Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"method":"post","apiSetting":"5d1d8bb82d46d1004a02581d","examples":{"codes":[{"code":"import json\nimport requests\n\nTOKEN = 'YOUR TOKEN'\nurl = 'https://coins.ph/api/v2/buyorder'\n\nheaders = {\n    'Authorization': 'Bearer {}'.format(TOKEN),\n    'Content-Type': 'application/json;charset=UTF-8',\n    'Accept': 'application/json'\n}\n\nbody = json.dumps({\n    'currency': 'PHP',\n    'btc_amount': 0.1,\n    'payment_method': 'bdo_deposit',\n    'target_account_id': '1a2c3b4n',\n    'rate': 10501\n})\n\nrequests.post(url, headers=headers, data=body)","language":"python"}]},"results":{"codes":[{"name":"","code":"{\n    \"order\": {\n        \"btc_amount\": \"0.1\",\n        \"btc_released\": \"0\",\n        \"canceled_time\": null,\n        \"created_at\": \"1408420128\",\n        \"currency_amount\": \"1050\",\n        \"id\": \"dsff1434143\",\n        \"marked_paid_time\": null,\n        \"payment_method\": \"bpi_deposit\",\n        \"rate\": \"10501\",\n        \"status\": \"pending_payment\",\n        \"wallet_address\": \"ea231324a\"\n    },\n    \"success\": true\n}\n","language":"json","status":201}]},"auth":"required","params":[{"_id":"5d1d8c9c0b2e4600500eb535","ref":"","in":"body","required":false,"desc":"The amount of BTC to buy. Either this or `currency_amount` should be provided.","default":"","type":"string","name":"btc_amount"},{"_id":"5d1d8c9c0b2e4600500eb534","ref":"","in":"body","required":false,"desc":"The amount of fiat currency to exchange for BTC. Either this or `btc_amount` should be provided.","default":"","type":"double","name":"currency_amount"},{"_id":"5d1d8c9c0b2e4600500eb533","ref":"","in":"body","required":true,"desc":"[Payin outlet id](doc:payin-outlets) to cash-in","default":"","type":"string","name":"payment_method"},{"_id":"5d1d8c9c0b2e4600500eb532","ref":"","in":"body","required":true,"desc":"ISO 4217 currency symbol used for the cash-in","default":"","type":"string","name":"currency"},{"_id":"5d1d8c9c0b2e4600500eb531","ref":"","in":"body","required":false,"desc":"ID of the coins wallet to be credited. Could either be a BTC or PHP account.","default":"","type":"string","name":"target_account_id"},{"_id":"5d1d8c9c0b2e4600500eb530","ref":"","in":"body","required":false,"desc":"BTC wallet address to be credited. If `target_account_id` is provided, this parameter is optional.","default":"","type":"string","name":"target_wallet"},{"_id":"5d1d8c9c0b2e4600500eb52f","ref":"","in":"body","required":false,"desc":"Optional. The current BTC->Currency exchange rate. The current rate can be retrieved via the [quoter](doc:market-rates).","default":"","type":"int","name":"rate"}],"url":"/api/v2/buyorder"},"isReference":true,"order":0,"body":"Buy orders allow users to cash in for bitcoins. Supported cash in options can be retrieved from [payin-outlets](doc:payin-outlets).\n\n## Properties\n\n* **id** - A unique identifier for the buyorder.\n* **btc_amount** - The amount of BTC transaction.\n* **btc_released** - If the buyorder is already processed, specifies the amount released to the target account or address.\n* **canceled_time** - If the buyorder is canceled, specifies the time when it was cancelled.\n* **created_at** - Specifies the time when the buyorder was created\n* **currency_amount** - The equivalent amount of the `btc_amount` in fiat, based on the rate when the order was created.\n* **marked_paid_time** - Specifies the time when the user marked the buyorder as paid.\n* **payment_method** - The [payin-outlet](doc:payin-outlets) used to pay for the buyorder.\n* **rate** - BTC->Fiat exchange rate at the time when the buyorder was created. Current rates can be retrieved via the [quoter](doc:market-rates).\n* **status** - Specifies whether the order is `released`, `payment_received`, `canceled`, or `escrow_expired`.\n* **wallet_address** - The BTC wallet address where the funds will be `released` after the buyorder is fullfiled.","excerpt":"Create a new buyorder","slug":"getting-started-with-your-api","type":"endpoint","title":"buyorder"}

postbuyorder

Create a new buyorder

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Body Params

btc_amount:
string
The amount of BTC to buy. Either this or `currency_amount` should be provided.
currency_amount:
double
The amount of fiat currency to exchange for BTC. Either this or `btc_amount` should be provided.
payment_method:
required
string
[Payin outlet id](doc:payin-outlets) to cash-in
currency:
required
string
ISO 4217 currency symbol used for the cash-in
target_account_id:
string
ID of the coins wallet to be credited. Could either be a BTC or PHP account.
target_wallet:
string
BTC wallet address to be credited. If `target_account_id` is provided, this parameter is optional.
rate:
integer
Optional. The current BTC->Currency exchange rate. The current rate can be retrieved via the [quoter](doc:market-rates).

Examples


Result Format


Documentation

Buy orders allow users to cash in for bitcoins. Supported cash in options can be retrieved from [payin-outlets](doc:payin-outlets). ## Properties * **id** - A unique identifier for the buyorder. * **btc_amount** - The amount of BTC transaction. * **btc_released** - If the buyorder is already processed, specifies the amount released to the target account or address. * **canceled_time** - If the buyorder is canceled, specifies the time when it was cancelled. * **created_at** - Specifies the time when the buyorder was created * **currency_amount** - The equivalent amount of the `btc_amount` in fiat, based on the rate when the order was created. * **marked_paid_time** - Specifies the time when the user marked the buyorder as paid. * **payment_method** - The [payin-outlet](doc:payin-outlets) used to pay for the buyorder. * **rate** - BTC->Fiat exchange rate at the time when the buyorder was created. Current rates can be retrieved via the [quoter](doc:market-rates). * **status** - Specifies whether the order is `released`, `payment_received`, `canceled`, or `escrow_expired`. * **wallet_address** - The BTC wallet address where the funds will be `released` after the buyorder is fullfiled.