aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorMarcello Stanisci <stanisci.m@gmail.com>2018-03-13 14:54:09 +0100
committerMarcello Stanisci <stanisci.m@gmail.com>2018-03-13 14:54:09 +0100
commitb466a12f337976cde190da4a28a9ec852e4bdaf4 (patch)
treeb66f6fc32bd8e25dd48fe65e6781736d86a2ad89 /doc
parent3a9206832d875d75014e6ca9ebd402bb49e89291 (diff)
adding missing PHP snippets.
Diffstat (limited to 'doc')
-rw-r--r--doc/merchant-api.content.texi66
1 files changed, 64 insertions, 2 deletions
diff --git a/doc/merchant-api.content.texi b/doc/merchant-api.content.texi
index 6f523420..0ddd98dc 100644
--- a/doc/merchant-api.content.texi
+++ b/doc/merchant-api.content.texi
@@ -398,9 +398,9 @@ curl -i "https://backend.demo.taler.net/check-payment?order_id=$ORDER_ID" \
@set GOT_LANG 1
@example
@verbatim
-$ORDER_ID = "2018.072.12.48.51-014DKDKBMHPDP";
+php > $ORDER_ID = "2018.072.12.48.51-014DKDKBMHPDP";
php > curl_init ("https://backend.demo.taler.net/check-payment?order_id=$ORDER_ID");
-php > $options = array(CURLOPT_RETURNTRANSFER=>true,
+php > $options = array(CURLOPT_RETURNTRANSFER=>true,
php ( CURLOPT_CUSTOMREQUEST=>"GET",
php ( CURLOPT_HTTPHEADER=>array(
php ( "Authorization: ApiKey sandbox"));
@@ -506,6 +506,29 @@ curl -i -X POST 'https://backend.demo.taler.net/refund' \
@end verbatim
@end example
@end ifset
+
+@ifset LANG_PHP
+@set GOT_LANG 1
+@example
+@verbatim
+php > $REFUND_REQ = array("order_id"=>$ORDER_ID,
+php ( "refund"=>"KUDOS:0.5",
+php ( "instance"=>"default",
+php ( "reason"=>"Customer did not like product");
+php > $options = array(CURLOPT_RETURNTRANSFER=>true,
+php ( CURLOPT_CUSTOMREQUEST=>"POST",
+php ( CURLOPT_HTTPHEADER=>array(
+php ( "Authorization: ApiKey sandbox"),
+php ( CURLOPT_POSTFIELDS=>json_encode($REFUND_REQ));
+php > $c = curl_init("https://backend.demo.taler.net/refund");
+php > curl_setopt_array($c, $options);
+php > $r = curl_exec($c);
+php > echo $r;
+php > echo curl_getinfo($c, CURLINFO_HTTP_CODE);
+200 # Make sure you paid first!
+@end verbatim
+@end example
+@end ifset
@ifclear GOT_LANG
@example
(example not available for this language)
@@ -566,6 +589,22 @@ curl -i 'https://backend.demo.taler.net/tip-query?instance=default' --header "Au
@end verbatim
@end example
@end ifset
+@ifset LANG_PHP
+@set GOT_LANG 1
+@example
+@verbatim
+php > $c = curl_init("https://backend.demo.taler.net/tip-query?instance=default");
+php > $options = array(CURLOPT_RETURNTRANSFER=>true,
+php ( CURLOPT_CUSTOMREQUEST=>"GET",
+php ( CURLOPT_HTTPHEADER=>array(
+php ( "Authorization: ApiKey sandbox"));
+php > curl_setopt_array($c, $options);
+php > $r = curl_exec($c);
+php > echo curl_getinfo($c, CURLINFO_HTTP_CODE);
+200
+@end verbatim
+@end example
+@end ifset
@ifclear GOT_LANG
@example
(example not available for this language)
@@ -627,6 +666,29 @@ curl -i -X POST 'https://backend.demo.taler.net/tip-authorize' \
@end verbatim
@end example
@end ifset
+
+@ifset LANG_PHP
+@set GOT_LANG 1
+@example
+@verbatim
+php > $TIP_REQ = array(
+php ( "amount"=>"KUDOS:1",
+php ( "instance"=>"default",
+php ( "justification"=>"surveying",
+php ( "next_url"=>"https://example.com/survey-thanks.html");
+php > $options = array(CURLOPT_RETURNTRANSFER=>true,
+php ( CURLOPT_CUSTOMREQUEST=>"POST",
+php ( CURLOPT_POSTFIELDS=>json_encode($TIP_REQ),
+php ( CURLOPT_HTTPHEADER=>array("Authorization: ApiKey sandbox"));
+php > $c = curl_init("https://backend.demo.taler.net/tip-authorize");
+php > curl_setopt_array($c, $options);
+php > $r = curl_exec($c);
+php > echo curl_getinfo($c, CURLINFO_HTTP_CODE);
+200
+@end verbatim
+@end example
+@end ifset
+
@ifclear GOT_LANG
@example
(example not available for this language)