{"_id":"56d942c607ae190b000044af","category":{"_id":"56d942ac337fd11300d6a251","__v":2,"pages":["56d942c607ae190b000044af","56d942da6fcdd00b0002cad4"],"project":"544fc17e698ab40800b4f891","version":"56326e9cdf556c0d00cd08ca","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-03-04T08:09:16.560Z","from_sync":false,"order":7,"slug":"payment-requests","title":"Payment Requests"},"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":5,"editedParams":true,"user":"544fc065698ab40800b4f888","editedParams2":true,"parentDoc":null,"project":"544fc17e698ab40800b4f891","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-03-04T08:09:42.913Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","examples":{"codes":[{"code":"import json\nimport requests\n\nurl = \"https://coins.ph/api/v3/payment-requests/\"\n\nTOKEN = 'YOUR TOKEN'\nheaders = {\n    'Authorization': 'Bearer {}'.format(TOKEN),\n    'Content-Type': 'application/json;charset=UTF-8',\n    'Accept': 'application/json'\n}\nbody = json.dumps({\n    'payer_contact_info': 'example:::at:::example.com',\n    'receiving_account': '5411c4604c9b45b8b74837c84daa0f4c',\n    'amount': 20,\n    'message': 'Thanks for all the fish!'\n})\n\nrequests.post(url, headers=headers, data=body)\nprint(response.text)","language":"python"},{"code":"curl -X POST \\\n\t-H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json;charset=UTF-8\" \\\n  -H \"Accept: application/json\" \\\n  -d '{\"payer_contact_info\": \"example@example.com\",\"receiving_account\": \"5411c4604c9b45b8b74837c84daa0f4c\",\"amount\": 20,\"message\": \"Thanks for all the fish!\"}' \\\n\t\"https://coins.ph/api/v3/payment-requests/\"","language":"curl"},{"code":"require 'uri'\nrequire 'json'\nrequire 'net/http'\n\nurl = URI('https://coins.ph/api/v3/payment-requests/')\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url.request_uri)\nrequest[\"content-type\"] = 'application/json'\nrequest[\"authorization\"] = 'Bearer YOUR_BEARER_TOKEN'\nrequest.body = JSON.dump({\n  payer_contact_info: 'example@example.com',\n  receiving_account: '5411c4604c9b45b8b74837c84daa0f4c',\n  amount: 20,\n  message: 'Thanks for all the fish!'\n})\n\nresponse = http.request(request)\nputs response.read_body","language":"ruby"}]},"method":"post","results":{"codes":[{"name":"","code":"{\n    \"payment-request\": {\n        \"id\": \"5edc263fac7f4f61b87632cb5710050f\",\n        \"invoice\": \"5713e3ab76e74e6b85194deaf0f14cel\",\n        \"payer_contact_info\": \"example@example.com\",\n        \"payer_contact_info_type\": \"email\",\n        \"payer_email\": \"example@example.com\",\n        \"amount\": \"20.00000000\",\n        \"currency\": \"PHP\",\n        \"message\": \"Thanks for all the fish!\",\n        \"message_scope\": \"private\",\n        \"status\": \"pending\",\n        \"receiving_account\": \"5411c4604c9b45b8b74837c84daa0f4c\",\n        \"payment_url\": \"https://coins.ph/payment/request/5edc263fac7f4f61b87632cb5710050f\",\n        \"created_at\": \"2016-03-04T07:12:00.352338Z\",\n        \"updated_at\": \"2016-03-04T07:12:00.474500Z\",\n        \"expires_at\":\"2017-03-04T07:11:59.942484Z\"\n    }\n}","language":"json","status":200}]},"auth":"required","params":[{"_id":"56d945f06fcdd00b0002cadb","ref":"","in":"body","required":true,"desc":"The contact to send a payment request to. It can be a phone number or an email address. If the target payer is a registered coins user, `payer_contact_info` may also be that user's Facebook ID","default":"","type":"string","name":"payer_contact_info"},{"_id":"56d945f06fcdd00b0002cada","ref":"","in":"body","required":true,"desc":"Account ID of the wallet to receive funds. To retrieve a wallet's account ID, please use the [accounts](http://api.coins.asia/v2.1/docs/crypto-accounts) endpoint.","default":"","type":"string","name":"receiving_account"},{"_id":"56d945f06fcdd00b0002cad9","ref":"","in":"body","required":true,"desc":"The requested amount to be transferred to the requestor's `receiving_account`.","default":"","type":"double","name":"amount"},{"_id":"56d9487b7222d50b00701485","ref":"","in":"body","required":true,"desc":"An arbitrary message that will be attached to the payment request.","default":"","type":"string","name":"message"},{"_id":"56d9487b7222d50b00701484","ref":"","in":"body","required":false,"desc":"Set whether the attached message can be seen in the feed by:  `private` - Only the payer and payee can see the message, `friends` - In addition to the payer and payee, both parties' friends can see the message, `public` - Everyone can see the message.","default":"private","type":"string","name":"message_scope"},{"_id":"5809f254bf93672f00b6d035","ref":"","in":"body","required":false,"desc":"The expiration of the payment request. Expects date time format ISO 8601 (e.g. `2016-10-20T13:00:00.000000Z`) or time delta from current time (e.g. `1w 3d 2h 32m 5s`).","default":"","type":"string","name":"expires_at"},{"_id":"59db0d5e2589ab00107e940c","ref":"","in":"body","required":false,"desc":"Payment options available to the user when viewing the payment request.","default":"['coins_peso_wallet', 'cash_payment']","type":"array_string","name":"supported_payment_collectors"}],"url":"/api/v3/payment-requests/"},"isReference":false,"order":1,"body":"# Quick Start\n\nObtain an [OAuth2](doc:oauth) token and then replace `YOUR_TOKEN` in the following example.\n\n```curl\ncurl -X POST \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json;charset=UTF-8\" \\\n  -H \"Accept: application/json\" \\\n  -d '{\"payer_contact_info\": \"example@example.com\",\"receiving_account\": \"5411c4604c9b45b8b74837c84daa0f4c\",\"amount\": 20,\"message\": \"Thanks for all the fish!\"}' \\\n  \"https://coins.ph/api/v3/payment-requests/\"\n```\n\n# Introduction\n\nA Payment Request is an attempt of a particular payee to ask for funds from another person. The payer need not be an existing coins user. To request for payment, the payee only needs to know at least one of the payor's details:\n\n* phone number\n* email address\n\nA successful payment request will send a notification through email or phone number, with a link where the payer may select a payment option. The payer could then select one of the currently available payment options. All options available to non-coins users are also available for current coins users.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/uRDyNO6AQt69ox7YMKeZ_Screen_Shot_2016-03-13_at_2_37_52_PM.jpg\",\n        \"Screen_Shot_2016-03-13_at_2_37_52_PM.jpg\",\n        \"906\",\n        \"1800\",\n        \"#2f90d0\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n# Payment Options\n\nYou can specify specific payment options that a payment request will present to the paying user. Options that can be passed are the following:\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"coins_peso_wallet\",\n    \"h-0\": \"Code\",\n    \"h-1\": \"Description\",\n    \"1-0\": \"cash_payment\",\n    \"2-0\": \"seven_connect_deposit\",\n    \"3-0\": \"mlhuillier_deposit\",\n    \"4-0\": \"cebuana_lhuillier_deposit\",\n    \"0-1\": \"Pay with the user's Peso Coins wallet.\",\n    \"1-1\": \"Pay with any of the payment options that requires the user to pay over the counter.\",\n    \"2-1\": \"Pay over the counter at any 7-eleven convenience store.\",\n    \"3-1\": \"Pay over the counter at any Mlhuillier branch.\",\n    \"4-1\": \"Pay over the counter at any Cebuana Lhuillier branch.\"\n  },\n  \"cols\": 2,\n  \"rows\": 5\n}\n[/block]\n## Coins Account\n\nCoins users can select this option to use one of their wallets to pay for the payment request. Funds will be transferred from the payers selected wallet to the payee's account.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/GSoJcVBzSzCkHbT6inid_Screen%20Shot%202016-03-13%20at%202.55.25%20PM.png\",\n        \"Screen Shot 2016-03-13 at 2.55.25 PM.png\",\n        \"844\",\n        \"1048\",\n        \"#2b8ce3\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n## 7-Eleven Deposit\n\nPayers may choose this option to pay for the payment request by depositing funds through a 7-Eleven store. A 7-Connect reference number will be generated, along with a barcode which a payer could present to the store clerk for scanning.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/PyOeRtw0SGudWvLbpR8j_Screen%20Shot%202016-03-13%20at%202.47.28%20PM.png\",\n        \"Screen Shot 2016-03-13 at 2.47.28 PM.png\",\n        \"844\",\n        \"1314\",\n        \"#407bb7\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n## M Lhuillier\n\nPayers may choose this option to pay for the payment request by depositing funds through an MLhuillier outlet. An EPay transaction code will be generated for the payment request. Funds for the payment request will be transferred to the payee's account once payment has been made through the specified transaction code.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/pQBUqezpSE2Ipyr3xCo0_mle.jpg\",\n        \"mle.jpg\",\n        \"844\",\n        \"942\",\n        \"#327ebe\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]","excerpt":"Create a new payment request","slug":"payment-requests","type":"endpoint","title":"payment-requests"}

postpayment-requests

Create a new payment request

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Body Params

payer_contact_info:
required
string
The contact to send a payment request to. It can be a phone number or an email address. If the target payer is a registered coins user, `payer_contact_info` may also be that user's Facebook ID
receiving_account:
required
string
Account ID of the wallet to receive funds. To retrieve a wallet's account ID, please use the [accounts](http://api.coins.asia/v2.1/docs/crypto-accounts) endpoint.
amount:
required
double
The requested amount to be transferred to the requestor's `receiving_account`.
message:
required
string
An arbitrary message that will be attached to the payment request.
message_scope:
stringprivate
Set whether the attached message can be seen in the feed by: `private` - Only the payer and payee can see the message, `friends` - In addition to the payer and payee, both parties' friends can see the message, `public` - Everyone can see the message.
expires_at:
string
The expiration of the payment request. Expects date time format ISO 8601 (e.g. `2016-10-20T13:00:00.000000Z`) or time delta from current time (e.g. `1w 3d 2h 32m 5s`).
supported_payment_collectors:
array of strings['coins_peso_wallet', 'cash_payment']
Payment options available to the user when viewing the payment request.

Examples


Result Format


Documentation

# Quick Start Obtain an [OAuth2](doc:oauth) token and then replace `YOUR_TOKEN` in the following example. ```curl curl -X POST \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json;charset=UTF-8" \ -H "Accept: application/json" \ -d '{"payer_contact_info": "example@example.com","receiving_account": "5411c4604c9b45b8b74837c84daa0f4c","amount": 20,"message": "Thanks for all the fish!"}' \ "https://coins.ph/api/v3/payment-requests/" ``` # Introduction A Payment Request is an attempt of a particular payee to ask for funds from another person. The payer need not be an existing coins user. To request for payment, the payee only needs to know at least one of the payor's details: * phone number * email address A successful payment request will send a notification through email or phone number, with a link where the payer may select a payment option. The payer could then select one of the currently available payment options. All options available to non-coins users are also available for current coins users. [block:image] { "images": [ { "image": [ "https://files.readme.io/uRDyNO6AQt69ox7YMKeZ_Screen_Shot_2016-03-13_at_2_37_52_PM.jpg", "Screen_Shot_2016-03-13_at_2_37_52_PM.jpg", "906", "1800", "#2f90d0", "" ] } ] } [/block] # Payment Options You can specify specific payment options that a payment request will present to the paying user. Options that can be passed are the following: [block:parameters] { "data": { "0-0": "coins_peso_wallet", "h-0": "Code", "h-1": "Description", "1-0": "cash_payment", "2-0": "seven_connect_deposit", "3-0": "mlhuillier_deposit", "4-0": "cebuana_lhuillier_deposit", "0-1": "Pay with the user's Peso Coins wallet.", "1-1": "Pay with any of the payment options that requires the user to pay over the counter.", "2-1": "Pay over the counter at any 7-eleven convenience store.", "3-1": "Pay over the counter at any Mlhuillier branch.", "4-1": "Pay over the counter at any Cebuana Lhuillier branch." }, "cols": 2, "rows": 5 } [/block] ## Coins Account Coins users can select this option to use one of their wallets to pay for the payment request. Funds will be transferred from the payers selected wallet to the payee's account. [block:image] { "images": [ { "image": [ "https://files.readme.io/GSoJcVBzSzCkHbT6inid_Screen%20Shot%202016-03-13%20at%202.55.25%20PM.png", "Screen Shot 2016-03-13 at 2.55.25 PM.png", "844", "1048", "#2b8ce3", "" ] } ] } [/block] ## 7-Eleven Deposit Payers may choose this option to pay for the payment request by depositing funds through a 7-Eleven store. A 7-Connect reference number will be generated, along with a barcode which a payer could present to the store clerk for scanning. [block:image] { "images": [ { "image": [ "https://files.readme.io/PyOeRtw0SGudWvLbpR8j_Screen%20Shot%202016-03-13%20at%202.47.28%20PM.png", "Screen Shot 2016-03-13 at 2.47.28 PM.png", "844", "1314", "#407bb7", "" ] } ] } [/block] ## M Lhuillier Payers may choose this option to pay for the payment request by depositing funds through an MLhuillier outlet. An EPay transaction code will be generated for the payment request. Funds for the payment request will be transferred to the payee's account once payment has been made through the specified transaction code. [block:image] { "images": [ { "image": [ "https://files.readme.io/pQBUqezpSE2Ipyr3xCo0_mle.jpg", "mle.jpg", "844", "942", "#327ebe", "" ] } ] } [/block]