Get address
This is the example for getAddress. The documentation for can be found here
{
"credentials": {
"id": "12345",
"hash": "d12fffb30cc76ebf7ba5c5bc496188cea46c1cf09ebaa4421391f9571bd4df6920223222e87b6bf0dcb7fa8867410851e148f84f9dec6d94b1fddf9f66dc1307",
"version": "2.5.0",
"client": "Pluginname:Qvickly:1.0",
"language": "sv",
"time": "1417004339.9291"
},
"data": {
"pno": "550101-1018",
"country": "SE"
},
"function": "getAddress"
}
<?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(
[
"pno" => "550101-1018",
"country" => "SE"
]
);
$address = $paymentAPI->getAddress($data);
print_r($address);
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(
"pno" => "550101-1018",
"country" => "SE"
);
echo json_encode($api->getAddress($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 GetAddress
{
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["pno"] = "550101-1018";
parameters["country"] = "SE";
Dictionary<string, object> result = bm.Call("getAddress", 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 address = await paymentAPI.call("getAddress", {
country: "SE",
pno: "550101-1018",
});
console.log(address);
Full example can be found here
import {QvicklyPaymentAPI, env} from "../../PaymentAPI.ts";
const paymentAPI = new QvicklyPaymentAPI(env["EID"], env["SECRET"]);
const address = await paymentAPI.call("getAddress", { pno: "5501011018" })
console.log(address);
Full example can be found here
import QvicklyPaymentAPI from "../../PaymentAPI";
const paymentAPI = new QvicklyPaymentAPI(Bun.env.EID, Bun.env.SECRET);
const address = await paymentAPI.call("getAddress", { pno: "5501011018" })
console.log(address);
Full example can be found here
from PaymentAPI import PaymentAPI
# Create a PaymentAPI object
api = PaymentAPI(eid, secret)
address = api.call(function="getAddress", data={"country":"SE","pno":"550101-1018"})
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 = 0;
my $debug = 0;
# Credentials for Auth
my $id = $ENV{"EID"};
my $key = $ENV{"SECRET"};
my $api = PaymentAPI->new($id, $key, $test, $debug);
my $values = {
'pno' => "550101-1018",
"country" => "SE",
};
print(Dumper($api->call("getAddress", $values)));
1;
Full example can be found here
Response from server
{
"credentials": {
"hash": "edbbb1411422ac0d1cbc5e3a1b8948d01edaa4553ea7a78c1aad823db9f49acbc0b6f9d02769cae8975fe5f44bba13050a5b9c2e19f0f488b9faa7df66029520",
"logid": 1234567
},
"data": {
"firstname": "*TEST* Firstname",
"lastname": "Lastname",
"street": "Streetname",
"zip": "12345",
"city": "City",
"country": "SE",
"phone": "467012345678",
"email": "test@testcompany.se"
}
}
Last modified: 13 September 2024