-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The PaymentIntent object #202
Comments
@Th-Barth Hi, thanks for issue. Please check implements of server-demo: This is written in Node, but the essential process is the same. |
Hi, thanks for responding. Here is my current php test version now: use Stripe\Stripe;
try {
\Stripe\Stripe::setApiKey('sk_test_51...');
$customer = \Stripe\Customer::create();
$ephemeralKey = \Stripe\EphemeralKey::create(
['customer' => $customer->id],
['stripe_version' => '2020-08-27']);
$intent = \Stripe\PaymentIntent::create([
'amount' => 100,
'currency' => 'eur',
'customer' => $customer->id,
'automatic_payment_methods' => ['enabled' => 'true']
]);
echo json_encode(['paymentIntent' => $intent->client_secret,
'ephemeralKey' => $ephemeralKey->secret,
'customer' => $customer->id]);
} catch (Error $e) {
http_response_code(500);
echo json_encode(['error' => $e->getMessage()]);
} I got the final result "completed" after sending the sheet . Today I had among other things a problem with the version transfer. I first always passed the version number of Stripe installed via composer on the server. But I had to pass the API version which is shown in the dashboard :-/ This caused an error in the server log: What also surprised me is that try/catch could not catch this error. And there is another error or app crash, when you press the close button of the sheet after presentation. Is this normal for this demo version? I ve got another question. Why do I get in this demo just a very simple payment sheet formular? With the settings 'automatic_payment_methods' => ['enabled' => 'true'] I expected all payment methods for my region like listed on this page https://stripe.com/docs/payments/payment-element Have I perhaps forgotten or misunderstood something? |
@Th-Barth This does not seem to be a question about this plugin. You should talk to the experts at stripe at https://github.com/stripe/stripe-php. Best regards. |
You re right, sorry. In the meantime I got some help from Stripe und I was able to implement stripe-elements into my project. |
Hello,
I m trying to get into your Stripe project but have problems with some inconsistencies.
When creating a payment intent the method Stripe.createPaymentSheet expects three variables (paymentIntent, ephemeralKey, customer):
Compared to the expected response found at https://stripe.com/docs/api/payment_intents/object I can not find all appropriate variables.
"id": "pi_1JKS5a2Tb35ankTn5AFisSig",
"object": "payment_intent",
"customer": null,
????
[...]
\Stripe\Stripe::setApiKey('sk_test_...');
$intent = \Stripe\PaymentIntent::create([
'amount' => 1099,
'currency' => 'eur',
'payment_method_types' => ['card'],
]);
echo json_encode(array('client_secret' => $intent->client_secret));
?>
`
Which object variables do I have to put into the array for json_encode?
The text was updated successfully, but these errors were encountered: