Get order by hash
This is the example for getOrderByHash. The documentation for can be found here
{
"credentials": {
"id": "12345",
"hash": "ae98fad9a1cc5e715c473b8a6d8f255b5d7c1385b8f0da5e2e68b43b84711454072caf5a3fb70e8386ad2ee9fe72c26023f6166a18e9bd995d62e25e387cda29",
"version": "2.5.0",
"client": "Pluginname:Qvickly:1.0",
"language": "sv",
"time": 1714942741.018025
},
"data": {
"hash": "123456abc123456abc123456abc12345"
},
"function": "getOrderByHash"
}
<?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(
[
"hash" => "123456abc123456abc123456abc12345",
]
);
$order = $paymentAPI->getOrderByHash($data);
print_r($order);
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();
$values["hash"] = "123456abc123456abc123456abc12345";
echo json_encode($api->getOrderByHash($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 order = await paymentAPI.call("getOrderByHash", {
hash: "123456abc123456abc123456abc12345",
});
console.log(order);
Full example can be found here
import {QvicklyPaymentAPI, env} from "../../PaymentAPI.ts";
const paymentAPI = new QvicklyPaymentAPI(env["EID"], env["SECRET"]);
const order = await paymentAPI.call("getOrderByHash", {
hash: "123456abc123456abc123456abc12345",
});
console.log(order);
Full example can be found here
import QvicklyPaymentAPI from "../../PaymentAPI";
const paymentAPI = new QvicklyPaymentAPI(Bun.env.EID, Bun.env.SECRET);
const order = await paymentAPI.call("getOrderByHash", {
hash: "123456abc123456abc123456abc12345",
});
console.log(order);
Full example can be found here
from PaymentAPI import PaymentAPI
# Create a PaymentAPI object
api = PaymentAPI(eid, secret)
order = api.call(function="getOrderByHash", data={"hash":"123456abc123456abc123456abc12345"})
print(json.dumps(order, 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 = {
"hash" => "123456abc123456abc123456abc12345",
};
print(Dumper($api->call("getOrderByHash", $values)));
1;
Full example can be found here
Response from server
{
"credentials": {
"hash": "bc8bc432ad0127802509788b231a39944049a555ff243eafb78ce3b5cd6a58a1f8442bbe272a52e461feb53097a7915d17d45ffdc3fa8c4a2e3de3393d2168eb",
"logid": 1234567
},
"data": {
"DateTime": "2024-05-01 12:12:12",
"PaymentData": {
"order": {
"number": "12345",
"status": "Pending",
"orderid": "123",
"url": "https://api.billmate.se/invoice/123456/"
},
"number": "12345",
"orderid": "12345",
"status": "Step2Loaded",
"method": "2048",
"paymentplanid": "0",
"currency": "SEK",
"language": "sv",
"country": "SE",
"method_name": "Betala med Qvickly",
"logo": "",
"accepturl": "https://example.com/?bco_confirm=yes&bco_flow=checkout_redirect&wc_order_id=null",
"cancelurl": "https://example.com/checkout/",
"callbackurl": "https://example.com/wc-api/BCO_WC_Push/"
},
"apiClient": "MyBillMate:NodeJS:1.0",
"Customer": {
"Billing": {
"company": "",
"street": "Testgatan 1",
"zip": "123 45",
"city": "Testingeby",
"country": "SE",
"phone": "070 - 000 00 00",
"email": "tess.t.persson@example.com",
"type": "person",
"firstname": "Tess T",
"lastname": "Persson",
"street2": ""
},
"pno": "19550101-0101",
"Shipping": []
},
"PaymentInfo": "",
"Cart": {
"Total": {
"withouttax": "7000",
"tax": "0",
"rounding": "0",
"withtax": "7000"
},
"Shipping": {
"withouttax": "0",
"taxrate": "0"
},
"Handling": {
"withouttax": "0",
"taxrate": "0"
}
},
"Articles": [
{
"artnr": "woo-long-sleeve-tee",
"title": "Long Sleeve Tee",
"quantity": "1",
"aprice": "2500",
"withouttax": "2500",
"taxrate": "0",
"discount": "0"
},
{
"artnr": "woo-hoodie-blue-logo",
"title": "Hoodie - blue, Yes",
"quantity": "1",
"aprice": "4500",
"withouttax": "4500",
"taxrate": "0",
"discount": "0"
}
],
"CheckoutData": {
"terms": "https://example.com/cart/",
"companyView": "false",
"hideShippingAddress": "false",
"privacyPolicy": "https://example.com/privacy-policy/",
"Cart": {
"Total": {
"withouttax": "7000",
"tax": "0",
"rounding": "0",
"withtax": "7000"
},
"Shipping": {
"withouttax": "0",
"taxrate": "0"
},
"Handling": {
"withouttax": "0",
"taxrate": "0"
}
},
"client": "WooCommerce_v2:1.6.6"
},
"orderid_real": "12345",
"invoiceid_real": "1234567",
"status": "Created"
}
}
Last modified: 13 September 2024