Giter VIP home page Giter VIP logo

Comments (4)

guacamoli avatar guacamoli commented on June 25, 2024

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

from coinbase-commerce-node.

basit1327 avatar basit1327 commented on June 25, 2024

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

from coinbase-commerce-node.

penielny avatar penielny commented on June 25, 2024

how do I cancel it with node js integration

from coinbase-commerce-node.

hippolyte42 avatar hippolyte42 commented on June 25, 2024

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

from coinbase-commerce-node.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.