• Resolved kimsf

    (@kimsf)


    Restricted API keys aren’t accepted in live mode because they start with “rk_live” as a prefix. (Restricted API Test keys start with “rk_test”)

    Under the file woocommerce-gateway-stripe.php the following code seems to stop the use of restricted API keys.

    // Check if keys are entered properly per live/test mode.
    				if ( $testmode ) {
    					if (
    						! empty( $test_pub_key ) && ! preg_match( '/^pk_test_/', $test_pub_key )
    						|| ! empty( $test_secret_key ) && ! preg_match( '/^sk_test_/', $test_secret_key ) )
    					{
    						$setting_link = $this->get_setting_link();
    						/* translators: 1) link */
    						$this->add_admin_notice( 'keys', 'notice notice-error', sprintf( __( 'Stripe is in test mode however your test keys may not be valid. Test keys start with pk_test and sk_test. Please go to your settings and, <a href="%s">set your Stripe account keys</a>.', 'woocommerce-gateway-stripe' ), $setting_link ), true );
    					}
    				} else {
    					if (
    						! empty( $live_pub_key ) && ! preg_match( '/^pk_live_/', $live_pub_key )
    						|| ! empty( $live_secret_key ) && ! preg_match( '/^sk_live_/', $live_secret_key ) )
    					{
    						$setting_link = $this->get_setting_link();
    						/* translators: 1) link */
    						$this->add_admin_notice( 'keys', 'notice notice-error', sprintf( __( 'Stripe is in live mode however your test keys may not be valid. Live keys start with pk_live and sk_live. Please go to your settings and, <a href="%s">set your Stripe account keys</a>.', 'woocommerce-gateway-stripe' ), $setting_link ), true );
    					}
    				}
    			}
    
Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Contributor royho

    (@royho)

    Thanks, will add support for those by next version.

    Plugin Contributor royho

    (@royho)

    Having just looked at it, it only creates one key. So where does it go? I assume you know? In the secret key or publishable key?

    Thread Starter kimsf

    (@kimsf)

    It would be a secret test/live key.

    Thread Starter kimsf

    (@kimsf)

    Thread Starter kimsf

    (@kimsf)

    Also something else might stop the use of restricted keys. All I know is that restricted API keys don’t work. They used to work in 4.0.1.

    Plugin Contributor royho

    (@royho)

    Hmmm I am not sure I follow. There are two fields currently publishable key/secret key. With the restricted key you create, you only get one key. Are you saying you can use Stripe with just one key?

    Thread Starter kimsf

    (@kimsf)

    A restricted API key is used as a secret key. You still need a regular publish key with it.

    The error message I get on checkout with a restricted API key is this:

    “The provided key ‘rk_test_********************zl0r’ does not have the required permissions for this endpoint on account ‘acct_xxxxxxx(edited)’. Having more permissions would allow this request to continue.”

    This error message pops up after I put in a test credit card and try to pay. It comes up as a woocommerce error with a red textbox at the top of the checkout. It also doesn’t matter if I enable everything for the restricted API key (making it unrestricted basically). It still doesn’t work.

    • This reply was modified 6 years, 10 months ago by kimsf.
    Plugin Contributor royho

    (@royho)

    Got it thanks!

    Thread Starter kimsf

    (@kimsf)

    Restricted API keys still don’t work.

    I just tested them at working in 4.0.2 but it stopped working in 4.0.3 and still doesn’t work in 4.0.5. Same error message in test mode.

    https://tinyurl.com/yawx5ojt

    • This reply was modified 6 years, 10 months ago by kimsf.
    Plugin Contributor royho

    (@royho)

    I am not getting any errors on my end after saving. Is that the error you’re referring to?

    Thread Starter kimsf

    (@kimsf)

    No. When trying to purchase something on checkout I get the error message:

    “The provided key ‘rk_test_********************zl0r’ does not have the required permissions for this endpoint on account ‘acct_xxxxxxx(edited)’. Having more permissions would allow this request to continue.”

    Plugin Contributor royho

    (@royho)

    Ok so initially when you posted about this, I checked and I got the error not letting me save the key. So in recent release, that is what I fixed. The message you’re seeing seems more related to your account on Stripe. I would suggest you contact them to see what is going on. We did not intentionally remove any support for this. In fact we didn’t even know about this feature. If there is something we need to change to make this work I am all ears. But for now, it seems you need to contact Stripe.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Restricted API keys aren’t accepted’ is closed to new replies.