summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <grothoff@gnunet.org>2023-08-10 10:04:49 +0200
committerChristian Grothoff <grothoff@gnunet.org>2023-08-10 10:04:57 +0200
commita980dfed1cc026d944924f9d2fef1090d2a0e137 (patch)
treec5a6da022f0d9aaec1c13d710f6f78003d2c44f3
parent49bc50b99693f78ebbfe7fbe5ffb00ebb3deb6ed (diff)
downloaddocs-a980dfed1cc026d944924f9d2fef1090d2a0e137.tar.gz
docs-a980dfed1cc026d944924f9d2fef1090d2a0e137.tar.bz2
docs-a980dfed1cc026d944924f9d2fef1090d2a0e137.zip
tutorial improvements thanks to the Lennars
-rw-r--r--taler-merchant-api-tutorial.rst22
1 files changed, 11 insertions, 11 deletions
diff --git a/taler-merchant-api-tutorial.rst b/taler-merchant-api-tutorial.rst
index 920da2c9..a134c6c3 100644
--- a/taler-merchant-api-tutorial.rst
+++ b/taler-merchant-api-tutorial.rst
@@ -131,7 +131,7 @@ key in the ``Authorization`` header. The value of this header must be
>>> import requests
>>> requests.get("https://backend.demo.taler.net/private/orders",
- ... headers={"Authorization": "Bearer secret-token:secret"})
+ ... headers={"Authorization": "Bearer secret-token:sandbox"})
<Response [200]>
If an HTTP status code other than 200 is returned, something went wrong.
@@ -223,10 +223,10 @@ A minimal Python snippet for creating an order would look like this:
>>> body = dict(order=dict(amount="KUDOS:10",
... summary="Donation",
... fulfillment_url="https://example.com/thanks.html"),
- ... create_token=False)
+ ... create_token=False)
>>> response = requests.post("https://backend.demo.taler.net/private/orders",
... json=body,
- ... headers={"Authorization": "secret-token:secret"})
+ ... headers={"Authorization": "Bearer secret-token:sandbox"})
<Response [200]>
@@ -260,7 +260,7 @@ with the ID of the order that was returned.
You can put the ``taler://`` URI as the target of a link to open the Taler
wallet via the ``taler://`` schema, or put it into a QR code. However, for a
Web shop, the easiest way is to simply redirect the browser to
-``https://example.com/orders/$ORDER_ID/``. That page will then trigger the
+``https://example.com/orders/$ORDER_ID``. That page will then trigger the
Taler wallet. Here the backend generates the right logic to trigger the
wallet, supporting the various types of Taler wallets in existence. Instead
of constructing the above URL by hand, it is best to obtain it by checking for
@@ -271,11 +271,11 @@ Checking Payment Status and Prompting for Payment
-------------------------------------------------
Given the order ID, the status of a payment can be checked with the
-``/private/orders/$ORDER_ID/`` endpoint. If the payment is yet to be completed
+``/private/orders/$ORDER_ID`` endpoint. If the payment is yet to be completed
by the customer, ``/private/orders/$ORDER_ID`` will give the frontend a URL
(under the name ``payment_redirect_url``) that will trigger the customer’s
wallet to execute the payment. This is basically the
-``https://example.com/orders/$ORDER_ID/`` URL we discussed above.
+``https://example.com/orders/$ORDER_ID`` URL we discussed above.
Note that the best way to obtain the ``payment_redirect_url`` is to check the
status of the payment, even if you know that the user did not pay yet. There
@@ -286,7 +286,7 @@ backend to do it is the safest method.
>>> import requests
>>> r = requests.get("https://backend.demo.taler.net/private/orders/" + order_id,
- ... headers={"Authorization": "secret-token:secret"})
+ ... headers={"Authorization": "Bearer secret-token:sandbox"})
>>> print(r.json())
If the ``order_status`` field in the response is ``paid``, you will not
@@ -354,12 +354,12 @@ This code snipped illustrates giving a refund:
... reason="Customer did not like the product")
>>> requests.post("https://backend.demo.taler.net/private/orders/"
... + order_id + "/refund", json=refund_req,
- ... headers={"Authorization": "secret-token:secret"})
+ ... headers={"Authorization": "Bearer secret-token:sandbox"})
<Response [200]>
.. Note::
After granting a refund, the public
- ``https://example.com/orders/$ORDER_ID/`` endpoint will
+ ``https://example.com/orders/$ORDER_ID`` endpoint will
change its wallet interaction from requesting payment to
offering a refund. Thus, frontends may again redirect
browsers to this endpoint. However, to do so, a
@@ -438,7 +438,7 @@ funds available for granting rewards, query the ``/private/reserves`` endpoint:
>>> import requests
>>> requests.get("https://backend.demo.taler.net/private/reserves",
- ... headers={"Authorization": "Bearer secret-token:secret"})
+ ... headers={"Authorization": "Bearer secret-token:sandbox"})
<Response [200]>
Check that a reserve exists where the ``merchant_initial_amount`` is below the
@@ -472,7 +472,7 @@ This code snipped illustrates giving a reward:
... justification="User filled out survey",
... next_url="https://merchant.com/thanks.html")
>>> requests.post("https://backend.demo.taler.net/private/rewards", json=reward_req,
- ... headers={"Authorization": "Bearer secret-token:secret"})
+ ... headers={"Authorization": "Bearer secret-token:sandbox"})
<Response [200]>