Powered by Coinflow
Payments · Documentation
Operational

Void Payment

POST https://api-sandbox.coinflow.cash/api/checkout/void Content-Type: application/json

If a payment has been created with authOnly=true, void the authorization using this endpoint.

Reference: /api-reference/api-reference/checkout/void-payment

Authentication

  • Authorization header (required) — The API key of the merchant - see /api-reference/api-reference/authentication/get-session-key
  • Authorization header (required)

Request

Body (application/json)

  • paymentId (string, required)

Examples

Request

{
  "paymentId": "a3f1c9e2-7b4d-4f8a-9d2e-5c6b7a8e9f01"
}

Response

{}

SDK Code

import requests

url = "https://api-sandbox.coinflow.cash/api/checkout/void"

payload = { "paymentId": "a3f1c9e2-7b4d-4f8a-9d2e-5c6b7a8e9f01" }
headers = {
    "Authorization": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
const url = 'https://api-sandbox.coinflow.cash/api/checkout/void';
const options = {
  method: 'POST',
  headers: {Authorization: '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"paymentId":"a3f1c9e2-7b4d-4f8a-9d2e-5c6b7a8e9f01"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api-sandbox.coinflow.cash/api/checkout/void"

	payload := strings.NewReader("{\n  \"paymentId\": \"a3f1c9e2-7b4d-4f8a-9d2e-5c6b7a8e9f01\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://api-sandbox.coinflow.cash/api/checkout/void")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"paymentId\": \"a3f1c9e2-7b4d-4f8a-9d2e-5c6b7a8e9f01\"\n}"

response = http.request(request)
puts response.read_body
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api-sandbox.coinflow.cash/api/checkout/void")
  .header("Authorization", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"paymentId\": \"a3f1c9e2-7b4d-4f8a-9d2e-5c6b7a8e9f01\"\n}")
  .asString();
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api-sandbox.coinflow.cash/api/checkout/void', [
  'body' => '{
  "paymentId": "a3f1c9e2-7b4d-4f8a-9d2e-5c6b7a8e9f01"
}',
  'headers' => [
    'Authorization' => '<apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
using RestSharp;

var client = new RestClient("https://api-sandbox.coinflow.cash/api/checkout/void");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"paymentId\": \"a3f1c9e2-7b4d-4f8a-9d2e-5c6b7a8e9f01\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import Foundation

let headers = [
  "Authorization": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["paymentId": "a3f1c9e2-7b4d-4f8a-9d2e-5c6b7a8e9f01"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.coinflow.cash/api/checkout/void")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()