#csolis

1 messages · Page 1 of 1 (latest)

teal musk
#

Hello!

#

Do you have a question about the error in your screenshot?

#

Error implementing plans installments in laravel, in Mexico for the method of pay, help please

#

What specific help do you need? Are you asking what the error means?

neat urchin
#

The documentatio is wrong

teal musk
#

Which documentation?

neat urchin
teal musk
#

Which part of those docs are wrong?

neat urchin
#

This error is literally, the example in this documentation

#

In collect_details.php

#

In the moment of search of plans, recive error 404

teal musk
#

Do you have collect_details.php mapped to the /collect_details URL on your server?

neat urchin
#

Yes

teal musk
#

Are you sure? Are you sure it's not mapped to /collect_details.php?

#

Or /something/collect_details.php?

neat urchin
#

No, in the same level of carpet

teal musk
#

If you change this line:

fetch('/collect_details', {

To this:

fetch('/collect_details.php', {

Does it work?

neat urchin
#

ok i try

#

a moment please

#

No

#

Not working

teal musk
#

Same 404 error or a different error?

neat urchin
#

Same 404 not found

teal musk
#

Try without the forward slash; it doesn't seem like that file is in the root of your web server: fetch('collect_details.php', {

neat urchin
#

No yet

teal musk
#

Okay, so you've got a syntax error in collect_details.php, but at least you've got the fetch call working now!

neat urchin
teal musk
#

Can you provide more details? What changed? It looks like you went back to /collect_details.php which wasn't working before?

neat urchin
#

is the example of your documentation

#

<?php
try {

vendor using composer

require_once('vendor/autoload.php');

\Stripe\Stripe::setApiKey('sk_test_J023A345LKpNhf7DCygTA1z000VVPVDWy5');

header('Content-Type: application/json');

retrieve json from POST body

$json_str = file_get_contents('php://input');
$json_obj = json_decode($json_str);

$intent = \Stripe\PaymentIntent::create([
'payment_method' => $json_obj->payment_method_id,
'amount' => 3099,
'currency' => 'mxn',
'payment_method_options' => [
'card' => [
'installments' => [
'enabled' => true
]
]
],
]);

echo json_encode([
'intent_id' => $intent->id,
'available_plans' => $intent->payment_method_options->card->installments->available_plans
]);
}
catch (\Stripe\Exception\CardException $e){

"e" contains a message explaining why the request failed

echo 'Card Error Message is:' . $e->getError()->message . '\n';
echo json_encode([
'error_message' => $e->getError()->message
]);
}
catch (\Stripe\Exception\InvalidRequestException $e) {
// Invalid parameters were supplied to Stripe's API
echo 'Invalid Parameters Message is:' . $e->getError()->message . '\n';
echo json_encode([
'error_message' => $e->getError()->message
]);
}

#

The same code

#

I try make test, of plans in mexico

#

But not working

#

No working in laravel

#

And no working your code in the documentation

#

Literally is yours code

frail steppe
#

@neat urchin really sorry, totally missed your answers. Unfortunately I'm not sure how to help right now. You shared PHP without much details. Is the file named collect_details.php? If not why not? I think there's something bugged with the code. Totally could be our fault but I'm not sure how to help with just this information. You need to look at the requests the code make, compare to your server side logs, and pinpoint the problem