Skip to content
Snippets Groups Projects
Commit 28309e0f authored by Tom Prince's avatar Tom Prince
Browse files

Update the README with the new API.

parent 2ca189c5
Branches
No related tags found
1 merge request!100Update the README with the new API.
...@@ -26,21 +26,19 @@ First, run the server:: ...@@ -26,21 +26,19 @@ First, run the server::
$ stack run $ stack run
Then configure Stripe with a `webhook`_ pointing at the server and receiving the *charge.successful* event. Then create a testing charge::
Configure Stripe with ``http://<youraddress>:8081/v1/stripe/webhook``.
Then create a testing charge using Stripe::
$ STRIPE_SECRET_KEY=sk_test_...
$ curl \ $ curl \
https://api.stripe.com/v1/charges \ http://<youraddress>:8081/v1/stripe/charge \
-u ${STRIPE_SECRET_KEY}: \ -X POST \
-d amount=999 \ -H 'content-type: application/json' \
-d currency=usd \ --data '{ "token":"tok_visa", "voucher":"abcdefg", "amount":"650", "currency":"USD" }'
-d source=tok_visa \
-d 'metadata[Voucher]=abcdefghijk'
This results in Stripe making a callback to the PaymentServer with the charge details.
The PaymentServer marks the voucher as paid in its database. The PaymentServer marks the voucher as paid in its database.
Then redeem the vouncher for tokens::
.. _webhook: https://stripe.com/docs/webhooks/setup#configure-webhook-settings $ curl \
http://<youraddress>:8081/v1/redeem \
-X POST \
-H 'content-type: application/json' \
--data '{ "redeemVoucher": "abcdefg", "redeemTokens":[]}'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment