{"__v":2,"_id":"57e508f8f3d7fc0e009c50a8","category":{"project":"571f5e8cd8667f0e00a3c498","version":"571f5e8cd8667f0e00a3c49b","_id":"571f7d2720695f3400f38797","__v":0,"sync":{"url":"","isSync":false},"reference":true,"createdAt":"2016-04-26T14:37:27.487Z","from_sync":false,"order":3,"slug":"session-api","title":"Session-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-23T10:50:32.556Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"code":"<?php \n$curl = curl_init(\"https://secure.fundraisingbox.com/app/createSession\");\n \ncurl_setopt($curl, CURLOPT_CAINFO, dirname(__FILE__).'/cacert.pem');\ncurl_setopt($curl, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($curl, CURLOPT_POST, true);\n \n// set values\n$data = array(\n  \"hash\" => \"{your_form_hash}\",\n  \"payment\" => array(\n\t\t\"first_name\" => \"Max\",\n    \"last_name\" => \"Mustermann\",\n\t\t\"amount\" => \"20\"\n  )\n);\ncurl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));\n \n// receive session\n$result = json_decode(curl_exec($curl), true);\n$status = $result[\"status\"];\n$session = $result[\"session\"];\n \n// TODO error handling\n$curl_error = curl_error($curl);\n$http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);\n$curl_error_no = curl_errno($curl);\nif($curl_error)\n{\n   // do something\n}\n \ncurl_close($curl);\n\n// ...","language":"php"}]},"results":{"codes":[{"status":200,"language":"json","code":"{\n  \"status\": \"success\",\n  \"session\": {\n    // see Session JSON\n\t\t\"hash\": \"0ds1mku0o018wqtkscqcm2kt75l6gjtf57dfb8c04a238\",\n    \"status\": \"incomplete\",\n    \"errors\": {...},\n  \t\"values\": {...},\n    ...\n\t}\n}","name":""},{"code":"{\n  \"status\": \"error\",\n  \"error\": \"...\"\n}","language":"json","status":400}]},"settings":"","auth":"never","params":[{"_id":"57dfbb664d55c022002811df","ref":"","in":"query","required":false,"desc":"required: hash of the form","default":"","type":"string","name":"hash"},{"_id":"571f9219e54f2d0e003ebb38","ref":"","in":"query","required":false,"desc":"required: values (see code example)","default":"","type":"array_mixed","name":"payment"}],"url":"/app/createSession"},"isReference":true,"order":4,"body":"With this method you can create a new session to perform a payment or to prepopulate your form. The sent payment-data is immediately validated as good as possible, so you can easily show errors in a multi-step-form.\nSee [Session JSON](doc:session-json) for details.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Update / read session\",\n  \"body\": \"If you want to update or read the created session afterwards you have to use [app/updateSession](doc:appupdatesession).\"\n}\n[/block]","excerpt":"","slug":"appcreatesession","type":"post","title":"app/createSession"}

postapp/createSession


Definition

{{ api_url }}{{ page_api_url }}

Parameters

Query Params

hash:
string
required: hash of the form
payment:
array of mixed
required: values (see code example)

Examples


Result Format


Documentation

With this method you can create a new session to perform a payment or to prepopulate your form. The sent payment-data is immediately validated as good as possible, so you can easily show errors in a multi-step-form. See [Session JSON](doc:session-json) for details. [block:callout] { "type": "warning", "title": "Update / read session", "body": "If you want to update or read the created session afterwards you have to use [app/updateSession](doc:appupdatesession)." } [/block]

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}