Product Docs Help

Get exchange rate

This is the example for getExchangeRate. The documentation for can be found here

{ "credentials": { "id": "12345", "hash": "3fe247645db7d6f4fa05bf736c774b7eb42384983490f1257d20a904f3c7beed440a0f234437b9dc701cad4b88c81d62a90de54183aa6b3c44c95424f04a98a4", "version": "2.5.0", "client": "Pluginname:Qvickly:1.0", "language": "sv", "time": 1714940371.323135 }, "data": { "currency": "USD", "date": "2024-04-30" }, "function": "getExchangeRate" }
<?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( [ "currency" => "USD", "date" => "2024-04-30" ] ); $rate = $paymentAPI->getExchangeRate($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( "currency" => "USD", "date" => "2024-04-30" ); echo json_encode($api->getExchangeRate($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("getExchangeRate", { currency: "USD", date: "2024-04-30", }); 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("getExchangeRate", { currency: "USD", date: "2024-04-30", }); 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("getExchangeRate", { currency: "USD", date: "2024-04-30", }); 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="getExchangeRate", data={"currency":"USD","date":"2024-04-30"}) 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 = { "currency" => "DKK", "date" => "2024-05-15", }; print(Dumper($api->call("getExchangeRate", $values))); 1;

Full example can be found here

Response from server

{ "credentials": { "hash": "669957e56ddc7394073c8f6df887e17411d7f9fe1000f04fc519b1ebebefa03c43a89d1d99d9e47bb9da2688d55af1338d7a06c6bab8b143393f0c7ced459a14", "logid": 1234567 }, "data": { "rate": "10.9657", "result": "0", "date": "2024-04-30" } }
Last modified: 13 September 2024