-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgoogle-apple-pay-demo.html
More file actions
252 lines (233 loc) · 8.38 KB
/
google-apple-pay-demo.html
File metadata and controls
252 lines (233 loc) · 8.38 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
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="" />
<meta name="author" content="" />
<meta name="viewport" content="width=device-width" />
<title>Payload Google and Apple Pay</title>
<link rel="shortcut icon" href="https://payload.co/img/favicon.png" />
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
crossorigin="anonymous" />
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css"
integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk="
crossorigin="anonymous" />
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.20.0/themes/prism-okaidia.min.css"
integrity="sha256-iNIdqSl2o3Ge4o0EfZkhHY241Bb4iIBttf1jicmtaC4="
crossorigin="anonymous" />
<style>
.form-control {
box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}
.form-control.pl-input.pl-focus {
color: #495057;
background-color: #fff;
border-color: #80bdff;
outline: 0;
box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
outline: none;
}
.form-control.pl-input.pl-focus.is-invalid {
border-color: #dc3545;
box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}
.form-group label {
text-transform: uppercase;
}
.apple-pay-support {
display: none;
}
@supports (-webkit-appearance: -apple-pay-button) {
.apple-pay-support {
display: flex;
}
.apple-pay-button {
-webkit-appearance: -apple-pay-button;
}
.apple-pay-button-black {
-apple-pay-button-style: black;
}
.apple-pay-button-white {
-apple-pay-button-style: white;
}
.apple-pay-button-white-with-line {
-apple-pay-button-style: white-outline;
}
}
</style>
</head>
<body>
<nav class="navbar navbar-light bg-light fixed-top shadow-sm">
<div class="container">
<img
alt="Brand"
src="https://payload.co/img/logo.png"
height="100%"
style="width: 153.492px" />
</div>
</nav>
<div class="container" style="margin-top: 100px">
<main role="main" class="mt-4 rounded col col-lg-6 mx-auto p-0">
<div
class="mb-0 py-3 rounded-top text-light shadow position-relative"
style="background: #3485c5">
<div class="col mx-auto">
<h4 class="text-center my-0">Google & Apple Pay Demo</h4>
</div>
</div>
<form
id="checkout-form"
class="bg-light container p-md-5 p-4 rounded-bottom border shadow-sm"
pl-form="payment">
<div class="row">
<div class="form-group col-5 col-sm-4 px-1">
<label class="text-muted small">Amount</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">$</span>
</div>
<input
class="form-control"
pl-input="amount"
type="tel"
name="amount"
placeholder="Amount" />
</div>
</div>
<div class="form-group col px-1">
<label class="text-muted small">Cardholder Name</label>
<input
class="form-control w-100"
pl-input="account_holder"
type="text"
placeholder="First and Last" />
</div>
</div>
<div class="row pt-2">
<div class="form-group col px-1">
<label class="text-muted small">Card Details</label>
<div class="form-control" pl-input="card"></div>
</div>
</div>
<div
class="row pt-2 justify-content-between justify-content-sm-start">
<div class="col-0 pl-1">
<button class="btn btn-primary" type="submit">
Enter Card Details
</button>
</div>
<div class="col-0 px-1 text-muted align-self-center small">OR</div>
<div class="google-pay-support">
<div class="col-0">
<button
id="google-pay"
class="gpay-button black short"
type="button"></button>
</div>
</div>
<div class="apple-pay-support col row align-items-center">
<div class="col-0">
<div class="apple-pay-button apple-pay-button-black"></div>
</div>
</div>
</div>
</form>
<h4 class="mt-5 text-muted text-center">Dead Simple Integration</h4>
<p class="text-muted">
Integrating Google Pay and Apple Pay on the web in just a few lines of
javascript with <b>Payload.js</b> and
<a href="https://docs.payload.co/#secure-input" target="_blank"
>Secure Inputs</a
>.
</p>
<pre
class="shadow"><code class="language-html"><script src="https://payload.co/Payload.js"></script>
<script>
Payload('test_client_key_3bcr16ohAy8aEcwK3Vffs')
const checkout = new Payload.Form({
form: $('#checkout-form').get(0)
})
.applepay($('#apple-pay').get(0))
.googlepay($('#google-pay').get(0))
.on('processed', function(evt) {
console.log(evt.transaction_id)
})
</script></code></pre>
<div class="container">
<div class="row pt-3">
<div class="col px-1 text-muted">
<p>
See the
<a
href="https://github.com/payload-code/payload-code.github.io/blob/master/src/google-apple-pay-demo.html"
>full source code</a
>
for this demo on GitHub.
</p>
<p>
For more information on integrating Payload, see the complete
<a href="https://docs.payload.co">API Documentation</a>.
</p>
</div>
</div>
</div>
</main>
</div>
<div id="paid-modal" class="modal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Your Payment Was Successful!</h5>
<button
type="button"
class="close"
data-dismiss="modal"
aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<p>Thanks for trying out Payload!</p>
<p class="alert alert-secondary small"></p>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
data-dismiss="modal">
Close
</button>
</div>
</div>
</div>
</div>
<script
src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
crossorigin="anonymous"></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
crossorigin="anonymous"></script>
<script
src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
crossorigin="anonymous"></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.20.0/prism.min.js"
integrity="sha256-3teItwIfMuVB74Alnxw/y5HAZ2irOsCULFff3EgbtEs="
crossorigin="anonymous"></script>
<script src="https://pay.google.com/gp/p/js/pay.js"></script>
<script src="https://payload.co/Payload.js"></script>
<script src="/google-apple-pay-demo.js/"></script>
</body>
</html>