{"_id":"56326e9edf556c0d00cd08dd","parentDoc":null,"user":"544fc065698ab40800b4f888","category":{"_id":"56326e9ddf556c0d00cd08cd","pages":["56326e9edf556c0d00cd08da","56326e9edf556c0d00cd08db","56326e9edf556c0d00cd08dc","56326e9edf556c0d00cd08dd","56326e9edf556c0d00cd08de","56326e9edf556c0d00cd08df","5632e61862c48a0d00334ddc","5637210ec75f5d0d00ec5d4a","563750380704070d00f06c4b","56ecf98c7f94882900591955"],"version":"56326e9cdf556c0d00cd08ca","__v":5,"project":"544fc17e698ab40800b4f891","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-05-01T09:13:02.297Z","from_sync":false,"order":2,"slug":"tutorials","title":"Tutorials"},"__v":2,"project":"544fc17e698ab40800b4f891","version":{"_id":"56326e9cdf556c0d00cd08ca","project":"544fc17e698ab40800b4f891","__v":2,"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"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"collector","version_clean":"2.1.0","version":"2.1"},"updates":["580886090576b40f000a5d8c"],"next":{"pages":[],"description":""},"createdAt":"2015-05-01T09:13:38.717Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":3,"body":"Using the coins API, you can send load to any supported phone number. It could be your phone number, or anyone else's. The [sellorder](doc:sellorder) makes this possible by converting bitcoins into phone load.\n\n## Prerequisites\n\n* A properly set up [API key](doc:creating-your-api-keys) \n* An [Authentication method](doc:choosing-an-authentication-method) \n* Sender must have either BTC or PHP balance\n\n## Accepted Currencies\n\nLoad can be paid using the user's BTC balance, or PHP balance. To pay using BTC, the `pay_with_wallet` parameter should indicate `BTC`. Conversely, `PBTC` should be indicated when `PHP` would be used to pay for the load. However, please do take note that regardless of the currency to be used for payment, the current `BTC` conversion rate should be indicated in the `btc_amount` parameter. Current rates for accepted currencies can be retrieved via the [quoter](doc:market-rates).\n\n## Using the Sell API to Send Load\n\nSending load is a `POST` request to the [sellorder](doc:sellorder) endpoint. The body must have:\n\n* **payment_outlet** - This can either be `load-globe`, `load-smart`, or `load-suncell`.\n* **currency_amount_locked** - The amount of load to send.\n* **currency** - The medium of exchange to use for buying load. Can either be `BTC` or `PHP`.\n* **pay_with_wallet** - The user's wallet to use to pay for the load. Can either be `BTC` or `PBTC`.\n* **phone_number_load** - The phone number to send load to.\n* **btc_amount** - Converted BTC amount of `currency_amount_locked`.\n* **code** - (Optional) Your two-factor authentication code, if you have it enabled on your account.\n\nHere's an example code on how to load up a phone number:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"import requests\\n\\nTOKEN = 'YOUR TOKEN'  # OAuth2\\nurl = 'https://coins.ph/api/v2/sellorder'\\n\\nheaders = {\\n    'Authorization': 'Bearer {}'.format(TOKEN),\\n    'Content-Type': 'application/json;charset=UTF-8',\\n    'Accept': 'application/json'\\n}\\n\\nbody = {\\n    \\\"payment_outlet\\\": \\\"load-globe\\\",\\n    \\\"btc_amount\\\": 0.0020504,\\n    \\\"code\\\": 189772,\\n    \\\"currency\\\": \\\"PHP\\\",\\n    \\\"currency_amount_locked\\\": 25,\\n    \\\"pay_with_wallet\\\": \\\"BTC\\\",\\n    \\\"phone_number_load\\\": \\\"+639171234567\\\"\\n}\\n\\nrequests.post(url, headers=headers, data=body)\",\n      \"language\": \"python\"\n    }\n  ]\n}\n[/block]\nA successful response:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"order\\\": {\\n    \\\"amount\\\": \\\"25\\\",\\n    \\\"btc_amount\\\": \\\"0.00205\\\",\\n    \\\"btc_pending\\\": \\\"0\\\",\\n    \\\"btc_received\\\": \\\"0\\\",\\n    \\\"confirmation_code\\\": \\\"12323\\\",\\n    \\\"confirmations\\\": [],\\n    \\\"created_time\\\": \\\"1425466700\\\",\\n    \\\"currency\\\": \\\"PHP\\\",\\n    \\\"currency_amount\\\": \\\"25\\\",\\n    \\\"currency_fees\\\": \\\"0\\\",\\n    \\\"currency_net\\\": \\\"25\\\",\\n    \\\"currency_settled\\\": \\\"0\\\",\\n    \\\"due_btc_amount\\\": \\\"0.00205\\\",\\n    \\\"expires_epoch\\\": \\\"1425470360\\\",\\n    \\\"fields\\\": {\\n      \\\"phone_number_load\\\": \\\"+639171234567\\\"\\n    },\\n    \\\"id\\\": \\\"123\\\",\\n    \\\"payment_account\\\": {\\n      \\\"id\\\": \\\"123\\\",\\n      \\\"payment_outlet\\\": {\\n        \\\"id\\\": \\\"load-globe\\\",\\n        \\\"name\\\": \\\"Globe / TM Prepaid\\\"\\n      },\\n      \\\"required_fields\\\": [\\n        {\\n          \\\"name\\\": \\\"phone_number_load\\\",\\n          \\\"value\\\": \\\"+639171234567\\\"\\n        }\\n      ]\\n    },\\n    \\\"payment_outlet_id\\\": \\\"load-globe\\\",\\n    \\\"payment_outlet_name\\\": \\\"Globe / TM Prepaid\\\",\\n    \\\"payment_outlet_type_id\\\": \\\"mobile-load\\\",\\n    \\\"phone_number_load\\\": \\\"+639171234567\\\",\\n    \\\"qr_img_url\\\": \\\"https://the.chart.uri\\\",\\n    \\\"rate\\\": \\\"12188\\\",\\n    \\\"region\\\": \\\"PH\\\",\\n    \\\"settlements\\\": [],\\n    \\\"status\\\": \\\"pending\\\",\\n    \\\"user_id\\\": \\\"123\\\",\\n    \\\"user_uri\\\": \\\"https://coins.ph/sellorder/456\\\",\\n    \\\"wallet_address\\\": \\\"1f73WCSwMGwvA8p3E6DkwseDE5qN3FxMRn\\\"\\n  },\\n  \\\"success\\\": true\\n}\\n\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n## Load Denominations\n\nNot all network providers support the same load denomination, let alone an arbitrary\namount. The following are the valid load denominations.\n\n### Globe/Touch Mobile\n\nValues of 25, 50, 150, 300, and 500 are supported.\n\n### Smart/Talk N Text\n\nValues of 30, 50, 60, 100, 115, 200, 300, and 500 are supported.\n\n### Sun Cellular\n\nValues of 25, 30, 50, 100, 150, 300, and 500 are supported.","excerpt":"Use your coins funds to load up a mobile phone number","slug":"loading-up-a-phone-number","type":"basic","title":"Topping-up a phone number"}

Topping-up a phone number

Use your coins funds to load up a mobile phone number

Using the coins API, you can send load to any supported phone number. It could be your phone number, or anyone else's. The [sellorder](doc:sellorder) makes this possible by converting bitcoins into phone load. ## Prerequisites * A properly set up [API key](doc:creating-your-api-keys) * An [Authentication method](doc:choosing-an-authentication-method) * Sender must have either BTC or PHP balance ## Accepted Currencies Load can be paid using the user's BTC balance, or PHP balance. To pay using BTC, the `pay_with_wallet` parameter should indicate `BTC`. Conversely, `PBTC` should be indicated when `PHP` would be used to pay for the load. However, please do take note that regardless of the currency to be used for payment, the current `BTC` conversion rate should be indicated in the `btc_amount` parameter. Current rates for accepted currencies can be retrieved via the [quoter](doc:market-rates). ## Using the Sell API to Send Load Sending load is a `POST` request to the [sellorder](doc:sellorder) endpoint. The body must have: * **payment_outlet** - This can either be `load-globe`, `load-smart`, or `load-suncell`. * **currency_amount_locked** - The amount of load to send. * **currency** - The medium of exchange to use for buying load. Can either be `BTC` or `PHP`. * **pay_with_wallet** - The user's wallet to use to pay for the load. Can either be `BTC` or `PBTC`. * **phone_number_load** - The phone number to send load to. * **btc_amount** - Converted BTC amount of `currency_amount_locked`. * **code** - (Optional) Your two-factor authentication code, if you have it enabled on your account. Here's an example code on how to load up a phone number: [block:code] { "codes": [ { "code": "import requests\n\nTOKEN = 'YOUR TOKEN' # OAuth2\nurl = 'https://coins.ph/api/v2/sellorder'\n\nheaders = {\n 'Authorization': 'Bearer {}'.format(TOKEN),\n 'Content-Type': 'application/json;charset=UTF-8',\n 'Accept': 'application/json'\n}\n\nbody = {\n \"payment_outlet\": \"load-globe\",\n \"btc_amount\": 0.0020504,\n \"code\": 189772,\n \"currency\": \"PHP\",\n \"currency_amount_locked\": 25,\n \"pay_with_wallet\": \"BTC\",\n \"phone_number_load\": \"+639171234567\"\n}\n\nrequests.post(url, headers=headers, data=body)", "language": "python" } ] } [/block] A successful response: [block:code] { "codes": [ { "code": "{\n \"order\": {\n \"amount\": \"25\",\n \"btc_amount\": \"0.00205\",\n \"btc_pending\": \"0\",\n \"btc_received\": \"0\",\n \"confirmation_code\": \"12323\",\n \"confirmations\": [],\n \"created_time\": \"1425466700\",\n \"currency\": \"PHP\",\n \"currency_amount\": \"25\",\n \"currency_fees\": \"0\",\n \"currency_net\": \"25\",\n \"currency_settled\": \"0\",\n \"due_btc_amount\": \"0.00205\",\n \"expires_epoch\": \"1425470360\",\n \"fields\": {\n \"phone_number_load\": \"+639171234567\"\n },\n \"id\": \"123\",\n \"payment_account\": {\n \"id\": \"123\",\n \"payment_outlet\": {\n \"id\": \"load-globe\",\n \"name\": \"Globe / TM Prepaid\"\n },\n \"required_fields\": [\n {\n \"name\": \"phone_number_load\",\n \"value\": \"+639171234567\"\n }\n ]\n },\n \"payment_outlet_id\": \"load-globe\",\n \"payment_outlet_name\": \"Globe / TM Prepaid\",\n \"payment_outlet_type_id\": \"mobile-load\",\n \"phone_number_load\": \"+639171234567\",\n \"qr_img_url\": \"https://the.chart.uri\",\n \"rate\": \"12188\",\n \"region\": \"PH\",\n \"settlements\": [],\n \"status\": \"pending\",\n \"user_id\": \"123\",\n \"user_uri\": \"https://coins.ph/sellorder/456\",\n \"wallet_address\": \"1f73WCSwMGwvA8p3E6DkwseDE5qN3FxMRn\"\n },\n \"success\": true\n}\n", "language": "json" } ] } [/block] ## Load Denominations Not all network providers support the same load denomination, let alone an arbitrary amount. The following are the valid load denominations. ### Globe/Touch Mobile Values of 25, 50, 150, 300, and 500 are supported. ### Smart/Talk N Text Values of 30, 50, 60, 100, 115, 200, 300, and 500 are supported. ### Sun Cellular Values of 25, 30, 50, 100, 150, 300, and 500 are supported.