{"__v":0,"_id":"57dfab324d55c022002811c8","category":{"__v":0,"_id":"57df91b2c6348d0e0020c452","project":"571f5e8cd8667f0e00a3c498","version":"571f5e8cd8667f0e00a3c49b","sync":{"url":"","isSync":false},"reference":true,"createdAt":"2016-09-19T07:20:18.372Z","from_sync":false,"order":5,"slug":"form-api","title":"Payment-API"},"parentDoc":null,"project":"571f5e8cd8667f0e00a3c498","user":"5720c075db52d01700f5d1e4","version":{"__v":12,"_id":"571f5e8cd8667f0e00a3c49b","hasDoc":true,"hasReference":true,"project":"571f5e8cd8667f0e00a3c498","createdAt":"2016-04-26T12:26:52.312Z","releaseDate":"2016-04-26T12:26:52.312Z","categories":["571f5e8cd8667f0e00a3c49c","571f73cfcb4baa0e00d13a80","571f7451cb4baa0e00d13a88","571f7d2720695f3400f38797","571f7fb0ac2a080e0014c661","571f884be54f2d0e003ebb0a","572200c9ecb38d0e00d80ebd","572c301e7c8eff0e00aaa174","57df91b2c6348d0e0020c452","57e104db9ff1e21900a721ab","57fd04caeaa77f19008b8202","5899c7113514ce0f0014da84"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-09-19T09:09:06.006Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":true,"order":0,"body":"With the FundraisingBox-Payment-API you can send your collected data directly to the [app/payment](doc:apppayment)-endpoint or you build up a session with the [Introduction](doc:session-api-introduction) and process a complete session. You get a JSON in return.\n\nFor a 1-step-form we recommend to send the data directly to the payment-endpoint.\n\nUse the [forms/config](doc:formsconfig) to check which fields and values are available in your form.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Form-API\",\n  \"body\": \"We also provide a [Javascript-jQuery-Plugin](doc:form-api-jquery-plugin) for easy implementation on your website.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Authentication\"\n}\n[/block]\nYou just have to provide the hash of your form, there is no secret authentication, because the donation form is a public part of your website. You can find the hash of your form in the settings of your form in your FundraisingBox.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/41433c2-FundraisingBox-FormAPI-FormHash.png\",\n        \"FundraisingBox-FormAPI-FormHash.png\",\n        463,\n        173,\n        \"#eaeff4\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Errors\"\n}\n[/block]\nOn a successful API-request you get a JSON with HTTP status 200. Even if there are e.g. current_fields_errors on your session or the payment_status is \"error\", it was a successful request and it returns a JSON with status \"success\".\n\nOnly if there is an error preventing the API from working you get a JSON with status \"error\" and the corresponding HTTP error code, 400, 404 or 500.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"status\\\": \\\"error\\\",\\n  \\\"error\\\": \\\"error 105: no hash\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n**Possible errors:**\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Error\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"error 101: general error\\nerror 900: general error\",\n    \"0-1\": \"something went wrong, please contact our support\",\n    \"1-0\": \"error 102: not owner\",\n    \"2-0\": \"error 103: inactive\",\n    \"3-0\": \"error 104: not api owner\",\n    \"4-0\": \"error 105: no hash\",\n    \"5-0\": \"error 106: no config\",\n    \"6-0\": \"error 201: session incomplete\",\n    \"7-0\": \"error 202: session processed\",\n    \"11-0\": \"error 404: server error\\nerror 500: server error\",\n    \"12-0\": \"maintenance: *...translated maintenance message...*\",\n    \"1-1\": \"you are not allowed to use forms\",\n    \"2-1\": \"the selected form is inactive\",\n    \"3-1\": \"you are not allowed to use the form api\",\n    \"4-1\": \"form hash is missing\",\n    \"5-1\": \"no form has been found for the given hash\",\n    \"6-1\": \"you can only process complete session with doPayment()\",\n    \"7-1\": \"processed sessions cannot be read or updated\",\n    \"11-1\": \"something is wrong with the server\",\n    \"12-1\": \"the FundraisingBox is currently in maintenance mode\",\n    \"8-0\": \"error 203: session not found\",\n    \"8-1\": \"wrong or no session hash at updateSession\",\n    \"9-0\": \"error 204: session exists already\",\n    \"9-1\": \"hash of existing session used for createSession\",\n    \"10-0\": \"error 205: new session requires values\",\n    \"10-1\": \"you have to submit some values for createSession\"\n  },\n  \"cols\": 2,\n  \"rows\": 13\n}\n[/block]","excerpt":"Payment-API","slug":"payment-api","type":"basic","title":"Introduction"}

Introduction

Payment-API

With the FundraisingBox-Payment-API you can send your collected data directly to the [app/payment](doc:apppayment)-endpoint or you build up a session with the [Introduction](doc:session-api-introduction) and process a complete session. You get a JSON in return. For a 1-step-form we recommend to send the data directly to the payment-endpoint. Use the [forms/config](doc:formsconfig) to check which fields and values are available in your form. [block:callout] { "type": "info", "title": "Form-API", "body": "We also provide a [Javascript-jQuery-Plugin](doc:form-api-jquery-plugin) for easy implementation on your website." } [/block] [block:api-header] { "type": "basic", "title": "Authentication" } [/block] You just have to provide the hash of your form, there is no secret authentication, because the donation form is a public part of your website. You can find the hash of your form in the settings of your form in your FundraisingBox. [block:image] { "images": [ { "image": [ "https://files.readme.io/41433c2-FundraisingBox-FormAPI-FormHash.png", "FundraisingBox-FormAPI-FormHash.png", 463, 173, "#eaeff4" ] } ] } [/block] [block:api-header] { "type": "basic", "title": "Errors" } [/block] On a successful API-request you get a JSON with HTTP status 200. Even if there are e.g. current_fields_errors on your session or the payment_status is "error", it was a successful request and it returns a JSON with status "success". Only if there is an error preventing the API from working you get a JSON with status "error" and the corresponding HTTP error code, 400, 404 or 500. [block:code] { "codes": [ { "code": "{\n \"status\": \"error\",\n \"error\": \"error 105: no hash\"\n}", "language": "json" } ] } [/block] **Possible errors:** [block:parameters] { "data": { "h-0": "Error", "h-1": "Description", "0-0": "error 101: general error\nerror 900: general error", "0-1": "something went wrong, please contact our support", "1-0": "error 102: not owner", "2-0": "error 103: inactive", "3-0": "error 104: not api owner", "4-0": "error 105: no hash", "5-0": "error 106: no config", "6-0": "error 201: session incomplete", "7-0": "error 202: session processed", "11-0": "error 404: server error\nerror 500: server error", "12-0": "maintenance: *...translated maintenance message...*", "1-1": "you are not allowed to use forms", "2-1": "the selected form is inactive", "3-1": "you are not allowed to use the form api", "4-1": "form hash is missing", "5-1": "no form has been found for the given hash", "6-1": "you can only process complete session with doPayment()", "7-1": "processed sessions cannot be read or updated", "11-1": "something is wrong with the server", "12-1": "the FundraisingBox is currently in maintenance mode", "8-0": "error 203: session not found", "8-1": "wrong or no session hash at updateSession", "9-0": "error 204: session exists already", "9-1": "hash of existing session used for createSession", "10-0": "error 205: new session requires values", "10-1": "you have to submit some values for createSession" }, "cols": 2, "rows": 13 } [/block]