QorePay logo
QorePay logo

Cancel a pending purchase

POST

https://gate.qorepay.com/api/v1/purchases/{id}/cancel

If you have a Purchase that payment is possible for, using this request you can guarantee that it won't be paid.

HEADER PARAMS

  • authorization

    String

    required

    Set value to BEARER SECRET_KEY

  • content-type

    String

    required

    Set value to JSON

PATH PARAMS

  • id

    string

    required

    ID associated with the payment. This is usually returned when you call the POST /purchases endpoint to register or initialize a payment.

RESPONSES

  • 200

    OK

  • 404

    No such object

Query

Javascript


const options = {
  method: 'POST',
  headers: {
    accept: 'application/json'
  }
};

fetch('https://gate.qorepay.com/api/v1/purchases/id/cancel', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));

Sample Response

JSON


const options = {
  method: 'POST',
  headers: {
    accept: 'application/json',
    'content-type': 'application/json'
  },
  body: JSON.stringify({
    client: {
      email: '[email protected]',
      phone: '+2349053693367',
      full_name: 'Felix Qorepay',
      street_address: '20 Kigali road.',
      country: 'NG',
      city: 'Yaba'
    },
    purchase: {
      products: [
        {
          quantity: '2',
          name: 'Dog food',
          price: 230000
        }
      ], 
    }, 
    send_receipt: true, 
    brand_id: '4343434344334343434',
    success_redirect: 'https://www.qore.test',
    failure_redirect: 'https://www.qore.test.fail'
  })
};

fetch('https://gate.qorepay.com/api/v1/purchases/', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));