-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathpayment.php
129 lines (124 loc) · 3.81 KB
/
payment.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php
require_once __DIR__ . '/../bootstrap.php';
// Creating a random reference for the test
$reference = 'TEST_' . time();
// Request Information
$request = [
'locale' => 'es_CO',
'payer' => [
'name' => 'Kellie Gerhold',
'surname' => 'Yost',
'email' => '[email protected]',
'documentType' => 'CC',
'document' => '1848839248',
'mobile' => '3006108300',
'address' => [
'street' => '703 Dicki Island Apt. 609',
'city' => 'North Randallstad',
'state' => 'Antioquia',
'postalCode' => '46292',
'country' => 'US',
'phone' => '363-547-1441 x383',
],
],
'buyer' => [
'name' => 'Kellie Gerhold',
'surname' => 'Yost',
'email' => '[email protected]',
'documentType' => 'CC',
'document' => '1848839248',
'mobile' => '3006108300',
'address' => [
'street' => '703 Dicki Island Apt. 609',
'city' => 'North Randallstad',
'state' => 'Antioquia',
'postalCode' => '46292',
'country' => 'US',
'phone' => '363-547-1441 x383',
],
],
'payment' => [
'reference' => $reference,
'description' => 'Iusto sit et voluptatem.',
'amount' => [
'taxes' => [
[
'kind' => 'ice',
'amount' => 56.4,
'base' => 470,
],
[
'kind' => 'valueAddedTax',
'amount' => 89.3,
'base' => 470,
],
],
'details' => [
[
'kind' => 'shipping',
'amount' => 47,
],
[
'kind' => 'tip',
'amount' => 47,
],
[
'kind' => 'subtotal',
'amount' => 940,
],
],
'currency' => 'USD',
'total' => 1076.3,
],
'items' => [
[
'sku' => 26443,
'name' => 'Qui voluptatem excepturi.',
'category' => 'physical',
'qty' => 1,
'price' => 940,
'tax' => 89.3,
],
],
'shipping' => [
'name' => 'Kellie Gerhold',
'surname' => 'Yost',
'email' => '[email protected]',
'documentType' => 'CC',
'document' => '1848839248',
'mobile' => '3006108300',
'address' => [
'street' => '703 Dicki Island Apt. 609',
'city' => 'North Randallstad',
'state' => 'Antioquia',
'postalCode' => '46292',
'country' => 'US',
'phone' => '363-547-1441 x383',
],
],
'allowPartial' => false,
],
'expiration' => date('c', strtotime('+1 hour')),
'ipAddress' => '127.0.0.1',
'userAgent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36',
'returnUrl' => 'http://dnetix.dev/p2p/client',
'cancelUrl' => 'https://dnetix.co',
'skipResult' => false,
'noBuyerFill' => false,
'captureAddress' => false,
'paymentMethod' => null,
];
try {
$placetopay = placetopay();
$response = $placetopay->request($request);
if ($response->isSuccessful()) {
// Redirect the client to the processUrl or display it on the JS extension
// $response->processUrl();
} else {
// There was some error so check the message
// $response->status()->message();
}
var_dump($response);
} catch (Exception $e) {
var_dump($e->getMessage());
}