Closed borodadada closed 5 years ago
Here’s the API docs on how to cancel a charge: https://commerce.coinbase.com/docs/api/#cancel-a-charge.
Additionally, a charge is marked as expired if no payment is detected within 60 minutes of charge creation. However, if a payment comes in after 60 minutes but within 7 days of charge creation, the payment will still be detected and accounted for.
Here’s a diagram of all the payment statuses that can occur: https://commerce.coinbase.com/docs/images/payment_statuses_diagram.png
Is this library doesn't have any method to delete a charge , retrieve etc
how do I cancel it with node js integration
wrote this small function that does the trick, let me know
import fetch from "node-fetch";
const cancelCharge = async (chargeCode: string, apiKey: string): Promise<void> => {
try {
await fetch(
`https://api.commerce.coinbase.com/charges/${chargeCode}/cancel`,
{
method: "POST",
headers: {
"X-CC-Api-Key": apiKey,
"X-CC-Version": "2018-03-22",
},
}
);
} catch (error) {
console.log("cancelCharge error:", error);
}
};
Hello, how i can delete( cancel) charge ? I have 2 charge where both timeline expired. Or after some time they delete automatically?