#geeko_error

1 messages ยท Page 1 of 1 (latest)

silk surgeBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1414776175326396447

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

frosty scarab
#

this is pay.php code

rotund acorn
#

Hello! did you manage to send the code snippet?

frosty scarab
#

<?php
require_once DIR . '/stripe-php/init.php';
require_once DIR . '/config.php';

try {
// Set API key from config.php
\Stripe\Stripe::setApiKey(STRIPE_SECRET_KEY);

// Optional: Force CA file path
// \Stripe\Stripe::setHttpClient(new \Stripe\HttpClient\CurlClient([
//     CURLOPT_CAINFO => '/home/iamsgbwa/public_html/oc-content/plugins/osclass_shop/cacert.pem'
// ]));

// Test: create a PaymentIntent (minimal)
$paymentIntent = \Stripe\PaymentIntent::create([
    'amount' => 1000, // $10.00
    'currency' => 'usd',
    'payment_method_types' => ['card'],
]);

echo "โœ… Stripe test succeeded. Client secret: " . $paymentIntent->client_secret;

} catch (\Stripe\Exception\ApiErrorException $e) {
echo "โŒ Stripe API error: " . $e->getMessage();
} catch (Exception $e) {
echo "โŒ General error: " . $e->getMessage();
}

#

i shorten the code.

rotund acorn
#

Thanks for this! do give me some time to take a look at this

frosty scarab
#

Thanks sir!

#

I don't use cacert.pem now. but I tried with it too. Now i try with namecheap's SSL

#

that is why i commented cacert.pem part

rotund acorn
#

Hmm, taking a look at this error. Like what you alluded to, it is most likely a certificate issue rather than a stripe SDK issue.

A common cause for this error is that the data/ca-certificates.crt file is not included in your PHP installation , or it has file permissions that is preventing your code from accessing it. Once you have done this, you should be fine (and the SSL handshake between your server and our API should work fine).

frosty scarab
#

Where can i find data/ca-certificates.crt and how to use it?

rotund acorn
#

You should be able to find it under <YOUR_PROJECT_FOLDER>/vendor/stripe/stripe-php/data/ca-certificates.crt>

What i would suggest is to download a fresh copy of ca-certificates.crt from here, try replacing the current ca-certificates.crt file with it and see if the issue persist

#

Just curious, is this a new project?

Because if it is, you can take a look at our PHP quickstart guide . They should have all the necessary configurations to run a Stripe PHP integration smoothly.

You can download the full project files with the default configurations by hitting the "Download full app" button.

frosty scarab
#

I am creating a plugin for a multivendor website. like few sellers items in one cart and aftre made the payment sharing each sellers portion and admin get the commission. so this is a custom plugin sir

#

i tried with ca-certificates.crt but i get same error

#

this is my testing code. Is this correct <?php
require_once DIR . '/stripe-php/init.php';
require_once DIR . '/config.php';

\Stripe\Stripe::setApiKey(STRIPE_SECRET_KEY);

try {
$paymentIntent = \Stripe\PaymentIntent::create([
'amount' => 2000,
'currency' => 'usd',
'payment_method_types' => ['card'],
]);
echo "โœ… PaymentIntent created: " . $paymentIntent->client_secret;
} catch (\Stripe\Exception\ApiErrorException $e) {
echo "โŒ Stripe API error: " . $e->getMessage();
}

rotund acorn
#

Have you tried downloading our PHP quickstart guide by hitting the "Download full app" button and see if the issue still persist?

#

If everything works fine with the quickstart guide, I would recommend checking on your side on what might be causing the ca-certificates.crt to be set incorrectly

frosty scarab
#

yes I did. when i click pay now button in full app. it just keep loading. nothing happen

rotund acorn
frosty scarab
#

No this is the only error i got. no any other errors

#

but in my full app i checked console while the pay now button loading. it shows this error in console Uncaught (in promise) IntegrationError: stripe.confirmPayment(): expected either elements or clientSecret, but got neither.
at rawElements (stripe.js:1:528615)
at op (stripe.js:1:528705)
at ap (stripe.js:1:531343)
at ip (stripe.js:1:531861)
at stripe.js:1:645340
at async HTMLFormElement.handleSubmit (checkout.js:37:21)

rotund acorn
#

Ah, this error appears because the elements or clientSecret is not properly passed to the stripe.confirmPayment method

#

could you send me a code snippet of the method call stripe.confirmPayment?

It should look something like this:
const { error } = await stripe.confirmPayment({ elements, confirmParams: { return_url: "http://localhost:3000/complete", }, });

frosty scarab
#

const { error } = await stripe.confirmPayment({
elements,
confirmParams: {
// Make sure to change this to your payment completion page
return_url: "http://localhost:4242/complete.html",
},
});

#

Do i need to change this return url?

#

I did it too. but same.just loading the button

rotund acorn
#

yeah, you dont have to change the return_url

#

do give me some time to look into this

#

I tried the quickstart guide (Frontend: HTML, Backend: PHP), but didn't face the same issue.

Could you send me a code snippet of how your checkout.js file for me to look through? (do remember to remove/redact any public keys in the file)