Get vat rate
This is the example for getVatRate. The documentation for can be found here
{
"credentials": {
"id": "12345",
"hash": "e2b7cd4e3e73d940be7c14cb68de7e56316925dc46ce92a9b0a97f7ccbd59b615cf87fcca1140f4fee2818d6a8b51e9c167f1ddb055a602ab47016dfd49a2fb4",
"version": "2.5.0",
"client": "Pluginname:Qvickly:1.0",
"language": "sv",
"time": 1714940849.370662
},
"data": {
"country": "FI"
},
"function": "getVatRate"
}
<?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']);
$data = new Data(
[
"country" => "FI"
]
);
$rate = $paymentAPI->getVatRate($data);
print_r($rate);
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();
/* Customer Data */
/**
* @param array Customer Data : Customer details.
*/
$values = array(
"country" => "FI"
);
echo json_encode($api->getVatRate($values), JSON_PRETTY_PRINT);
Full example can be found here
import { QvicklyPaymentAPI } from "../../PaymentAPI.js";
const paymentAPI = new QvicklyPaymentAPI(process.env.EID, process.env.SECRET);
const rate = await paymentAPI.call("getVatRate", {
country: "FI",
});
console.log(rate);
Full example can be found here
import {QvicklyPaymentAPI, env} from "../../PaymentAPI.ts";
const paymentAPI = new QvicklyPaymentAPI(env["EID"], env["SECRET"]);
const rate = await paymentAPI.call("getVatRate", {
country: "FI",
});
console.log(rate);
Full example can be found here
import QvicklyPaymentAPI from "../../PaymentAPI";
const paymentAPI = new QvicklyPaymentAPI(Bun.env.EID, Bun.env.SECRET);
const rate = await paymentAPI.call("getVatRate", {
country: "FI",
});
console.log(rate);
Full example can be found here
from PaymentAPI import PaymentAPI
# Create a PaymentAPI object
api = PaymentAPI(eid, secret)
rate = api.call(function="getVatRate", data={"country":"FI"})
print(json.dumps(rate, 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 = {
"country" => "FI",
};
print(Dumper($api->call("getVatRate", $values)));
1;
Full example can be found here
Response from server
{
"credentials": {
"hash": "552d8dcff344e07723d138bc14696d1012652d44ff5ac43f0b6d8319ce7f7443c0474423768181c8a648ee385afe8b8bd18af485b5a94c7669a8a6a1617700f4",
"logid": 1234567
},
"data": {
"result": "24"
}
}
Last modified: 13 September 2024