Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'Could not determine which URL to request: Stripe_Charge instance has invalid ID

I want to implement Strip payment process in a site. I tried to do it but it's not look working. The error I got is

Fatal error: Uncaught exception 'Stripe_InvalidRequestError' with message 'Could not determine which URL to request: Stripe_Charge instance has invalid ID: ' in /home/twassist/public_html/wp-content/themes/inovado/stripe-php-1.7.15/lib/Stripe/ApiResource.php:46 Stack trace: #0 /home/twassist/public_html/wp-content/themes/inovado/stripe-php-1.7.15/lib/Stripe/ApiResource.php(15): Stripe_ApiResource->instanceUrl() #1 /home/twassist/public_html/wp-content/themes/inovado/stripe-php-1.7.15/lib/Stripe/ApiResource.php(8): Stripe_ApiResource->refresh() #2 /home/twassist/public_html/wp-content/themes/inovado/stripe-php-1.7.15/lib/Stripe/Charge.php(14): Stripe_ApiResource::_scopedRetrieve('Stripe_Charge', NULL, NULL) #3 /home/twassist/public_html/wp-content/themes/inovado/functions.php(355): Stripe_Charge::retrieve(NULL) #4 /home/twassist/public_html/wp-content/themes/inovado/functions.php(361): Strip_Code() #5 /home/twassist/public_html/wp-settings.php(291): include('/home/twassist/...') #6 /home/twassist/public_html/wp-config.php( in /home/twassist/public_html/wp-content/themes/inovado/stripe-php-1.7.15/lib/Stripe/ApiResource.php on line 46

Do someone tried it here http://twassistant.com/hire change the quantity.

Fill this detail 5555 5555 5555 4444 expiry date 12 / 21 name: anything 121.

This will make test payment. When come redirect to the code it's give you this error.

Here is the code I tried in my php file.

function Strip_Code()
{
    $stripCode = trim($_GET['stripeToken']);

    if (strlen($stripCode) > 0) {

        require_once  dirname(__FILE__).'/stripe-php-1.7.15/lib/Stripe.php';

        Stripe::setApiKey("sk_test_XXXXXXXXXXXXXXX");

        $resp = Stripe_Charge::retrieve($$stripCode);

        var_dump($resp);
    }
}

Strip_Code();
like image 381
user2126670 Avatar asked Jan 13 '23 21:01

user2126670


1 Answers

could be that you have a typo (double $$):

Stripe_Charge::retrieve($$stripCode);

also, you shouldn't reveal your private key... even if it's just your test key

like image 138
Codasaurus Avatar answered Jan 19 '23 11:01

Codasaurus