-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2a-updateShippingAddress.php
More file actions
45 lines (34 loc) · 1.17 KB
/
2a-updateShippingAddress.php
File metadata and controls
45 lines (34 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
declare(strict_types=1);
require __DIR__ . '/../../vendor/autoload.php';
use Dotenv\Dotenv;
$dotenv = Dotenv::createImmutable(__DIR__ . '/../..');
$dotenv->load();
use Qvickly\Api\Checkout\CheckoutAPI;
use function Qvickly\Api\Payment\Helpers\exampleCheckout;
$checkoutAPI = new CheckoutAPI($_ENV['EID'], $_ENV['SECRET'], true, [
// 'BASE_URL' => 'https://api.development.billmate.se/',
// 'CHECKOUT_BASE_URL' => 'https://checkout.development.billmate.se/',
]);
echo "Create checkout\n";
$payload = exampleCheckout();
$checkout = $checkoutAPI->initCheckout($payload);
echo "Step 1\n";
$personalInfo = $checkoutAPI->step1($checkout['hash'], [
'pno' => $_ENV['PNO'],
'email' => $_ENV['EMAIL'],
'type' => 'person',
'zip' => $_ENV['ZIP'],
'phonenumber' => $_ENV['PHONENUMBER'],
]);
echo "Update shipping address\n";
$shippingAddress = $checkoutAPI->updateShippingAddress($checkout['hash'], [
'firstname' => 'FIRSTNAME',
'lastname' => 'LASTNAME',
'street' => 'STREET',
'zip' => '23456',
'city' => 'CITY',
'country' => 'COUNTRY',
]);
echo json_encode($shippingAddress, JSON_PRETTY_PRINT) . "\n";
echo "URL to use: " . $checkout['url'] . "\n";