Problem with Stripe payments

Trying to setup stripe payment & checkout for my app

I’m getting the error “Internal server error: fbf05bba3ccc” while trying to do a stripe checkout. Can you please help?

This is the code that I’m using

from ._anvil_designer import Form1Template
from anvil import *
import anvil.server
import stripe.checkout

class Form1(Form1Template):

def init(self, **properties):
try:
c = stripe.checkout.charge(currency=“INR”, amount=100)
print(c)
except Exception as e:
alert(str(e))
return

Please see the tip about formatting Python code here:

My first thought is that if you remove that exception handling (temporarily), you may be able to see more of the traceback information, which could help clarify the issue.

thanks for your inputs, will keep the formatting bit in mind. Also, quickly wanted to check - will stripe work with basic python 3 version?

This is the error I get now

anvil.server.InternalError: Internal server error: 6a475a52ef34

Hi All,

Can anyone help me with this issue please? I am using a free version of anvil

Internal server errors are generally things that Anvil support needs to look into. There’s just no information there for us to give any advice on.

My only general advice would be to go through the Stripe tutorial: Stripe - Taking Payments If everything there works you can compare with what you’re doing and see what might be different.

1 Like

Thanks for the heads up. Have been trying to reach the support team. Is there a way to tag them on this post

Email is your best option. Anvil’s a small team, and they’ll have to dig through their logs looking for your error code.

2 Likes

Hi @resumekadoctor,

Yes, the Stripe integration is available on the Free Plan. Can you confirm that you’ve successfully connected your Stripe account to Anvil?

Hi Brooke

Thanks for the confirmation. Yes, I have successfully linked my Anvil account with my Stripe account

There is a known issue with Anvil swallowing Stripe exceptions, which we are working on fixing. I apologize for this making it hard to find the error!

If you go into your Stripe dashboard, you should be able to see the exception which is Amount must convert to at least 30 pence. ₹1.00 converts to approximately £0.01

1 Like

Stripe also takes denominations as integers in the smallest unit for a currency. So if you pass it an integer of 1 INR it is a paisa not one rupee.
Which could easily trigger the error @brooke said the anvil system consumed without repeating to your logs, without it being obvious.

2 Likes

Thanks for the support Brooke. This is helpful!

Hi Brooke

There seems to be a strange problem here! I’ve cloned the Stripe payment app (from the Anvil tutorial) into my account. However, all the transactions are getting mapped to some other Stripe account - the dashboard of which might be visible to you. Can you please explain this to me?

This will possibly help me understand why the same code isn’t working with the app am trying to build.

Thank You

Hi @resumekadoctor,

When you use the Stripe integration, you must connect it to your own Stripe account for the payment to be routed correctly. We’ve now fixed the bug that allowed you to accept payments without a connected account, and refunded those test payments that you made. Sorry for the confusion!

Hey Daviesian

Many thanks for your prompt action and no problem at all. However, my Anvil account is already connected to my Stripe account and I ran the app through my Anvil account.

Am I missing something here?

The app wasn’t connected to your Stripe account previously, but I can see that it is now. So you should be good to go.

Thanks Daviesian

Re-attempted the transaction, but apparently there are some challenges with authenticating the request. This is the message I get:

It appears that you are creating a direct Charge on a IN-based connected account using a single-use card token owned by your GB-based platform account. As part of our continued investment in India and to meet local data storage requirements, this is no longer allowed, so we had to reject your request. As a possible workaround, try authenticating as the connected account when creating the single-use card token. If you need further assistance, please don’t hesitate to reach out to our support team at https://support.stripe.com/contact.; code: cross_region_card_cloning_violation; request-id: req_vZ1Lh7v9Hd9f6b

Interfaced with Stripe support and got to know :

Stripe accounts from India cannot use the legacy Charges API. You need to use Payment intents and payment methods

Is this something that the team can help with?

Also, once connected to a Stripe account, can deactivation happen automatically from my Anvil account?

Hi Daviesian

Thanks again for reversing my test transactions. However, haven’t yet received the refunds except for one. If you can kindly share about the expected timelines for the refund - that would be greatly appreciated!

Refunds can take up to 10 days in some cases. I can confirm that all six have been refunded.

Thanks for confirming this promptly. Is there anything that can be done about the Stripe integration error?