{"__v":3,"_id":"57dfc6cb5927cb0e002bce40","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-19T11:06:51.564Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"language":"php","code":"<?php \n$curl = curl_init(\"https://secure.fundraisingbox.com/app/payment\");\n\ncurl_setopt($curl, CURLOPT_CAINFO, dirname(__FILE__).'/cacert.pem');\ncurl_setopt($curl, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($curl, CURLOPT_POST, true);\n\n// 1-step-form: minimal example data to process direct debit values directly:\n$data = array(\n  \"api\" => \"json\",\n  \"hash\" => \"{your_form_hash}\",\n  \"payment\" => array(\n    \"amount\" => 10,\n    \"salutation\" => \"Mr.\",\n    \"first_name\" => \"Max\",\n    \"last_name\" => \"Mustermann\",\n    \"payment_method\" => \"sepa_direct_debit\",\n    \"bank_account_owner\" => \"Max Mustermann\",\n    \"bank_iban\" => \"DE12345678901234567890\"\n  )\n);\n\n// multi-step-form: example data to process a session:\n$data = array(\n  \"api\" => \"json\",\n  \"hash\" => \"{your_form_hash}\",\n  \"fbSessionHash\" => \"{hash_of_complete_session}\"\n);\n\ncurl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));\n\n$curlResult = curl_exec($curl);\n\n// TODO: curl error handling\n$curl_error = curl_error($curl);\n$curl_error_no = curl_errno($curl);\n$http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);\nif($curl_error)\n{\n   // do something\n}\n \ncurl_close($curl);\n\n// Read result\n$result = json_decode($curlResult, true);\n$status = $result[\"status\"];\n$paymentStatus = $result[\"payment_status\"];\n$redirectUrl = $result[\"redirect_url\"];\n$transaction = $result[\"transaction\"];\n\nif($status == \"success\")\n{\n  if($paymentStatus == \"awaiting\")\n  {\n    // redirect payment (PayPal, Sofortüberweisung, EPS, ...)\n    // Important: payment is not done yet, you have to redirect user to $redirectUrl\n  }\n  elseif($paymentStatus == \"success\")\n  {\n    // forward to thank you page or show immediately a thank you message\n  }\n  else\n  {\n    // show errors to user\n  }\n}\nelse\n{\n  // handle api error\n}"}]},"results":{"codes":[{"name":"payment_status: success","code":"{\n\t\t\"status\": \"success\",\n    \"payment_status\": \"success\", // or \"awaiting\" if redirect payment (PayPal, Sofortüberweisung, EPS)\n    \"redirect_url\": \"http://myorganisation.de/thankyou.html?amount=12.34\",\n    \"transaction\": {\n      \t// see Transaction JSON\n    \t\t\"id\": \"FB-T-123456\",\n    \t\t// ...\n\t\t}\n}\n","language":"json","status":200},{"code":"{\n  \"status\": \"success\",\n  \"payment_status\": \"error\",\n\t\"errors\": {\n    // See Errors JSON\n    \"current_fields\": { ... },\n    \"globals\": [\n      \"Es ist ein Fehler aufgetreten. Bitte laden Sie die Seite neu und versuchen Sie es erneut.\",\n      //...\n\t\t]\n\t}\n}","language":"json","status":200,"name":"payment_status: error"}]},"settings":"","auth":"never","params":[{"_id":"57dfd2065ca3730e0074c96a","ref":"","in":"query","required":false,"desc":"required: \"json\"","default":"","type":"string","name":"api"},{"_id":"57dfbb664d55c022002811df","ref":"","in":"query","required":false,"desc":"required: hash of the form","default":"","type":"string","name":"hash"},{"_id":"57dfcc8c80aef10e008990b7","ref":"","in":"query","required":false,"desc":"optional: hash of the complete session","default":"","type":"string","name":"fbSessionHash"},{"_id":"57ff560b8e087d0e000303ca","ref":"","in":"query","required":false,"desc":"required if no session: values to be processed","default":"","type":"array_mixed","name":"payment"}],"url":"/app/payment"},"isReference":true,"order":1,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Result\"\n}\n[/block]\nIf everything went successfully you get a [Transaction JSON](doc:transaction-json) in return. Otherwise you get a [Errors JSON](doc:errors-json) and you have to handle or show the errors to your user.\n[block:callout]\n{\n  \"type\": \"danger\",\n  \"title\": \"Consider the payment_status!\",\n  \"body\": \"If the payment status is \\\"awaiting\\\" you have to redirect the user to the given redirect url, so he/she can finalize the payment.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Processing a session\"\n}\n[/block]\nBuild up a session with the [Session-API](doc:session-api-introduction) and submit **only** the session hash to this endpoint. The status of your session has to be \"complete\", so there must not be any errors in the session. **Important: ** additional \"payment\"-data sent with the session will be ignored, you cannot combine these.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"A session can only be processed once!\",\n  \"body\": \"After a session was sucessfully processed, you cannot read or use it again.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Success and failure URL\"\n}\n[/block]\nAfter a redirect payment like PayPal there has to be a success/failure page. By default it's the embed url of your form with a status parameter. We recommend to submit a \"success_redirect_url\" and \"failure_redirect_url\" so these urls are taken for redirect.","excerpt":"","slug":"apppayment","type":"post","title":"app/payment"}

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Query Params

api:
string
required: "json"
hash:
string
required: hash of the form
fbSessionHash:
string
optional: hash of the complete session
payment:
array of mixed
required if no session: values to be processed

Examples


Result Format


Documentation

[block:api-header] { "type": "basic", "title": "Result" } [/block] If everything went successfully you get a [Transaction JSON](doc:transaction-json) in return. Otherwise you get a [Errors JSON](doc:errors-json) and you have to handle or show the errors to your user. [block:callout] { "type": "danger", "title": "Consider the payment_status!", "body": "If the payment status is \"awaiting\" you have to redirect the user to the given redirect url, so he/she can finalize the payment." } [/block] [block:api-header] { "type": "basic", "title": "Processing a session" } [/block] Build up a session with the [Session-API](doc:session-api-introduction) and submit **only** the session hash to this endpoint. The status of your session has to be "complete", so there must not be any errors in the session. **Important: ** additional "payment"-data sent with the session will be ignored, you cannot combine these. [block:callout] { "type": "warning", "title": "A session can only be processed once!", "body": "After a session was sucessfully processed, you cannot read or use it again." } [/block] [block:api-header] { "type": "basic", "title": "Success and failure URL" } [/block] After a redirect payment like PayPal there has to be a success/failure page. By default it's the embed url of your form with a status parameter. We recommend to submit a "success_redirect_url" and "failure_redirect_url" so these urls are taken for redirect.

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 }}