-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.php
57 lines (49 loc) · 1.45 KB
/
options.php
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
46
47
48
49
50
51
52
53
54
55
56
57
<?php
/*
Docs: https://docs.scanpay.dev/payment-link
support@scanpay.dk || irc.scanpay.dev:6697 #support
*/
require dirname(__FILE__) . '/../lib/Scanpay.php';
$apikey = '1153:YHZIUGQw6NkCIYa3mG6CWcgShnl13xuI7ODFUYuMy0j790Q6ThwBEjxfWFXwJZ0W';
$scanpay = new Scanpay\Scanpay($apikey);
$options = [
// Change API endpoint.
'hostname' => 'api.scanpay.dev',
// Set HTTP HEADERS
'headers' => [
// Manually overwrite the API key
'Authorization' => 'Basic ' . base64_encode($apikey),
// Client IP address (DoS prevention)
'X-Cardholder-IP' => '192.168.1.1',
],
// Set cURL to verbose
'debug' => true,
// cURL options (https://php.net/manual/en/function.curl-setopt.php)
'curl' => [
CURLOPT_SSL_FALSESTART => 1,
CURLOPT_TCP_FASTOPEN => 1,
],
];
$order = [
'orderid' => 'a766409',
'language' => 'da',
'successurl' => 'https://docs.scanpay.dev/payment-link',
'items' => [
[
'name' => 'Pink Floyd: The Dark Side Of The Moon',
'quantity' => 2,
'total' => '199.99 DKK',
'sku' => 'fadf23',
], [
'name' => '巨人宏偉的帽子',
'quantity' => 2,
'total' => '420 DKK',
'sku' => '124',
],
]
];
try {
print_r($newURL = $scanpay->newURL($order, $options) . "\n");
} catch (Exception $e) {
die($e->getMessage() . "\n");
}