Get payment plans
This is the example for getPaymentPlans. The documentation for can be found here
{
"credentials": {
"id": "12345",
"hash": "e7ebd95d701c9a8a16d6ad51457bc4d775d7027682fef2853abcfb0ad918d0ea89b849cf552efa9be08a8e397df9a971e884706455f1673ad556dab2330904f3",
"version": "2.5.0",
"client": "Pluginname:Qvickly:1.0",
"language": "sv",
"time": 1714839918.5766358
},
"data": {
"PaymentData": {
"country": "SE",
"currency": "SEK",
"language": "sv"
}
},
"function": "getPaymentPlans"
}
<?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;
$paymentAPI = new PaymentAPI($_ENV['EID'], $_ENV['SECRET']);
$data = new Data(
[
"PaymentData" => new PaymentData(
[
"country" => "SE",
"currency" => "SEK",
"language" => "sv",
]
)
]
);
$plans = $paymentAPI->getPaymentPlans($data);
print_r($plans);
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(
"currency" => "SEK",
"language" => "sv",
"country" => "SE",
"totalwithtax" => "50000"
);
echo json_encode($api->getPaymentplans($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 GetPaymentPlans
{
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["currency"] = "SEK";
parameters["country"] = "SE";
parameters["language"] = "sv";
parameters["totalwithtax"] = "50000";
Dictionary<string, object> result = bm.Call("getPaymentplans", 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 plans = await paymentAPI.call("getPaymentPlans", {
PaymentData: {
country: "SE",
currency: "SEK",
language: "sv",
},
});
console.log(plans);
Full example can be found here
import {QvicklyPaymentAPI, env} from "../../PaymentAPI.ts";
const paymentAPI = new QvicklyPaymentAPI(env["EID"], env["SECRET"]);
const plans = await paymentAPI.call("getPaymentPlans", {
PaymentData: {
country: "SE",
currency: "SEK",
language: "sv",
},
});
console.log(plans);
Full example can be found here
import QvicklyPaymentAPI from "../../PaymentAPI";
const paymentAPI = new QvicklyPaymentAPI(Bun.env.EID, Bun.env.SECRET);
const plans = await paymentAPI.call("getPaymentPlans", {
PaymentData: {
country: "SE",
currency: "SEK",
language: "sv",
},
});
console.log(plans);
Full example can be found here
from PaymentAPI import PaymentAPI
# Create a PaymentAPI object
api = PaymentAPI(eid, secret)
plans = api.call(function="getPaymentPlans", data={
"PaymentData": {
"country": "SE",
"currency": "SEK",
"language": "sv",
}
})
print(json.dumps(plans, 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 = {
"PaymentData" => {
"country" => "SE",
"currency" => "SEK",
"language" => "sv",
},
};
print(Dumper($api->call("getPaymentPlans", $values)));
1;
Full example can be found here
Response from server
{
"credentials": {
"hash": "5e3067894ff7ffef37ec0c728cf8f1382b18bc49412087149b3ea340feb435bc18b298554413fe408c62f942ad4c36aacc685f171b01b76738e2f83e52c1a3a1"
},
"data": [
{
"paymentplanid": "1",
"description": "3 månaders delbetalning",
"nbrofmonths": "3",
"startfee": "2900",
"handlingfee": "3500",
"minamount": "10000",
"maxamount": "10000000000",
"country": "SE",
"type": "1",
"expirydate": "2025-12-31",
"interestrate": "12",
"currency": "SEK",
"language": "sv",
"totalfee": "64500",
"monthlycost": "21500"
},
{
"paymentplanid": "2",
"description": "6 månaders delbetalning",
"nbrofmonths": "6",
"startfee": "17000",
"handlingfee": "3500",
"minamount": "20000",
"maxamount": "10000000000",
"country": "SE",
"type": "1",
"expirydate": "2025-12-31",
"interestrate": "12",
"currency": "SEK",
"language": "sv",
"totalfee": "90600",
"monthlycost": "15100"
},
{
"paymentplanid": "3",
"description": "12 månaders delbetalning",
"nbrofmonths": "12",
"startfee": "17000",
"handlingfee": "3500",
"minamount": "40000",
"maxamount": "10000000000",
"country": "SE",
"type": "1",
"expirydate": "2025-12-31",
"interestrate": "12",
"currency": "SEK",
"language": "sv",
"totalfee": "114000",
"monthlycost": "9500"
}
]
}
Last modified: 13 September 2024