Skip to content
Snippets Groups Projects
Select Git revision
  • 27275672821fe1e9dc87e43b9a09e8c97ef07e43
  • main default protected
  • use-iohk-cache-on-ci
  • cabal2nix
  • minimal-example
  • rename-metrics
  • upgrade-challenge-bypass-ristretto
  • integration
  • 24.stripe-charge-rebased
  • 10.apidocs
10 results

PaymentServer

user avatar
Ramakrishnan Muthukrishnan authored
Use this function to check if the given voucher is unpaid. Perhaps
this can be done in Sql itself without resorting to set operations.
27275672
History

PaymentServer

PaymentServer maintains the state of a voucher database with respect to payments. It receives payment notifications from payment processors and notes this in the database.

Currently, Stripe is supported.

Building

Build using Stack:

$ stack build

Testing

You can perform manual integration testing against Stripe. First, run the server:

$ stack run

Then configure Stripe with a webhook pointing at the server and receiving the charge.successful event. Configure Stripe with http://<youraddress>:8081/v1/stripe/webhook.

Then create a testing charge using Stripe:

$ STRIPE_SECRET_KEY=sk_test_...
$ curl \
  https://api.stripe.com/v1/charges   \
  -u ${STRIPE_SECRET_KEY}:   \
  -d amount=999   \
  -d 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.