commit 0c1cbb01ac68db5ade56abc73cf6a2a1a643288a
parent 3b93f180cbee7ed5010735eaa7b60a953bac5edf
Author: Marcello Stanisci <marcello.stanisci@inria.fr>
Date: Mon, 5 Dec 2016 22:49:28 +0100
Inline contracts example
Diffstat:
1 file changed, 29 insertions(+), 0 deletions(-)
diff --git a/php/inline.php b/php/inline.php
@@ -0,0 +1,29 @@
+<?php
+ // This file is in the public domain.
+
+ include 'contract.php';
+
+ $transaction_id = rand(1,90000); // simplified, do not do this!
+ $proposal = make_contract($transaction_id, new DateTime('now'));
+
+ $response = post_to_backend("/contract", $proposal);
+ $ret = $response["body"];
+
+ if (200 != $response["status_code"]) {
+ $ret = build_error($response,
+ "Failed to generate contract",
+ $response['status_code']);
+ }
+
+ http_response_code(402);
+ header (sprintf('X-Taler-Contract: %s', $ret));
+?>
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <title>Select payment method</title>
+ </head>
+ <body>
+ Here you should put the HTML for the non-Taler (credit card) payment.
+ </body>
+</html>