Create invoice from orderhash
This is the example for createInvoiceFromOrderHash. The documentation for can be found here
{
"credentials": {
"id": "12345",
"hash": "1a077ea8235dffb8170140e904182cee200e737de9cd9eb0854e8fa001525c2a4eded1f070b22ae56c93f6426fe58149fb5c4d39238e1af5efb51df550c666b4",
"version": "2.5.0",
"client": "Pluginname:Qvickly:1.0",
"language": "sv",
"time": 1714944035.925046
},
"data": {
"hash": "123456abc123456abc123456abc12345",
"method": "8"
},
"function": "createInvoiceFromOrderHash"
}
<?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",
"method" => "8",
]
);
$invoice = $paymentAPI->createInvoiceFromOrderHash($data);
print_r($invoice);
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";
$values["method"] = "8";
echo json_encode($api->createInvoiceFromOrderHash($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 invoice = await paymentAPI.call("createInvoiceFromOrderHash", {
hash: "123456abc123456abc123456abc12345",
});
console.log(invoice);
Full example can be found here
import {QvicklyPaymentAPI, env} from "../../PaymentAPI.ts";
const paymentAPI = new QvicklyPaymentAPI(env["EID"], env["SECRET"]);
const invoice = await paymentAPI.call("createInvoiceFromOrderHash", {
hash: "123456abc123456abc123456abc12345",
});
console.log(invoice);
Full example can be found here
import QvicklyPaymentAPI from "../../PaymentAPI";
const paymentAPI = new QvicklyPaymentAPI(Bun.env.EID, Bun.env.SECRET);
const invoice = await paymentAPI.call("createInvoiceFromOrderHash", {
hash: "123456abc123456abc123456abc12345",
});
console.log(invoice);
Full example can be found here
from PaymentAPI import PaymentAPI
# Create a PaymentAPI object
api = PaymentAPI(eid, secret)
invoice = api.call(function="createInvoiceFromOrderHash", data={"hash":"123456abc123456abc123456abc12345", "method": "8"})
print(json.dumps(invoice, 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",
"method" => "8",
};
print(Dumper($api->call("createInvoiceFromOrderHash", $values)));
1;
Full example can be found here
Response from server
{
"credentials": {
"hash": "fbbd7c1edf87cd38d689ea694c94bc0d54cc227152f025b3cb4327b0eb4899850ec4ee7cc7058c8cc93917db114814e3e187fb7a054d5ab465c48ec7de18cb7b",
"logid": 1234567
},
"data": {
"number": "12345",
"status": "Created",
"orderid": "12345",
"url": "https://api.billmate.se/invoice/12345/123456abc123456abc123456abc12345",
"alreadycreated": "1"
}
}
Last modified: 13 September 2024