#myz123
1 messages · Page 1 of 1 (latest)
Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
hello! can you elaborate a bit more? Do you mean you want to identify the corresponding payment from a refund/dispute event?
I mean if there is a refund or dispute, I should be able to find out the related payment in my database. How can find it?
Could you pls show me an example?
I only save amount, user name, create time. How can find related transaction
Yes, I want to find corresponding payment from a refund or dispute event
you should save either (or both) the payment_intent and/or charge id from the refund and dispute object
similarly, when you create the payment, you should save the corresponding id
can you share your current code snippet for how you're processing webhook events?
you can refer to our API docs to see what parameters can be found in the respective objects :
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
When you receive the webhook event, you can also log the request body to see how it looks like
if (event.type === "checkout.session.completed") {
const uid = metadata.firebaseUID;
const amount = metadata.amount;
const firestore = admin.firestore();
try {
await firestore.runTransaction(async (transaction) => {
const userRef = firestore.collection('Users').doc(uid);
const userDoc = await transaction.get(userRef);
if (userDoc.exists) {
const userData = userDoc.data();
const currentBalance = userData?.Readonly?.balance || 0;
transaction.update(userRef, {
'Readonly.balance': parseInt(currentBalance) + parseInt(amount),
});
const transactionRef = firestore.collection('Transactions').doc();
transaction.set(transactionRef, {
uid,
from: 'Bank Transfer',
to: 'My Balance',
type: 'stripe',
description: 'Deposit',
amount: parseInt(amount),
createdAt: admin.firestore.FieldValue.serverTimestamp()
});
}
});
} catch (error) {
console.error("Error updating pincode: ", error);
response.json({ received: true, success: false, error });
}
}
this is my code
how can obtain these data
sorry, but we're not familiar with firebase so that's not something we're going to be able to help with here on this channel
Where can I obtain payment_intent or chargeId? from event.data.object?
yep, it should be in there. You can log the event.data.object to see how it looks like
ðŸ˜
If a refund happens will it send me an email? What info I should use to track the payment?
As far as I know, there's no such option for an email to be sent to you when a refund occurs. Since you're the one initiating a refund, you would already know that you made a refund, is there a reason why you need an email?
If a user claims that their credit card was stolen, their money would be reclaimed by the bank. But if they have already received services from me, what can I do to compensate for my loss?
I'd recommend you reach out to Stripe Support - https://support.stripe.com/contact, they'll be able to advise you better on your questions regarding disputes and how to manage them. We mainly help with developers who want to integrate directly with the Stripe API here on this channel