It is failing when I set amount less than 50 CAD. In certain scenarios, we would need payment for a transaction of less than 50$. Please let me know how can we allow that. Below is the exception message: Amount must be at least $0.50 cad; code: amount_too_small; I was able to resolve this my multiplying amount with 100. It seems stripe is charging in cents.
Hi Avneet-yes, amounts are charged in the currency’s smallest unit. For example, to charge 10 USD, provide an amount value of 1000 (that is, 1000 cents).
@@StripeDev Thanks so much. Also, need your input on the Webhooks. I've gone through your videos on Stripe and what I am trying to understand is how can we call stripe web hooks from our client side after the payment is successful. I would like to save the transaction details in the database. Below is the webhook logic from the official documentation in which there is a url mapping of "/webhook" with a POST request. My query is how is this code triggered? Is this "/webhook" param tied to for example a payment button on client side from where a REST call to webhooks can be made to do post payment event handling like updating the database or the intention is to monitor the events only through the Stripe dashboard? post("/webhook", (request, response) -> { String payload = request.body(); String sigHeader = request.headers("Stripe-Signature"); Event event = null; try { event = Webhook.constructEvent( payload, sigHeader, endpointSecret ); } catch (SignatureVerificationException e) { response.status(400); return ""; } // Deserialize the nested object inside the event EventDataObjectDeserializer dataObjectDeserializer = event.getDataObjectDeserializer(); StripeObject stripeObject = null; if (dataObjectDeserializer.getObject().isPresent()) { stripeObject = dataObjectDeserializer.getObject().get(); } else { // Deserialization failed, probably due to an API version mismatch. } // Handle the event switch (event.getType()) { case "payment_intent.succeeded": { // Then define and call a function to handle the event payment_intent.succeeded break; } // ... handle other event types default: System.out.println("Unhandled event type: " + event.getType()); } response.status(200); return "";
You're welcome-for more specific help with your webhooks, please reach out to our Stripe Developer Discord channel linked here: stripe.com/go/developer-chat.
@@StripeDev Thanks. I figured out we could handle post-payment events through webhooks by using PaymentIntent obj based on payment_intent.succeeded event. However, I am not sure if payment intent obj has all the details. Earlier we used to pass in custom details through client side using a request object.
Hey there-sorry for any confusion. This tutorial covers server-side setup for Stripe payments-for processing credit card info, check out the next videos in our series. You'll find links for HTML/JavaScript, React, iOS, and Android in the video description above. Hope this helps!
I have an issue. I followed your vid and it is excellent. However on minute 8, second 5 I have an error on the server side. Debugging the Server.java file in the post/webhook: the if statemente before the switch controlling events. On that switch we find the following: "the line if(dataObjectDeserializer.getObject().isPresent()){" . That object is received null. I have read the getObject() function. But I still cannot solve the issue. Help would be greatly appreciated... Thank you in adavance @StripeDev
Hey there-If you are receiving a null value in the getObject() method, it means that the deserialization process was unable to parse or map the incoming object correctly. This can happen due to various reasons such as incorrect JSON format or incompatible object mapping. To resolve this issue, you can try the following steps: 1. Check if the incoming JSON payload is formatted correctly. Make sure it matches the expected format for the dataObject that you are trying to deserialize. 2. Verify that you have the correct libraries or dependencies for the JSON deserialization process. Ensure that you are using a compatible version of the library. 3. Double-check the object mapping configuration. Make sure that the dataObject class has the necessary annotations or configuration for the deserialization process. 4. If you are still unable to solve the issue, you can try debugging the deserialization process further. Print the incoming JSON payload and compare it with the dataObject class to identify any discrepancies. If none of these steps resolve the issue, it might be helpful to provide more specific details about your code, such as the relevant sections of the Server.java file, the dataObject class, and the JSON payload you are trying to deserialize.
Hey there Shakeel, with our React Native SDK, you can accept both Apple Pay and traditional credit card payments: stripe.com/docs/apple-pay?platform=react-native.
Thank you so much for the training, you provided the clarity I required to fix my issue on the server
Thanks for this. Are there any demos that show separating the auth and capture calls?
It is failing when I set amount less than 50 CAD. In certain scenarios, we would need payment for a transaction of less than 50$. Please let me know how can we allow that. Below is the exception message:
Amount must be at least $0.50 cad; code: amount_too_small;
I was able to resolve this my multiplying amount with 100. It seems stripe is charging in cents.
Hi Avneet-yes, amounts are charged in the currency’s smallest unit. For example, to charge 10 USD, provide an amount value of 1000 (that is, 1000 cents).
@@StripeDev Thanks so much. Also, need your input on the Webhooks. I've gone through your videos on Stripe and what I am trying to understand is how can we call stripe web hooks from our client side after the payment is successful. I would like to save the transaction details in the database. Below is the webhook logic from the official documentation in which there is a url mapping of "/webhook" with a POST request. My query is how is this code triggered? Is this "/webhook" param tied to for example a payment button on client side from where a REST call to webhooks can be made to do post payment event handling like updating the database or the intention is to monitor the events only through the Stripe dashboard?
post("/webhook", (request, response) -> {
String payload = request.body();
String sigHeader = request.headers("Stripe-Signature");
Event event = null;
try {
event = Webhook.constructEvent(
payload, sigHeader, endpointSecret
);
} catch (SignatureVerificationException e) {
response.status(400);
return "";
}
// Deserialize the nested object inside the event
EventDataObjectDeserializer dataObjectDeserializer = event.getDataObjectDeserializer();
StripeObject stripeObject = null;
if (dataObjectDeserializer.getObject().isPresent()) {
stripeObject = dataObjectDeserializer.getObject().get();
} else {
// Deserialization failed, probably due to an API version mismatch.
}
// Handle the event
switch (event.getType()) {
case "payment_intent.succeeded": {
// Then define and call a function to handle the event payment_intent.succeeded
break;
}
// ... handle other event types
default:
System.out.println("Unhandled event type: " + event.getType());
}
response.status(200);
return "";
You're welcome-for more specific help with your webhooks, please reach out to our Stripe Developer Discord channel linked here: stripe.com/go/developer-chat.
@@StripeDev Thanks. I figured out we could handle post-payment events through webhooks by using PaymentIntent obj based on payment_intent.succeeded event. However, I am not sure if payment intent obj has all the details. Earlier we used to pass in custom details through client side using a request object.
where to define the Credcard info .. how can we charge the payement? confusing tutorial
Hey there-sorry for any confusion. This tutorial covers server-side setup for Stripe payments-for processing credit card info, check out the next videos in our series. You'll find links for HTML/JavaScript, React, iOS, and Android in the video description above. Hope this helps!
I have an issue. I followed your vid and it is excellent. However on minute 8, second 5 I have an error on the server side. Debugging the Server.java file in the post/webhook: the if statemente before the switch controlling events. On that switch we find the following: "the line if(dataObjectDeserializer.getObject().isPresent()){" . That object is received null.
I have read the getObject() function. But I still cannot solve the issue. Help would be greatly appreciated...
Thank you in adavance @StripeDev
Hey there-If you are receiving a null value in the getObject() method, it means that the deserialization process was unable to parse or map the incoming object correctly. This can happen due to various reasons such as incorrect JSON format or incompatible object mapping.
To resolve this issue, you can try the following steps:
1. Check if the incoming JSON payload is formatted correctly. Make sure it matches the expected format for the dataObject that you are trying to deserialize.
2. Verify that you have the correct libraries or dependencies for the JSON deserialization process. Ensure that you are using a compatible version of the library.
3. Double-check the object mapping configuration. Make sure that the dataObject class has the necessary annotations or configuration for the deserialization process.
4. If you are still unable to solve the issue, you can try debugging the deserialization process further. Print the incoming JSON payload and compare it with the dataObject class to identify any discrepancies.
If none of these steps resolve the issue, it might be helpful to provide more specific details about your code, such as the relevant sections of the Server.java file, the dataObject class, and the JSON payload you are trying to deserialize.
This endpoint cannot be used to make this paymen
How we can do the stripe apple pay with react native
Hey there Shakeel, with our React Native SDK, you can accept both Apple Pay and traditional credit card payments: stripe.com/docs/apple-pay?platform=react-native.
@@StripeDev yes i also found that link after my comment here,
thank you