Activate payment
This is the example for activatePayment. The documentation for can be found here
{
"credentials": {
"id": "12345",
"hash": "b8122d2e9580525e03c566264c8f5a004ed780b0f00568429dbd965fc2b2b89a7f0fd50e11d19c86a81f4bb4684eb2bac1d608653e807725b0068ce4bee3221c",
"version": "2.5.0",
"client": "Pluginname:Qvickly:1.0",
"language": "sv",
"time": 1714827001.526806
},
"data": {
"number": "12345"
},
"function": "activatePayment"
}
<?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'], testMode: true);
$data = new Data(
[
"number" => "12345"
]
);
$payment = $paymentAPI->activatePayment($data);
print_r($payment);
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(
"number" => "1000235"
);
echo json_encode($api->activatePayment($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 ActivatePayment
{
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["number"] = "1000235";
Dictionary<string, object> result = bm.Call("activatePayment", 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 payment = await paymentAPI.call("activatePayment", {
number: "12345",
});
console.log(payment);
Full example can be found here
import {QvicklyPaymentAPI, env} from "../../PaymentAPI.ts";
const paymentAPI = new QvicklyPaymentAPI(env["EID"], env["SECRET"]);
const payment = await paymentAPI.call("activatePayment", {
number: "12345",
});
console.log(payment);
Full example can be found here
import QvicklyPaymentAPI from "../../PaymentAPI";
const paymentAPI = new QvicklyPaymentAPI(Bun.env.EID, Bun.env.SECRET);
const payment = await paymentAPI.call("activatePayment", {
number: "12345",
});
console.log(payment);
Full example can be found here
from PaymentAPI import PaymentAPI
# Create a PaymentAPI object
api = PaymentAPI(eid, secret)
payment = api.call(function="activatePayment", data={"number":"12345"})
print(json.dumps(payment, 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 = {
"number" => "12345",
};
print(Dumper($api->call("activatePayment", $values)));
1;
Full example can be found here
Response from server
{
"credentials": {
"hash": "3d7506031bac8c67b4fc4750b2f879c6965d595f3f21e07aa2722313e5bc0c9cce347af5764a67b2f85c086503296f54cc2294334086efca210232b76e1b98ac",
"logid": "1234567"
},
"data": {
"number": "1000235",
"orderid": "12345",
"status": "Factoring",
"url": "https://api.qvickly.io/invoice/140544658153c38f1cdf279"
}
}
Error response
{
"code": "5201",
"message": "Invoice number 12345 does not exist.",
"logid": "1234567"
}
Last modified: 13 September 2024