{"_id":"56326e9edf556c0d00cd08db","project":"544fc17e698ab40800b4f891","user":"544fc065698ab40800b4f888","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"},"__v":4,"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"},"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-05-06T11:22:10.917Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"Using the coins api [transfers](doc:transfers) endpoint, It is possible to send funds to any phone # or email address. The receiving end does not need not to have a coins account or bitcoin address beforehand.\n\n## Prerequisites\n\n* You have already [created your API keys](doc:creating-your-api-keys) \n* You will need to have sufficient [balance](doc:checking-your-account-balance) in your wallet to send.\n\n## Authentication\n\nIn this example, we'll be using HMAC as the authentication method.  The functions **get_nonce **and **sign_request** are further explained in the [HMAC authentication tutorial](doc:hmac). \n\n\n## Setting up the request\n\n**account** is the ID of the source wallet from which the funds will be deducted from. It can be a PHP or BTC denominated wallet.  To get a list of your accounts and balances, see [this tutorial](doc:checking-your-account-balance).\n\nThe **target_address** can be any phone number, email address, or bitcoin address. \n\nThe **amount** is denominated in the currency of the **account** wallet. for example, if you are sending out of a PHP denominated wallet, the amount will be denominated in peso.  If the target address is a bitcoin wallet, the funds will be automatically converted.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"import requests\\nimport hmac_example\\n\\nurl = 'https://coins.ph/api/v3/transfers'\\n\\nnonce = hmac_example.get_nonce()\\n\\nbody = {\\n  \\t# The source account to send from (this is your coins wallet)\\n  \\t'account': '2r45ab4123ebb298an201',\\n  \\t# the amount to send, denominated in the currency of \\n    # the source account\\n  \\t'amount': 25,\\n    # Where the funds will be sent to (Phone #, Email, or Bitcoin address)\\n  \\t'target_address': 'receipient:::at:::example.com'\\n}\\nsignature = hmac_example.sign_request(url, nonce)\\n\\nheaders = {\\n    'ACCESS_SIGNATURE': signature,\\n    'ACCESS_KEY': hmac_example.API_KEY,\\n    'ACCESS_NONCE': nonce,\\n    'Content-Type': 'application/json',\\n    'Accept': 'application/json'\\n}\\n\\nrequests.get(url, headers=headers)\",\n      \"language\": \"python\"\n    }\n  ]\n}\n[/block]\nThis request should return the following response:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"transfer\\\": {\\n        \\\"id\\\":\\\"1bbq2393nbn01nba01abebl\\\",\\n        \\\"account\\\":\\\"2r45ab4123ebb298an201\\\",\\n        \\\"amount\\\":\\\"25\\\",\\n        \\\"target_address\\\":\\\"receipient@example.com\\\",\\n        \\\"payment\\\": null,\\n        \\\"status\\\":\\\"pending\\\",\\n        \\\"created_at\\\":\\\"2015-05-01T12:11:36.938Z\\\"\\n    }\\n}\",\n      \"language\": \"python\"\n    }\n  ]\n}\n[/block]\nThis means that the transfer has been made from your account to `recipient@example.com`.\n\nIf the destination email/phone # is not associated with a coins.ph user, the recipient will receive a message with instructions for collecting their funds. funds that are not collected within 14 days are credited back to the sender.","excerpt":"","slug":"transfer-funds-api-tutorial","type":"basic","title":"Send funds to any email or phone #"}

Send funds to any email or phone #


Using the coins api [transfers](doc:transfers) endpoint, It is possible to send funds to any phone # or email address. The receiving end does not need not to have a coins account or bitcoin address beforehand. ## Prerequisites * You have already [created your API keys](doc:creating-your-api-keys) * You will need to have sufficient [balance](doc:checking-your-account-balance) in your wallet to send. ## Authentication In this example, we'll be using HMAC as the authentication method. The functions **get_nonce **and **sign_request** are further explained in the [HMAC authentication tutorial](doc:hmac). ## Setting up the request **account** is the ID of the source wallet from which the funds will be deducted from. It can be a PHP or BTC denominated wallet. To get a list of your accounts and balances, see [this tutorial](doc:checking-your-account-balance). The **target_address** can be any phone number, email address, or bitcoin address. The **amount** is denominated in the currency of the **account** wallet. for example, if you are sending out of a PHP denominated wallet, the amount will be denominated in peso. If the target address is a bitcoin wallet, the funds will be automatically converted. [block:code] { "codes": [ { "code": "import requests\nimport hmac_example\n\nurl = 'https://coins.ph/api/v3/transfers'\n\nnonce = hmac_example.get_nonce()\n\nbody = {\n \t# The source account to send from (this is your coins wallet)\n \t'account': '2r45ab4123ebb298an201',\n \t# the amount to send, denominated in the currency of \n # the source account\n \t'amount': 25,\n # Where the funds will be sent to (Phone #, Email, or Bitcoin address)\n \t'target_address': 'receipient@example.com'\n}\nsignature = hmac_example.sign_request(url, nonce)\n\nheaders = {\n 'ACCESS_SIGNATURE': signature,\n 'ACCESS_KEY': hmac_example.API_KEY,\n 'ACCESS_NONCE': nonce,\n 'Content-Type': 'application/json',\n 'Accept': 'application/json'\n}\n\nrequests.get(url, headers=headers)", "language": "python" } ] } [/block] This request should return the following response: [block:code] { "codes": [ { "code": "{\n \"transfer\": {\n \"id\":\"1bbq2393nbn01nba01abebl\",\n \"account\":\"2r45ab4123ebb298an201\",\n \"amount\":\"25\",\n \"target_address\":\"receipient@example.com\",\n \"payment\": null,\n \"status\":\"pending\",\n \"created_at\":\"2015-05-01T12:11:36.938Z\"\n }\n}", "language": "python" } ] } [/block] This means that the transfer has been made from your account to `recipient@example.com`. If the destination email/phone # is not associated with a coins.ph user, the recipient will receive a message with instructions for collecting their funds. funds that are not collected within 14 days are credited back to the sender.