Does Stripe payment work in Palm?
I tried to follow the config in this docs
I got this error:
stripe.error.InvalidRequestError: Request req_... : Received unknown parameter: secret_key_confirmation
I think secret_key_confirmation is used in this file.
stripe_response = stripe.PaymentIntent.create(
**self._build_payment_intent_parameters(basket),
# This means this payment intent can only be confirmed with secret key (as in, from ecommerce)
secret_key_confirmation='required',
# don't create a new intent for the same basket
idempotency_key=self.generate_basket_pi_idempotency_key(basket),
)
According to the docs:
The E-Commerce Service uses Stripe Custom Actions to send payments through a backend before payment. Ask your Stripe representative to enable this feature on your account. For more information, see frontend-app-payment ADR-5.
I think I need to enable Stripe Custom Actions to make it work, do I actually have to ask a Stripe representative to do it for me or can I do it myself (and how)?
@amit you have to ask Stipe support to enable Stripe Custom Action for your Stripe account.
Also, you have to config frontend env correctly because the project does not support runtime configuration, all Stripe_* variables must be configured.
Though, I could get it to work in the end, some other errors happened after so I decided to use Cybersource and wait for the new ecommerce project.
stripe_publish_key usually starts with pk_ and stripe_secret_key usually starts with sk_ and you get it from your Stripe developer dashboard.
your_ecommerce_host is something likes https://ecommerce.lms.example.com.
These conclusions are taken from when I tested Stripe sometime in the past. I don’t know if anything changed to make it easier, but it is still working on Redwood release.
You need to install tutor-ecommerce plugin but it isn’t enough for Stripe.
This is because the frontend-app-payment does not take the publishable_key from the backend, ideally, it should take the key from MFE_CONFIG but it doesn’t that’s why I made an extra plugin to set the public key at the build time.
About how to make a plugin you can refer to this doc.
Thanks for the hints and links, plugin is clear now.
How to assure correct configuration of my {your_ecommerce_host}?
-for my site url in a form https://ecommerce.mylms.example.com shows page with login button and “Server Error”. Looks like something with the user, when I’m trying to create (or re-use an existing LMS user) tutor local run ecommerce ./manage.py createsuperuser
getting error: django.db.utils.OperationalError: (1045, "Access denied for user ‘ecommerce’@'1…
Make sure you follow instructions in tutor-ecommerce git repo (choose the git tag that matched your instance for the right document).
tutor-ecommerce doesn’t any bugs reported so check your configurations.
You’re right, potentially I might have problem in configuration. I not fully understand where each configuration is located?
Instruction says “modify this configuration, save it to ecommerce-config.yml”
Are configs by default under each plugin folder, or instruction means I have to create it manually there, e.g at …/tutor/env/plugins/ecommerce/… ?
I can see two main configs under /tutor/env/apps/openedx/config$
let’s identify what caused Server error on your payment page.
you can run this command: tutor local logs --tail=0 -f
and then go to your payment page, and check what errors output in the console.
About the config, by default e-commerce host will be “ecommerce.{{ LMS_HOST }}”, so make sure the subdomain pointed to your server.
I don’t use ecommerce-config.yml to set my variables. I set it directly in config.yml using vim.
run $(tutor config printroot)/config.yml
and check if these configs exist and are probably set. Other e-commerce configs you can leave it as default.
For me the support responded with this question: What specifically are you referring to when you say ‘Stripe Custom Action’? how to explain them more details about the query?
ecommerce-1 | super(Connection, self).__init__(*args, **kwargs2)
ecommerce-1 | MySQLdb._exceptions.OperationalError: (1045, "Access denied for user 'ecommerce'@'xxx.xx.x.xx' (using password: YES)")
ecommerce-1 |
ecommerce-1 | The above exception was the direct cause of the following exception:
ecommerce-1 |
ecommerce-1 | Traceback (most recent call last):
ecommerce-1 | File "/openedx/venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 47, in inner
ecommerce-1 | response = get_response(request)
When I try to grant my existing lms user rights using:
tutor local run ecommerce ./manage.py shell -c "from django.contrib.auth import get_user_model; get_user_model().objects.filter(email='user.email@gmail.com').update(is_staff=True, is_superuser=True)"
I’m getting:
File "/openedx/venv/lib/python3.12/site-packages/MySQLdb/connections.py", line 179, in __init__
super(Connection, self).__init__(*args, **kwargs2)
django.db.utils.OperationalError: (1045, "Access denied for user 'ecommerce'@'xxx.xx.x.xx' (using password: YES)")
Error: Command failed with status 1: docker compose -f /home/openedx/.local/share/tutor/env/local/docker-compose.yml -f /home/openedx/.local/share/tutor/env/local/docker-compose.prod.yml --project-name tutor_local run --rm ecommerce ./manage.py shell -c from django.contrib.auth import get_user_model; get_user_model().objects.filter(email='user.email@gmail.com').update(is_staff=True, is_superuser=True)
what tutor and tutor-ecommerce plugin version are you using? check it using tutor --version , tutor plugins list.
Do you run MySQL separately or using default container? if you run MySQL separately, what is your MySQL version?
About Custom action.
I sent them the error response from client browser and Stripe developer dashboard.
I explained as follow:
We followed their document but could not make it work. The only missing thing is “The E-Commerce Service uses Stripe Custom Actions to send payments through a backend before payment. Ask your Stripe representative to enable this feature on your account.”
After a few more emails explaining that I was using an open-source, I didn’t know how to customize it to use newer APIs.
They responded:
Hi there,
Thanks for holding on. I’m writing back to inform that we’ve gated your current Stripe account (acct_…) into Stripe Custom Actions.
Please try making a similar request, and let us know if you run into any errors.