Skip to content
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

Cancel a charge #12

Closed
borodadada opened this issue May 26, 2019 · 4 comments
Closed

Cancel a charge #12

borodadada opened this issue May 26, 2019 · 4 comments

Comments

@borodadada
Copy link

Hello, how i can delete( cancel) charge ?
I have 2 charge where both timeline expired. Or after some time they delete automatically?

@guacamoli
Copy link
Contributor

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

@basit1327
Copy link

Is this library doesn't have any method to delete a charge , retrieve etc

@penielny
Copy link

how do I cancel it with node js integration

@hippolyte42
Copy link

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);
  }
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

6 participants