Get terms
This is the example for getTerms. The documentation for can be found here
{
"credentials": {
"id": "12345",
"hash": "7d6b98a406aeb6551b8a92eebc3ba388e5fe903cdce7a412059869627cb78f37c44d4664d558e7b88221094c29b981bd25d779daa946a558f37a50f2fe6a10f0",
"version": "2.5.0",
"client": "Pluginname:Qvickly:1.0",
"language": "sv",
"time": 1714839340.0972931
},
"data": {
"dummyData": 1714839340097221000
},
"function": "getTerms"
}
<?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;
use Qvickly\Api\Payment\DataObjects\PaymentData;
use Qvickly\Api\Payment\DataObjects\Cart;
use Qvickly\Api\Payment\DataObjects\CartTotal;
$paymentAPI = new PaymentAPI($_ENV['EID'], $_ENV['SECRET']);
$data = new Data(
[
"PaymentData" => new PaymentData([
"method" => 1
]),
"Cart" => new Cart([
"total" => new CartTotal([
"withtax" => 100000
])
])
]
);
$terms = $paymentAPI->getTerms($data);
print_r($terms);
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(
"method" => "1",
"paymentplanid" => ""
);
/**
* @param array Cart Data : Cart details.
*/
$values["Cart"] = array(
"Total" => array(
"withtax" => "231700"
)
);
echo $api->getTerms($values);
Full example can be found here
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BillmateAPI;
namespace GetTerms
{
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,%(test),false,referrer);
bm.Client = "Pluginname:Qvickly:1.0";
bm.Server = "2.5.0";
bm.Language = "sv";
Dictionary<string, object> Paymentdata = new Dictionary<string, object>();
paymentdata["method"] = "1";
paymentdata["paymentplanid"] = "";
values["PaymentData"] = Paymentdata;
Dictionary<string, object> Cart = new Dictionary<string, object>();
Dictionary<string, string> Total = new Dictionary<string, string>();
total["withtax"] = "231700";
cart["Total"] = Total;
values["Cart"] = Cart;
Dictionary<string, object> result = bm.Call("getTerms", values);
// 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 terms = await paymentAPI.call("getTerms");
console.log(terms);
Full example can be found here
import {QvicklyPaymentAPI, env} from "../../PaymentAPI.ts";
const paymentAPI = new QvicklyPaymentAPI(env["EID"], env["SECRET"]);
const terms = await paymentAPI.call("getTerms");
console.log(terms);
Full example can be found here
import QvicklyPaymentAPI from "../../PaymentAPI";
const paymentAPI = new QvicklyPaymentAPI(Bun.env.EID, Bun.env.SECRET);
const terms = await paymentAPI.call("getTerms");
console.log(terms);
Full example can be found here
from PaymentAPI import PaymentAPI
# Create a PaymentAPI object
api = PaymentAPI(eid, secret)
terms = api.call(function="getTerms")
print(terms)
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 = {
"dummyData" => "dummyValue",
};
print(Dumper($api->call("getTerms", $values)));
1;
Full example can be found here
Response from server
The response will be an HTML page with the terms and conditions.
Last modified: 13 September 2024