The Stripe payment info all comes up fine, I put in the fake credit card info,
I get a check mark, but then the exception block comes up
Internal server error: b3e6f2e55125
Edit: Never mind! I think I found the answer! I believe there is a minimum charge. (I had set the charge in the test at less than $1. When I made a more reasonable number, it seems to have worked.)
I’m trying test cards in Stripe test mode and am seeing only internal server errors, even when using normal charge amounts (see below).
Can someone try this with a test card number and see if there is a response (from Anvil or Stripe) instead of a server error?
from ._anvil_designer import Form1Template
from anvil import *
import anvil.server
import stripe.checkout
class Form1(Form1Template):
def init(self, **properties):
# Set Form properties and Data Bindings.
self.init_components(**properties)
# Any code you write here will run when the form opens.
try:
charge = stripe.checkout.charge(amount = 12300,
currency = 'USD')
print(charge)
except Exception as e:
print("Error: %s" % e)
EDIT: It does work with the 4242 4242 4242 4242 valid test card number.
EDIT 2: Also tried it with charge handling on the server side and the same internal error occurred.
EDIT 3: Also cloned the Quick Start app and the test card numbers did not work there too.
It just has the following:
anvil.server.InternalError: Internal server error: bab57ffe2fd1
It has a different code every time, so that must be some or other session id. Logs have the same message and no more information. Any ideas what could be the problem?
That’s not nearly enough information to be able to offer an opinion. You should probably start your own post for your issue, include all the relevant code snippets, and a clone link to an app that shows the issue.
Thanks for the reply. I was just reproducing the Anvil tutorial, so the code was the same as what Meredydd wrote in that tutorial. Although I changed the currency, so that seems to be the problem. I figured out that you cannot charge anything less than 0.5 USD via Stripe and that the currency amount on Anvil’s charge function is actually in cents (i.e. 100 = 1GBP). So for anyone else who faces this issue, just make sure the amount you use (including which currency you are using) is more than 0.5 USD and it should succeed in processing the test transaction.