Cancel payment
This is the example for cancelPayment. The documentation for can be found here
{
"credentials": {
"id": "12345",
"hash": "d6c98ac67c1b7dacb49c39a2641b64bca7048f765445a69a4ffad78799091fbef1d3d5ebaf0d88ffea3b98021c2026934313feeaa9bc509a42a6491cd04a714a",
"version": "2.5.0",
"client": "Pluginname:Qvickly:1.0",
"language": "sv",
"time": 1714828782.338867
},
"data": {
"number": "12345"
},
"function": "cancelPayment"
}
<?php
declare(strict_types=1);
require '../../../vendor/autoload.php';
use Dotenv\Dotenv;
$dotenv = Dotenv::createImmutable(__DIR__ . '/../../..');
$dotenv->load();
use Qvickly\Api\Payment\PaymentAPI;
use Qvickly\Api\Payment\DataObjects\Data;
$paymentAPI = new PaymentAPI($_ENV['EID'], $_ENV['SECRET'], testMode: true);
$data = new Data(
[
"number" => "12345"
]
);
$payment = $paymentAPI->cancelPayment($data);
print_r($payment);
Full example can be found here
This code requires our composer package qvickly/api
composer require qvickly/api
<?php
include('../PaymentAPI.php');
$test = true;
$debug = false;
/* Credentials for Auth */
$id = "12345";
$key = "123451234512";
define("QVICKLY_SERVER", "2.5.0"); // API version
define("QVICKLY_CLIENT", "Pluginname:Qvickly:1.0");
define("QVICKLY_LANGUAGE", "sv");
$api = new PaymentAPI($id, $key, $test, $debug);
$values = array();
/* Payment Data */
/**
* @param array Payment Data : Buyer details.
*/
$values["PaymentData"] = array(
"number" => "1000235"
);
echo json_encode($api->cancelPayment($values), JSON_PRETTY_PRINT);
Full example can be found here
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BillmateAPI;
namespace CancelPayment
{
class Program
{
static void Main(string[] args)
{
try
{
Boolean ssl = false;
Dictionary referrer = new Dictionary();
referrer["HTTP_X_REAL_IP"] = "127.0.0.1";
Billmate bm = new Billmate("12345", "123451234512",ssl,true,false,referrer);
bm.Client = "Pluginname:Qvickly:1.0";
bm.Server = "2.5.0";
bm.Language = "sv";
Dictionary<string, object> parameters = new Dictionary<string, object>();
parameters["number"] = "1000235";
Dictionary<string, object> result = bm.Call("cancelPayment", parameters);
// Output it in Console
result.ToList().ForEach(x => Console.WriteLine(x.Key + ":" + x.Value));
}
catch (BillmateException be) {
Console.WriteLine(be.ErrorMessage);
Console.WriteLine(be.ErrorLogs);
}
Console.ReadLine();
}
}
}
import { QvicklyPaymentAPI } from "../../PaymentAPI.js";
const paymentAPI = new QvicklyPaymentAPI(process.env.EID, process.env.SECRET);
const payment = await paymentAPI.call("cancelPayment", {
number: "12345",
});
console.log(payment);
Full example can be found here
import {QvicklyPaymentAPI, env} from "../../PaymentAPI.ts";
const paymentAPI = new QvicklyPaymentAPI(env["EID"], env["SECRET"]);
const payment = await paymentAPI.call("cancelPayment", {
number: "12345",
});
console.log(payment);
Full example can be found here
import QvicklyPaymentAPI from "../../PaymentAPI";
const paymentAPI = new QvicklyPaymentAPI(Bun.env.EID, Bun.env.SECRET);
const payment = await paymentAPI.call("cancelPayment", {
number: "12345",
});
console.log(payment);
Full example can be found here
from PaymentAPI import PaymentAPI
# Create a PaymentAPI object
api = PaymentAPI(eid, secret)
payment = api.call(function="cancelPayment", data={"number":"12345"})
print(json.dumps(payment, indent=4))
Full example can be found here
#!/usr/bin/perl
use strict;
use warnings;
use JSON::PP;
use Data::Dumper;
use lib '../..';
require "PaymentAPI.pl";
require "LoadEnv.pl";
LoadEnv('../../.env');
my $test = 1;
my $debug = 0;
# Credentials for Auth
my $id = $ENV{"EID"};
my $key = $ENV{"SECRET"};
my $api = PaymentAPI->new($id, $key, $test, $debug);
my $values = {
"number" => "12345",
};
print(Dumper($api->call("cancelPayment", $values)));
1;
Full example can be found here
Response from server
{
"credentials": {
"hash": "54c3928bd58ea07eec2b82b6f3075df85f9bc5846f737feee5e497dcf96df26097258b30447df4627f97fcd4100fa86f7dbe9dd4a753da29939d34c9afae013f"
},
"data": {
"number": "1000235",
"orderid": "12345",
"status": "Cancelled",
"url": "https://api.qvickly.io/invoice/140544658153c38f1cdf279"
}
}
Last modified: 13 September 2024