I use JPY as currency. But, the module doesn't seem to support the currency yet.
(An error message "Stripe currently supports only USD, CAD, EUR, GBP, AUD and CHF as a currency." appears on admin/reports/status.)

So, hopefully, someone will create a patch for it.
Thank you.

Comments

carrotandme created an issue. See original summary.

torgospizza’s picture

Title: Support for JPY » Support all currencies supported by Stripe
Priority: Minor » Normal
Status: Needs work » Needs review
StatusFileSize
new3.21 KB

Changing the subject line since this issue is actually broader than any single currency.

Right now the currencies supported for payments varies by the country where the Stripe account was created (see #2822198: stripe_payment currencies list).

Attached is a patch which does the following:
- adds new function commerce_stripe_payment_currencies() for retrieving currently supported Stripe currencies based on the account making the request;
- updates the hook_requirements() implementation to accommodate this, and show an error if the Commerce default currency is not supported by the store's Stripe account;
- updates the Stripe payment methods configuration form to only include in the currency select list, currencies that are supported by the Stripe account.

I've tested the patch and it is working for me (even on an older API version) so give it a shot.

carrotandme’s picture

StatusFileSize
new52.62 KB

@torgosPizza

Thank you for the patch.
I tried it for 7.x-3.0-alpha1 and 7.x-3.x-dev. And, I encountered the same error in both of them, when I click "Enable payment method: Stripe" in the payment method rules(/admin/commerce/config/payment-methods/manage/commerce_payment_commerce_stripe).

Here is what the warning and error message say.

Warning message

  • Stripe secret and public key are required in order to use Stripe payment method. See README.txt for instructions.
  • The Stripe payment method "Integration type" is not set. Stripe.js will be used by default.
  • Settings required for the Stripe payment method can be configured here.

Error message

Stripe\Error\Authentication: No API key provided. (HINT: set your API key using "Stripe::setApiKey()". You can generate API keys from the Stripe web interface. See https://stripe.com/api for details, or email support@stripe.com if you have any questions. in Stripe\ApiRequestor->_requestRaw() (line 177 of /home/myserver/mysite.com/public_html/sites/all/libraries/stripe-php/lib/ApiRequestor.php).

I also upload the capture of the error page.

Do you have any idea of what is wrong?

Thank you.

torgospizza’s picture

Hello,

Yes - when you enable the payment method, you have to click the "Edit" link for the payment method's settings (it will be something like admin/commerce/config/payment-methods/manage/commerce_payment_commerce_stripe/edit/3, and enter your API keys from your Stripe Dashboard.

You'll have to enter your Stripe API keys before you'll actually be able to accept payment in Stripe.

If you've already done so, then there is another issue, but I'd need to know more first.

torgospizza’s picture

Version: 7.x-3.0-alpha1 » 7.x-3.x-dev

@carrotandme: Were you able to get this fixed? Clicking on the link found in that error message page should take you to where you'd need to go to update your configuration. That would include things like your integration type.

Please review this ASAP so I can commit to dev. Thanks!

carrotandme’s picture

@torgosPizza
I'm sorry for being late.
Actually, those messages appear at
Enable payment method: Stripe, /admin/commerce/config/payment-methods/manage/commerce_payment_commerce_stripe/edit/3.
(I'm so sorry that I didn't write exactly the place where the error messages appear.) So I have still have the same problem.

torgospizza’s picture

@carrotandme: Can you confirm that you've entered your keys into the configuration settings form? The only reason I can see that message showing up is if you haven't entered your keys yet.

carrotandme’s picture

StatusFileSize
new32.87 KB

@torgosPizza Thank you for your quick reply.

The error message still appears, but the warning one disappeared.

Here is what I did this time.
1. Istalled cleanly & enabled the module again(at this point, I did't applied your patch yet).

2. At "Enable payment method: Stripe"(/admin/commerce/config/payment-methods/manage/commerce_payment_commerce_stripe/edit/3), input my stripe Publishable key & Secret key. And, of course, there is no error message then.

3. Applied your patch. And, replaced the files modified in server(So, Publishable key & Secret key are not deleted.).

4. Clicked "Enable payment method: Stripe". And, I found that the error message still appears.

Error message

Stripe\Error\Authentication: No API key provided. (HINT: set your API key using "Stripe::setApiKey()". You can generate API keys from the Stripe web interface. See https://stripe.com/api for details, or email support@stripe.com if you have any questions. in Stripe\ApiRequestor->_requestRaw() (line 177 of /home/myserver/mysite.com/public_html/sites/all/libraries/stripe-php/lib/ApiRequestor.php).
torgospizza’s picture

StatusFileSize
new3.37 KB
new657 bytes

Oh, right, I see now. Problem is we're loading the library and calling Stripe API methods... and our current library does not have a global API config.

This is one of the reasons why having Stripe's focus narrowed down into a "per-payment method" config with Commerce Stripe is somewhat bad practice. Because _commerce_stripe_set_api_key() expects a payment method, and loading the library does not automatically mean we are setting a key (such as how we are with the main Stripe module).

However there is a solution for this - just have to load the default Commerce Stripe payment method and set the API Key using the _commerce_stripe_set_api_key() method. Attached is a new patch which does this, and the interdiff (which is just two additional lines). Please give the new patch a try.

Thanks for your step-by-step instructions on how to reproduce :)

carrotandme’s picture

@torgosPizza Thank you for the new patch!

I tried it on the same steps I wrote at #8. Now, I can visit the "Enable payment method: Stripe" page.

But, new error messages appeared then.

Notice: Undefined variable: currencies in commerce_stripe_settings_form() (line 158 of /home/myserver/mydomain.com/public_html/sites/all/modules/commerce_stripe/commerce_stripe.module).
Warning: Invalid argument supplied for foreach() in commerce_stripe_settings_form() (line 158 of /home/myserver/mydomain.com/public_html/sites/all/modules/commerce_stripe/commerce_stripe.module).
Notice: Undefined variable: stripe_currency_list in commerce_stripe_settings_form() (line 167 of /home/myserver/mydomain.com/public_html/sites/all/modules/commerce_stripe/commerce_stripe.module).

And, the Select List at Currency becomes empty. Please refer to the uploaded image.

torgospizza’s picture

Argh. Sorry. Apparently some changes didn't make it into that patch, either. Please try this last one. (I've tested it and it works for me... )

Thanks and sorry again!

carrotandme’s picture

@torgosPizza Thank you for the new patch!

I tried #11 on 7.x-3.x-dev with my test stripe account. It worked on the step of #8.

But, if I try to install the module after deleting sectet&puclick key by uninstalling it, it displays the warning&error message below at "Enable payment method: Stripe".

Warning message
Stripe secret and public key are required in order to use Stripe payment method. See README.txt for instructions.
The Stripe payment method "Integration type" is not set. Stripe.js will be used by default.
Settings required for the Stripe payment method can be configured here.
Error message
Notice: Undefined index: secret_key in _commerce_stripe_set_api_key() (line 1511 of /home/myserver/mydomain.com/public_html/sites/all/modules/commerce_stripe/commerce_stripe.module).
Stripe\Error\Authentication: No API key provided. (HINT: set your API key using "Stripe::setApiKey(<API-KEY>)". You can generate API keys from the Stripe web interface. See https://stripe.com/api for details, or email support@stripe.com if you have any questions. in Stripe\ApiRequestor->_requestRaw() (line 177 of /home/myserver/mydomain.com/public_html/sites/all/libraries/stripe-php/lib/ApiRequestor.php).

But, anyway, it works without deleting those key information. Thak you for the patch!

torgospizza’s picture

StatusFileSize
new3.97 KB
new646 bytes

Well, that's progress anyway! And this last warning is an easy fix. Basically we call the the setApiKey() method without verifying a key exists - we're just kind of assuming that it's there, even if a payment method has just been enabled. (Those values will not exist until you enter them, which is why this error is being thrown.)

We might be able to test for this earlier on, but I think it makes sense to not try to set an API Key unless one is detected. Attached is a new patch including this change, and an interdiff from the previous patch :)

Thanks for your help in testing!

carrotandme’s picture

Hi, thank you so much for the new patch!

I tested it after deleting public & secret key by uninstalling the module. A part of the message I wrote at #12 still remains.

Stripe\Error\Authentication: No API key provided. (HINT: set your API key using "Stripe::setApiKey(<API-KEY>)". You can generate API keys from the Stripe web interface. See https://stripe.com/api for details, or email support@stripe.com if you have any questions. in Stripe\ApiRequestor->_requestRaw() (line 177 of /home/myserver/mydomain.com/public_html/sites/all/libraries/stripe-php/lib/ApiRequestor.php).

torgospizza’s picture

StatusFileSize
new4.08 KB
new1.01 KB

Oh! I was not thorough enough. New patch attached checks for a key to be set, before calling the Stripe API. Sorry I missed that.

New patch is a little more conservative in its expectations. Please give it another shot. Thanks!

carrotandme’s picture

Hi, thank you for quick fixing!
I tried the patch. The error message disappear. And, now I can access "Enable payment method: Stripe" page.
But, the select list for Currency gets empty. It is the same problem as the on the image at #10.

torgospizza’s picture

Status: Needs review » Needs work
efpapado’s picture

#15 works for me, tested in Norway with Norwegian Krone (NOK) currency.

millionleaves’s picture

Just applied this patch to the 7.x-3.x-dev from March 13, 2018, with the 5.6 Stripe PHP library, and it works for NZD.

Thanks!

torgospizza’s picture

Status: Needs work » Reviewed & tested by the community

Awesome, thanks for testing!

I'll mark this RTBC and see about getting it into dev quickly.

  • torgosPizza committed 5385154 on 7.x-3.x
    Issue #2885093 by torgosPizza, carrotandme: Support all currencies...
torgospizza’s picture

I've committed this to dev.

@carrotandme: I think that issue may be unrelated, so we can open that in another thread. I think I might actually have this fixed, but it is something that is in my current "in-progress" version that integrates with the Stripe module more cleanly. I'll be pushing that soon.

torgospizza’s picture

Status: Reviewed & tested by the community » Fixed

I'll set to fixed, but if any other errors regarding currency support pop up, please reopen or create a follow-up.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.