-
Notifications
You must be signed in to change notification settings - Fork 330
/
example_customize_box.php
940 lines (713 loc) · 54.9 KB
/
example_customize_box.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
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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
<?php
/**
* @category Example - Custom Payment Box (json format; customise your bitcoin/altcoin payment box with your own text / logo)
* @package GoUrl Cryptocurrency Payment API
* copyright (c) 2014-2024 Delta Consultants
* @desc GoUrl Crypto Payment Box Example (json, bootstrap4, mobile friendly, optional - free White Label Product - Bitcoin/altcoin Payments with your own logo and all payment requests through your server, open source)
* @crypto Supported Cryptocoins - Bitcoin, BitcoinCash, BitcoinSV, Litecoin, Dash, Dogecoin, Speedcoin, Reddcoin, Potcoin, Feathercoin, Vertcoin, Peercoin, MonetaryUnit, UniversalCurrency
* @website https://gourl.io/bitcoin-payment-gateway-api.html#p8
* @live_demo https://gourl.io/lib/examples/example_customize_box.php
* @note You can delete folders - 'Examples', 'Screenshots' from this archive
*/
/********************** NOTE - 2018-2024 YEARS *************************************************************************/
/***** *****/
/***** This is NEW 2018-2024 latest Bitcoin Payment Box Example (mobile friendly JSON payment box) *****/
/***** *****/
/***** You can generate php payment box code online - https://gourl.io/lib/examples/example_customize_box.php *****/
/***** White Label Product - https://gourl.io/lib/test/example_customize_box.php?method=curl&logo=custom *****/
/***** Light Theme - https://gourl.io/lib/examples/example_customize_box.php?theme=black *****/
/***** Black Theme - https://gourl.io/lib/examples/example_customize_box.php?theme=default *****/
/***** Your Own Logo - https://gourl.io/lib/examples/example_customize_box.php?theme=default&logo=custom *****/
/***** *****/
/***********************************************************************************************************************/
// Change path to your files
// --------------------------------------
DEFINE("CRYPTOBOX_PHP_FILES_PATH", "lib/"); // path to directory with files: cryptobox.class.php / cryptobox.callback.php / cryptobox.newpayment.php;
// cryptobox.newpayment.php will be automatically call through ajax/php two times - payment received/confirmed
DEFINE("CRYPTOBOX_IMG_FILES_PATH", "images/"); // path to directory with coin image files (directory 'images' by default)
DEFINE("CRYPTOBOX_JS_FILES_PATH", "js/"); // path to directory with files: ajax.min.js/support.min.js
// Change values below
// --------------------------------------
DEFINE("CRYPTOBOX_LANGUAGE_HTMLID", "alang"); // any value; customize - language selection list html id; change it to any other - for example 'aa'; default 'alang'
DEFINE("CRYPTOBOX_COINS_HTMLID", "acoin"); // any value; customize - coins selection list html id; change it to any other - for example 'bb'; default 'acoin'
DEFINE("CRYPTOBOX_PREFIX_HTMLID", "acrypto_"); // any value; prefix for all html elements; change it to any other - for example 'cc'; default 'acrypto_'
// Open Source Bitcoin Payment Library
// ---------------------------------------------------------------
require_once(CRYPTOBOX_PHP_FILES_PATH . "cryptobox.class.php" );
/*********************************************************/
/**** PAYMENT BOX CONFIGURATION VARIABLES ****/
/*********************************************************/
// IMPORTANT: Please read description of options here - https://gourl.io/api-php.html#options
$userID = ""; // place your registered userID or md5(userID) here (user1, user7, uo43DC, etc).
// You can use php $_SESSION["userABC"] for store userID, amount, etc
// You don't need to use userID for unregistered website visitors - $userID = "";
// if userID is empty, system will autogenerate userID and save it in cookies
$userFormat = "COOKIE"; // save userID in cookies (or you can use IPADDRESS, SESSION, MANUAL)
$orderID = "invoice1"; // invoice #1
$amountUSD = 0.10; // invoice amount - 0.10 USD; or you can use - $amountUSD = convert_currency_live("EUR", "USD", 22.37); // convert 22.37EUR to USD
$period = "NOEXPIRY"; // one time payment, not expiry
$def_language = "en"; // default Language in payment box
$def_coin = "bitcoin"; // default Coin in payment box
// List of coins that you accept for payments
//$coins = array('bitcoin', 'bitcoincash', 'bitcoinsv', 'litecoin', 'dogecoin', 'dash', 'speedcoin', 'reddcoin', 'potcoin', 'feathercoin', 'vertcoin', 'peercoin', 'monetaryunit', 'universalcurrency');
$coins = array('bitcoin', 'bitcoincash', 'litecoin', 'dogecoin'); // for example, accept payments in bitcoin, bitcoincash, litecoin, 'dogecoin', dash, speedcoin
// Create record for each your coin - https://gourl.io/editrecord/coin_boxes/0 ; and get free gourl keys
// It is not bitcoin wallet private keys! Place GoUrl Public/Private keys below for all coins which you accept
$all_keys = array( "bitcoin" => array("public_key" => "-your public key for Bitcoin box-", "private_key" => "-your private key for Bitcoin box-"),
"bitcoincash" => array("public_key" => "-your public key for BitcoinCash box-", "private_key" => "-your private key for BitcoinCash box-"),
"litecoin" => array("public_key" => "-your public key for Litecoin box-", "private_key" => "-your private key for Litecoin box-")); // etc.
// Demo Keys; for tests (example - 5 coins)
$all_keys = array( "bitcoin" => array("public_key" => "25654AAo79c3Bitcoin77BTCPUBqwIefT1j9fqqMwUtMI0huVL",
"private_key" => "25654AAo79c3Bitcoin77BTCPRV0JG7w3jg0Tc5Pfi34U8o5JE"),
"bitcoincash" => array("public_key" => "25656AAeOGaPBitcoincash77BCHPUBOGF20MLcgvHMoXHmMRx",
"private_key" => "25656AAeOGaPBitcoincash77BCHPRV8quZcxPwfEc93ArGB6D"),
"litecoin" => array("public_key" => "25657AAOwwzoLitecoin77LTCPUB4PVkUmYCa2dR770wNNstdk",
"private_key" => "25657AAOwwzoLitecoin77LTCPRV7hmp8s3ew6pwgOMgxMq81F"),
"dogecoin" => array("public_key" => "25678AACxnGODogecoin77DOGEPUBZEaJlR9W48LUYagmT9LU8",
"private_key" => "25678AACxnGODogecoin77DOGEPRVFvl6IDdisuWHVJLo5m4eq")); // Demo keys!
// IMPORTANT: Add in file /lib/cryptobox.config.php your database settings and your gourl.io coin private keys (need for Instant Payment Notifications) -
/* if you use demo keys above, please add to /lib/cryptobox.config.php -
$cryptobox_private_keys = array("25654AAo79c3Bitcoin77BTCPRV0JG7w3jg0Tc5Pfi34U8o5JE",
"25656AAeOGaPBitcoincash77BCHPRV8quZcxPwfEc93ArGB6D", "25657AAOwwzoLitecoin77LTCPRV7hmp8s3ew6pwgOMgxMq81F",
"25678AACxnGODogecoin77DOGEPRVFvl6IDdisuWHVJLo5m4eq", "25658AAo79c3Dash77DASHPRVG7w3jg0Tc5Pfi34U8o5JEiTss",
"20116AA36hi8Speedcoin77SPDPRVNOwjzYNqVn4Sn5XOwMI2c");
Also create table "crypto_payments" in your database, sql code - https://github.com/cryptoapi/Payment-Gateway#mysql-table
Instruction - https://gourl.io/api-php.html
*/
// Re-test - all gourl public/private keys
$def_coin = strtolower($def_coin);
if (!in_array($def_coin, $coins)) $coins[] = $def_coin;
foreach($coins as $v)
{
if (!isset($all_keys[$v]["public_key"]) || !isset($all_keys[$v]["private_key"])) die("Please add your public/private keys for '$v' in \$all_keys variable");
elseif (!strpos($all_keys[$v]["public_key"], "PUB")) die("Invalid public key for '$v' in \$all_keys variable");
elseif (!strpos($all_keys[$v]["private_key"], "PRV")) die("Invalid private key for '$v' in \$all_keys variable");
elseif (strpos(CRYPTOBOX_PRIVATE_KEYS, $all_keys[$v]["private_key"]) === false)
die("Please add your private key for '$v' in variable \$cryptobox_private_keys, file /lib/cryptobox.config.php.");
}
// Current selected coin by user
$coinName = cryptobox_selcoin($coins, $def_coin);
// Current Coin public/private keys
$public_key = $all_keys[$coinName]["public_key"];
$private_key = $all_keys[$coinName]["private_key"];
/** PAYMENT BOX **/
$options = array(
"public_key" => $public_key, // your public key from gourl.io
"private_key" => $private_key, // your private key from gourl.io
"webdev_key" => "", // optional, gourl affiliate key
"orderID" => $orderID, // order id or product name
"userID" => $userID, // unique identifier for every user
"userFormat" => $userFormat, // save userID in COOKIE, IPADDRESS, SESSION or MANUAL
"amount" => 0, // product price in btc/bch/bsv/ltc/doge/etc OR setup price in USD below
"amountUSD" => $amountUSD, // we use product price in USD
"period" => $period, // payment valid period
"language" => $def_language // text on EN - english, FR - french, etc
);
// Initialise Payment Class
$box = new Cryptobox ($options);
// coin name
$coinName = $box->coin_name();
// php code end :)
// ---------------------
// NOW PLACE IN FILE "lib/cryptobox.newpayment.php", function cryptobox_new_payment(..) YOUR ACTIONS -
// WHEN PAYMENT RECEIVED (update database, send confirmation email, update user membership, etc)
// IPN function cryptobox_new_payment(..) will automatically appear for each new payment two times - payment received and payment confirmed
// Read more - https://gourl.io/api-php.html#ipn
// Change payment box parameters online
// Code for demo page below
$page = "//".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]; // Current page url
$page .= (strpos($page, "?")) ? "&" : "?";
// Reset Settings
// ---------------------
if (isset($_GET["reset"]))
{
$cookies = explode(';', $_SERVER['HTTP_COOKIE']);
foreach($cookies as $cookie) {
$parts = explode('=', $cookie);
$name = trim($parts[0]);
setcookie($name, '', time()-1000);
setcookie($name, '', time()-1000, '/');
}
header("Location: //".$_SERVER["HTTP_HOST"].$_SERVER["SCRIPT_NAME"]);
echo "<script> window.location.href = '//".$_SERVER["HTTP_HOST"].$_SERVER["SCRIPT_NAME"]."'</script>";
die();
}
// Theme Selection
// ---------------------
if (isset($_GET["theme"]))
{
$theme = $_GET["theme"];
setcookie("dtheme", $theme);
}
else $theme = (isset($_COOKIE["dtheme"])) ? $_COOKIE["dtheme"] : "default";
if ($theme == "black") $css = '<link rel="stylesheet" href="https://bootswatch.com/4/darkly/bootstrap.css" crossorigin="anonymous">';
elseif ($theme == "greyred") $css = '<link rel="stylesheet" href="https://bootswatch.com/4/superhero/bootstrap.css" crossorigin="anonymous">';
elseif ($theme == "greygreen") $css = '<link rel="stylesheet" href="https://bootswatch.com/4/solar/bootstrap.css" crossorigin="anonymous">';
elseif ($theme == "whiteblue") $css = '<link rel="stylesheet" href="https://bootswatch.com/4/cerulean/bootstrap.css" crossorigin="anonymous">';
elseif ($theme == "whitered") $css = '<link rel="stylesheet" href="https://bootswatch.com/4/united/bootstrap.css" crossorigin="anonymous">';
elseif ($theme == "whitegreen") $css = '<link rel="stylesheet" href="https://bootswatch.com/4/flatly/bootstrap.css" crossorigin="anonymous">';
elseif ($theme == "whiteblack") $css = '<link rel="stylesheet" href="https://bootswatch.com/4/lux/bootstrap.css" crossorigin="anonymous">';
elseif ($theme == "whitepurple")$css = '<link rel="stylesheet" href="https://bootswatch.com/4/pulse/bootstrap.css" crossorigin="anonymous">';
elseif ($theme == "litera") $css = '<link rel="stylesheet" href="https://bootswatch.com/4/litera/bootstrap.css" crossorigin="anonymous">';
elseif ($theme == "minty") $css = '<link rel="stylesheet" href="https://bootswatch.com/4/minty/bootstrap.css" crossorigin="anonymous">';
elseif ($theme == "sandstone") $css = '<link rel="stylesheet" href="https://bootswatch.com/4/sandstone/bootstrap.css" crossorigin="anonymous">';
elseif ($theme == "sketchy") $css = '<link rel="stylesheet" href="https://bootswatch.com/4/sketchy/bootstrap.css" crossorigin="anonymous">';
else $css = '<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" crossorigin="anonymous">';
// If your website not use Bootstrap4 as main style, please use custom css style below.
// It isolate Bootstrap CSS to a particular class 'bootstrapiso' to avoid css conflicts with your site main css style
if ($theme == "black") $css2 = '<link rel="stylesheet" href="css/darkly.min.css" crossorigin="anonymous">';
elseif ($theme == "greyred") $css2 = '<link rel="stylesheet" href="css/superhero.min.css" crossorigin="anonymous">';
elseif ($theme == "greygreen") $css2 = '<link rel="stylesheet" href="css/solar.min.css" crossorigin="anonymous">';
elseif ($theme == "whiteblue") $css2 = '<link rel="stylesheet" href="css/cerulean.min.css" crossorigin="anonymous">';
elseif ($theme == "whitered") $css2 = '<link rel="stylesheet" href="css/united.min.css" crossorigin="anonymous">';
elseif ($theme == "whitegreen") $css2 = '<link rel="stylesheet" href="css/flatly.min.css" crossorigin="anonymous">';
elseif ($theme == "whiteblack") $css2 = '<link rel="stylesheet" href="css/lux.min.css" crossorigin="anonymous">';
elseif ($theme == "whitepurple")$css2 = '<link rel="stylesheet" href="css/pulse.min.css" crossorigin="anonymous">';
elseif ($theme == "litera") $css2 = '<link rel="stylesheet" href="css/litera.min.css" crossorigin="anonymous">';
elseif ($theme == "minty") $css2 = '<link rel="stylesheet" href="css/minty.min.css" crossorigin="anonymous">';
elseif ($theme == "sandstone") $css2 = '<link rel="stylesheet" href="css/sandstone.min.css" crossorigin="anonymous">';
elseif ($theme == "sketchy") $css2 = '<link rel="stylesheet" href="css/sketchy.min.css" crossorigin="anonymous">';
else $css2 = '<link rel="stylesheet" href="css/bootstrapcustom.min.css" crossorigin="anonymous">';
// -- End Theme ---------------------
// Box Type
// ---------------------
if (isset($_GET["boxtype"]))
{
$boxtype = $_GET["boxtype"];
setcookie("dboxtype", $boxtype);
}
else $boxtype = (isset($_COOKIE["dboxtype"])) ? $_COOKIE["dboxtype"] : "1";
$boxtype = intval($boxtype);
// payment received
if ($boxtype == "2" && !$box->is_paid())
{
$options = array(
"public_key" => "20AAvZCcgBitcoin77BTCPUB0xyyeKkxMUmeTJRWj7IZrbJ0oL", // your public key from gourl.io
"private_key" => "20AAvZCcgBitcoin77BTCPRVkW3K4eNMfYTIQGiYG1QYpOOP1n", // your private key from gourl.io
"webdev_key" => "", // optional, gourl affiliate key
"orderID" => "invoice1", // order id or product name
"userID" => "demo", // unique identifier for every user
"userFormat" => "MANUAL", // save userID in COOKIE, IPADDRESS or SESSION
"amount" => 0, // product price in coins OR in USD below
"amountUSD" => 0.1, // we use product price in USD
"period" => "NOEXPIRY", // payment valid period
"language" => $def_language // text on EN - english, FR - french, etc
);
// Re-Initialise Payment Class
$box = new Cryptobox ($options);
}
// -- End boxtype ---------------------
// Logo Selection
// ---------------------
if (isset($_GET["logo"]))
{
$logo = $_GET["logo"];
setcookie("dlogo", $logo);
}
else $logo = (isset($_COOKIE["dlogo"])) ? $_COOKIE["dlogo"] : "custom";
if ($logo == "custom") $logoimg_path = CRYPTOBOX_IMG_FILES_PATH.'your_logo.png';
elseif ($logo == "no") $logoimg_path = '';
else $logoimg_path = 'default';
// -- End logo ---------------------
// Logo Selection
// ---------------------
if (isset($_GET["lan"]))
{
$lan = $_GET["lan"];
setcookie("dlan", $lan);
}
else $lan = (isset($_COOKIE["dlan"])) ? $_COOKIE["dlan"] : "yes";
if ($lan == "yes") $show_languages = true;
else $show_languages = false;
// -- End lan ---------------------
// Coins Menu
// ---------------------
if (isset($_GET["numcoin"]))
{
$numcoin = $_GET["numcoin"];
setcookie("dnumcoin", $numcoin);
}
else $numcoin = (isset($_COOKIE["dnumcoin"])) ? $_COOKIE["dnumcoin"] : 6;
$numcoin = intval($numcoin);
if ($numcoin > 15) $numcoin = 6;
$coins = array_slice($coins, 0, $numcoin);
// -- End numcoin ---------------------
// Coin Images Size Menu
// ---------------------
if (isset($_GET["coinImageSize"]))
{
$coinImageSize = $_GET["coinImageSize"];
setcookie("dcoinImageSize", $coinImageSize);
}
else $coinImageSize = (isset($_COOKIE["dcoinImageSize"])) ? $_COOKIE["dcoinImageSize"] : 70;
$coinImageSize = intval($coinImageSize);
if ($coinImageSize > 200) $coinImageSize = 70;
if ($coinImageSize == 70 && in_array($theme, array("black", "greyred", "greygreen"))) $coinImageSize = 71;
// -- End coinImageSize ---------------------
// Coin Images Size Menu
// ---------------------
if (isset($_GET["qrcodeSize"]))
{
$qrcodeSize = $_GET["qrcodeSize"];
setcookie("dqrcodeSize", $qrcodeSize);
}
else $qrcodeSize = (isset($_COOKIE["dqrcodeSize"])) ? $_COOKIE["dqrcodeSize"] : 200;
$qrcodeSize = intval($qrcodeSize);
if ($qrcodeSize > 500) $qrcodeSize = 200;
// -- End qrcodeSize ---------------------
// Image on Result Page
// ---------------------
if (isset($_GET["resimage"]))
{
$resimage = $_GET["resimage"];
setcookie("dresimage", $resimage);
}
else $resimage = (isset($_COOKIE["dresimage"])) ? $_COOKIE["dresimage"] : "default";
if ($resimage == "image2") $resultimg_path = "images/paid2.png";
else if ($resimage == "image3") $resultimg_path = "images/paid3.png";
else if ($resimage == "custom") $resultimg_path = "images/your_logo_res.jpg";
else $resultimg_path = "default";
// -- End resimage ---------------------
// Image Size on Result Page
// ---------------------
if (isset($_GET["resultimgSize"]))
{
$resultimgSize = $_GET["resultimgSize"];
setcookie("dresultimgSize", $resultimgSize);
}
else $resultimgSize = (isset($_COOKIE["dresultimgSize"])) ? $_COOKIE["dresultimgSize"] : 250;
$resultimgSize = intval($resultimgSize);
if ($resultimgSize > 500) $resultimgSize = 250;
// -- End resultimgSize ---------------------
// Data Method (ajax or curl)
// ---------------------
if (isset($_GET["method"]))
{
$method = $_GET["method"];
setcookie("dmethod", $method);
}
else $method = (isset($_COOKIE["dmethod"])) ? $_COOKIE["dmethod"] : "curl";
if (!in_array($method, array("ajax", "curl"))) $method = "curl";
// -- End data method ---------------------
// Debug
// ---------------------
if (isset($_GET["deb"]))
{
$deb = $_GET["deb"];
setcookie("ddeb", $deb);
}
else $deb = (isset($_COOKIE["ddeb"])) ? $_COOKIE["ddeb"] : "yes";
if ($deb == "yes") $debug = true;
else $debug = false;
// -- End debug ---------------------
?>
<!-- More info - https://gourl.io/bitcoin-payment-gateway-api.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="">
<meta name="author" content="">
<title>GoUrl.io Bitcoin Payment for Bootstrap 4 (Customize/Mobile Friendly/JSON Box)</title>
<!-- Bootstrap CSS - -->
<?php echo $css; ?>
<!-- JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" crossorigin="anonymous"></script>
<script defer src="https://use.fontawesome.com/releases/v5.12.0/js/all.js" crossorigin="anonymous"></script>
<script src="<?php echo CRYPTOBOX_JS_FILES_PATH; ?>support.min.js?1" crossorigin="anonymous"></script>
<!-- Custom styles for crypto payment box, copy it to your file also -->
<style>
html { font-size: 14px; }
@media (min-width: 768px) { html { font-size: 16px; } .tooltip-inner { max-width: 350px; } }
.mncrpt .container { max-width: 980px; }
.mncrpt .box-shadow { box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05); }
img.radioimage-select { padding: 7px; border: solid 2px #ffffff; margin: 7px 1px; cursor: pointer; box-shadow: none; }
img.radioimage-select:hover { border: solid 2px #a5c1e5; }
img.radioimage-select.radioimage-checked { border: solid 2px #7db8d9; background-color: #f4f8fb; }
</style>
</head>
<body>
<div class='mncrpt'>
<div class="d-flex flex-column flex-md-row align-items-center card card-body bg-light border-bottom" style="border-bottom: 1px solid #e5e5e5;">
<h5 class="my-0 mr-md-auto font-weight-normal" style="line-height:30px"><b>GoUrl Crypto Payment Box Example</b> (json, bootstrap4, mobile friendly, optional - free <b><a target="_blank" href="https://www.google.com/search?q=white+label+product">White Label Product</a></b> - Bitcoin/altcoin Payments with your own logo and all payment requests through your server, open source).</h5>
<nav class="my-3 my-md-0 mr-md-3">
<a class="p-2" href="https://github.com/cryptoapi/Payment-Gateway/blob/master/example_basic.php">Page Source</a>
<a class="p-2" href="https://gourl.io/api-php.html">Instruction</a>
<a class="p-2" href="https://gourl.io/bitcoin-payment-gateway-api.html">Other Examples</a>
</nav>
<a class="btn btn-info" href="https://gourl.io">GoUrl.io</a>
</div>
<div class='mncrpt px-2 py-3 mx-auto my-4 text-center' style='max-width:1600px; white-space:normal'>
<br>
<div class='card card-body bg-light d-inline-block'>
<h1 class="display-4">Customize GoUrl Bitcoin/ Altcoin Payment Box (2024 year)</h1>
<p class='lead'>See live <a href='#dmgnpcode'>generated php/html code</a> for your website below (<a target="_blank" href="https://github.com/cryptoapi/Payment-Gateway">open source class</a>)</p>
<div id="dropdown1" class="d-inline-block dropdown mx-3 my-3">
<button class="btn btn-info dropdown-toggle" type="button" id="dropdownMenuButton1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Colour Themes
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton1">
<a class="dropdown-item<?php if ($theme == "default") echo " active"; ?>" href="<?php echo $page . "theme=default#b" ?>">Default</a>
<a class="dropdown-item<?php if ($theme == "black") echo " active"; ?>" href="<?php echo $page . "theme=black#b" ?>">Black</a>
<a class="dropdown-item<?php if ($theme == "greyred") echo " active"; ?>" href="<?php echo $page . "theme=greyred#b" ?>">LightGrey/Red</a>
<a class="dropdown-item<?php if ($theme == "greygreen") echo " active"; ?>" href="<?php echo $page . "theme=greygreen#b" ?>">DarkGrey/Green</a>
<a class="dropdown-item<?php if ($theme == "whiteblue") echo " active"; ?>" href="<?php echo $page . "theme=whiteblue#b" ?>">White/Blue</a>
<a class="dropdown-item<?php if ($theme == "whitered") echo " active"; ?>" href="<?php echo $page . "theme=whitered#b" ?>">White/Red</a>
<a class="dropdown-item<?php if ($theme == "whitegreen") echo " active"; ?>" href="<?php echo $page . "theme=whitegreen#b" ?>">White/Green</a>
<a class="dropdown-item<?php if ($theme == "sandstone") echo " active"; ?>" href="<?php echo $page . "theme=sandstone#b" ?>">White/Lime Green</a>
<a class="dropdown-item<?php if ($theme == "whiteblack") echo " active"; ?>" href="<?php echo $page . "theme=whiteblack#b" ?>">White/Black</a>
<a class="dropdown-item<?php if ($theme == "whitepurple") echo " active"; ?>" href="<?php echo $page . "theme=whitepurple#b" ?>">White/Purple</a>
<a class="dropdown-item<?php if ($theme == "litera") echo " active"; ?>" href="<?php echo $page . "theme=litera#b" ?>">Light Blue (Rounded)</a>
<a class="dropdown-item<?php if ($theme == "minty") echo " active"; ?>" href="<?php echo $page . "theme=minty#b" ?>">Light Green (Rounded)</a>
<a class="dropdown-item<?php if ($theme == "sketchy") echo " active"; ?>" href="<?php echo $page . "theme=sketchy#b" ?>">Sketchy :)</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" target="_blank" href="https://bootswatch.com/">More ...</a>
</div>
</div>
<div class="d-inline-block dropdown mx-3 my-3">
<button class="btn btn-info dropdown-toggle" type="button" id="dropdownMenuButton2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Payment Box Type
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton2">
<a class="dropdown-item<?php if ($boxtype == 1) echo " active"; ?>" href="<?php echo $page . "boxtype=1#b" ?>">Awaiting Payment</a>
<a class="dropdown-item<?php if ($boxtype == 2) echo " active"; ?>" href="<?php echo $page . "boxtype=2#b" ?>">Payment Received (demo)</a>
</div>
</div>
<div class="d-inline-block dropdown mx-3 my-3">
<button class="btn btn-info dropdown-toggle" type="button" id="dropdownMenuButton3" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Box Logo
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton3">
<a class="dropdown-item<?php if ($logo == "default") echo " active"; ?>" href="<?php echo $page . "logo=default#b" ?>">Default Logo</a>
<a class="dropdown-item<?php if ($logo == "custom") echo " active"; ?>" href="<?php echo $page . "logo=custom#b" ?>">Your Own Logo</a>
<a class="dropdown-item<?php if ($logo == "no") echo " active"; ?>" href="<?php echo $page . "logo=no#b" ?>">No Logo</a>
</div>
</div>
<div class="d-inline-block dropdown mx-3 my-3">
<button class="btn btn-info dropdown-toggle" type="button" id="dropdownMenuButton4" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Language Menu
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton4">
<a class="dropdown-item<?php if ($lan == "yes") echo " active"; ?>" href="<?php echo $page . "lan=yes#b" ?>">Show</a>
<a class="dropdown-item<?php if ($lan == "no") echo " active"; ?>" href="<?php echo $page . "lan=no#b" ?>">Hide</a>
</div>
</div>
<div class="d-inline-block dropdown mx-3 my-3">
<button class="btn btn-info dropdown-toggle" type="button" id="dropdownMenuButton5" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Coins Menu
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton5">
<a class="dropdown-item<?php if ($numcoin == 1) echo " active"; ?>" href="<?php echo $page . "numcoin=1#b" ?>">Single Coin</a>
<a class="dropdown-item<?php if ($numcoin == 2) echo " active"; ?>" href="<?php echo $page . "numcoin=2#b" ?>">Two Coins</a>
<a class="dropdown-item<?php if ($numcoin == 3) echo " active"; ?>" href="<?php echo $page . "numcoin=3#b" ?>">Three Coins</a>
<a class="dropdown-item<?php if ($numcoin == 4) echo " active"; ?>" href="<?php echo $page . "numcoin=4#b" ?>">Four Coins</a>
<a class="dropdown-item<?php if ($numcoin == 5) echo " active"; ?>" href="<?php echo $page . "numcoin=5#b" ?>">Five Coins</a>
<a class="dropdown-item<?php if ($numcoin == 6) echo " active"; ?>" href="<?php echo $page . "numcoin=6#b" ?>">Six Coins</a>
<a class="dropdown-item<?php if ($numcoin == 15) echo " active"; ?>" href="<?php echo $page. "numcoin=15#b" ?>">All Coins</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" target="_blank" href="https://github.com/cryptoapi/Payment-Gateway/tree/master/images">Edit images ...</a>
</div>
</div>
<div class="d-inline-block dropdown mx-3 my-3">
<button class="btn btn-info dropdown-toggle" type="button" id="dropdownMenuButton6" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Coin Images Size
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton6">
<a class="dropdown-item<?php if ($coinImageSize == 50) echo " active"; ?>" href="<?php echo $page . "coinImageSize=50#b" ?>">50px</a>
<a class="dropdown-item<?php if ($coinImageSize == 60) echo " active"; ?>" href="<?php echo $page . "coinImageSize=60#b" ?>">60px</a>
<a class="dropdown-item<?php if ($coinImageSize == 70 || $coinImageSize == 71) echo " active"; ?>" href="<?php echo $page . "coinImageSize=70#b" ?>">Default (70px)</a>
<a class="dropdown-item<?php if ($coinImageSize == 80) echo " active"; ?>" href="<?php echo $page . "coinImageSize=80#b" ?>">80px</a>
<a class="dropdown-item<?php if ($coinImageSize == 90) echo " active"; ?>" href="<?php echo $page . "coinImageSize=90#b" ?>">90px</a>
<a class="dropdown-item<?php if ($coinImageSize == 110) echo " active"; ?>" href="<?php echo $page . "coinImageSize=110#b" ?>">110px</a>
<a class="dropdown-item<?php if ($coinImageSize == 130) echo " active"; ?>" href="<?php echo $page . "coinImageSize=130#b" ?>">130px</a>
<a class="dropdown-item<?php if ($coinImageSize == 150) echo " active"; ?>" href="<?php echo $page . "coinImageSize=150#b" ?>">150px</a>
<a class="dropdown-item<?php if ($coinImageSize == 200) echo " active"; ?>" href="<?php echo $page. "coinImageSize=200#b" ?>">200px</a>
</div>
</div>
<div class="d-inline-block dropdown mx-3 my-3">
<button class="btn btn-info dropdown-toggle" type="button" id="dropdownMenuButton7" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
QR Code Size
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton7">
<a class="dropdown-item<?php if ($qrcodeSize == 0) echo " active"; ?>" href="<?php echo $page . "qrcodeSize=no&boxtype=1#b" ?>">Hide in Payment Box</a>
<a class="dropdown-item<?php if ($qrcodeSize == 50) echo " active"; ?>" href="<?php echo $page . "qrcodeSize=50&boxtype=1#b" ?>">50px</a>
<a class="dropdown-item<?php if ($qrcodeSize == 100) echo " active"; ?>" href="<?php echo $page . "qrcodeSize=100&boxtype=1#b" ?>">100px</a>
<a class="dropdown-item<?php if ($qrcodeSize == 150) echo " active"; ?>" href="<?php echo $page . "qrcodeSize=150&boxtype=1#b" ?>">150px</a>
<a class="dropdown-item<?php if ($qrcodeSize == 200) echo " active"; ?>" href="<?php echo $page. "qrcodeSize=200&boxtype=1#b" ?>">Default (200px)</a>
<a class="dropdown-item<?php if ($qrcodeSize == 250) echo " active"; ?>" href="<?php echo $page. "qrcodeSize=250&boxtype=1#b" ?>">250px</a>
<a class="dropdown-item<?php if ($qrcodeSize == 300) echo " active"; ?>" href="<?php echo $page. "qrcodeSize=300&boxtype=1#b" ?>">300px</a>
<a class="dropdown-item<?php if ($qrcodeSize == 350) echo " active"; ?>" href="<?php echo $page. "qrcodeSize=350&boxtype=1#b" ?>">350px</a>
<a class="dropdown-item<?php if ($qrcodeSize == 400) echo " active"; ?>" href="<?php echo $page. "qrcodeSize=400&boxtype=1#b" ?>">400px</a>
<a class="dropdown-item<?php if ($qrcodeSize == 450) echo " active"; ?>" href="<?php echo $page. "qrcodeSize=450&boxtype=1#b" ?>">450px</a>
<a class="dropdown-item<?php if ($qrcodeSize == 500) echo " active"; ?>" href="<?php echo $page. "qrcodeSize=500&boxtype=1#b" ?>">500px</a>
</div>
</div>
<div class="d-inline-block dropdown mx-3 my-3">
<button class="btn btn-info dropdown-toggle" type="button" id="dropdownMenuButton8" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Payment Received Image
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton8">
<a class="dropdown-item<?php if ($resimage == "default") echo " active"; ?>" href="<?php echo $page . "resimage=default&boxtype=2#b" ?>">Default Image</a>
<a class="dropdown-item<?php if ($resimage == "image2") echo " active"; ?>" href="<?php echo $page . "resimage=image2&boxtype=2#b" ?>">Image #2</a>
<a class="dropdown-item<?php if ($resimage == "image3") echo " active"; ?>" href="<?php echo $page . "resimage=image3&boxtype=2#b" ?>">Image #3</a>
<a class="dropdown-item<?php if ($resimage == "custom") echo " active"; ?>" href="<?php echo $page . "resimage=custom&boxtype=2#b" ?>">Your Own Image</a>
</div>
</div>
<div class="d-inline-block dropdown mx-3 my-3">
<button class="btn btn-info dropdown-toggle" type="button" id="dropdownMenuButton9" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Payment Res Image Size
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton9">
<a class="dropdown-item<?php if ($resultimgSize == 0) echo " active"; ?>" href="<?php echo $page . "resultimgSize=no&boxtype=2#b" ?>">Hide in Result Box</a>
<a class="dropdown-item<?php if ($resultimgSize == 50) echo " active"; ?>" href="<?php echo $page . "resultimgSize=50&boxtype=2#b" ?>">50px</a>
<a class="dropdown-item<?php if ($resultimgSize == 100) echo " active"; ?>" href="<?php echo $page . "resultimgSize=100&boxtype=2#b" ?>">100px</a>
<a class="dropdown-item<?php if ($resultimgSize == 150) echo " active"; ?>" href="<?php echo $page . "resultimgSize=150&boxtype=2#b" ?>">150px</a>
<a class="dropdown-item<?php if ($resultimgSize == 200) echo " active"; ?>" href="<?php echo $page. "resultimgSize=200&boxtype=2#b" ?>">200px</a>
<a class="dropdown-item<?php if ($resultimgSize == 250) echo " active"; ?>" href="<?php echo $page. "resultimgSize=250&boxtype=2#b" ?>">Default (250px)</a>
<a class="dropdown-item<?php if ($resultimgSize == 300) echo " active"; ?>" href="<?php echo $page. "resultimgSize=300&boxtype=2#b" ?>">300px</a>
<a class="dropdown-item<?php if ($resultimgSize == 350) echo " active"; ?>" href="<?php echo $page. "resultimgSize=350&boxtype=2#b" ?>">350px</a>
<a class="dropdown-item<?php if ($resultimgSize == 400) echo " active"; ?>" href="<?php echo $page. "resultimgSize=400&boxtype=2#b" ?>">400px</a>
<a class="dropdown-item<?php if ($resultimgSize == 450) echo " active"; ?>" href="<?php echo $page. "resultimgSize=450&boxtype=2#b" ?>">450px</a>
<a class="dropdown-item<?php if ($resultimgSize == 500) echo " active"; ?>" href="<?php echo $page. "resultimgSize=500&boxtype=2#b" ?>">500px</a>
</div>
</div>
<div class="d-inline-block dropdown mx-3 my-3">
<button class="btn btn-info dropdown-toggle" type="button" id="dropdownMenuButton10" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Data Methods (White Label/Ajax)
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton10">
<a class="dropdown-item<?php if ($method == "curl") echo " active"; ?>" href="<?php echo $page . "method=curl&boxtype=1#b" ?>"><b>CURL</b> + Your Own Logo (White Label Product), user need to click on button when payment is sent</a>
<a class="dropdown-item disabled" href="#a">curl - User browser receive payment data from your website only (not even know about gourl.io); your website receive data from our server gourl.io</a>
<a class="dropdown-item<?php if ($method == "ajax") echo " active"; ?>" href="<?php echo $page . "method=ajax&boxtype=1#b" ?>"><b>AJAX</b> - user don't need click any submit buttons</a>
<a class="dropdown-item disabled" href="#a">ajax - User browser receive payment data directly from our server and payment box show successful paid message automatically</a>
</div>
</div>
<div class="d-inline-block dropdown mx-3 my-3">
<button class="btn btn-info dropdown-toggle" type="button" id="dropdownMenuButton11" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Debug Raw Values Box
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton11">
<a class="dropdown-item<?php if ($deb == "yes") echo " active"; ?>" href="<?php echo $page . "deb=yes#b" ?>">Show</a>
<a class="dropdown-item<?php if ($deb == "no") echo " active"; ?>" href="<?php echo $page . "deb=no#b" ?>">Hide</a>
</div>
</div>
<div class="d-inline-block mx-3 my-3">
<a class="btn btn-secondary" href="<?php echo $page . "reset=yes" ?>" role="button">Reset All Settings</a>
</div>
</div>
</div>
</div>
<?php
if ($method == "curl" && !in_array($theme, array("black", "greyred", "greygreen"))) echo "<div class='text-center'><br><img style='max-width:100%; height:auto; width:auto\9;' alt='White Label Product' src='images/white-label.png'><br><br><br></div>";
echo "<a id='b'></a>"; // anchor for demo options only; don't need on live your server
// PAYMENT BOX
// --------------------------------------------------------
$custom_text = "<p class='lead'>Demo Text - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>";
$custom_text .= "<p class='lead'>Please contact us for any questions on [email protected]</p>";
// use function display_cryptobox_bootstrap ($coins = array(), $def_coin = "", $def_language = "en", $custom_text = "", $coinImageSize = 70, $qrcodeSize = 200, $show_languages = true, $logoimg_path = "default", $resultimg_path = "default", $resultimgSize = 250, $redirect = "", $method = "curl", $debug = false)
echo $box->display_cryptobox_bootstrap($coins, $def_coin, $def_language, $custom_text, $coinImageSize, $qrcodeSize, $show_languages, $logoimg_path, $resultimg_path, $resultimgSize, "", $method, $debug);
// End --------------------------------------------------------
?>
<?php if ($debug) { ?><div style="margin-top:-60px" class="text-center"><a href='<?php echo $page . "deb=no#b" ?>'>Hide Debug Log</a> <small>(or use dropdown <a href="#dropdown1">menu</a> above "Debug Raw Values Box")</small></div><?php } ?>
<div id='dmgnpcode' class='mncrpt px-2 py-3 mx-auto my-4 text-center' style='max-width:1450px; white-space:normal; display:none'>
<br><br><br><br>
<h1 class="display-6">Generated paymentbox php code for your website</h1>
<p class='lead'>create new php file with this code (default <a target="_blank" href="https://github.com/cryptoapi/Payment-Gateway">location</a> ); ready to use (php, json, bootstrap4, mobile friendly, white label product / your own logo). <a href='https://gourl.io/bitcoin-payment-gateway-api.html#p8'>Read instruction</a></p>
<div class="form-group my-4">
<textarea class="form-control bg-light" id="exampleFormControlTextarea1" rows="50" readonly>
<?php
// bitcoin/altcoin payment box; open source
// Change path to your files
// --------------------------------------
DEFINE("CRYPTOBOX_PHP_FILES_PATH", "lib/"); // path to directory with files: cryptobox.class.php / cryptobox.callback.php / cryptobox.newpayment.php;
// cryptobox.newpayment.php will be automatically call through ajax/php two times - payment received/confirmed
DEFINE("CRYPTOBOX_IMG_FILES_PATH", "images/"); // path to directory with coin image files (directory 'images' by default)
DEFINE("CRYPTOBOX_JS_FILES_PATH", "js/"); // path to directory with files: ajax.min.js/support.min.js
// Change values below
// --------------------------------------
DEFINE("CRYPTOBOX_LANGUAGE_HTMLID", "alang"); // any value; customize - language selection list html id; change it to any other - for example 'aa'; default 'alang'
DEFINE("CRYPTOBOX_COINS_HTMLID", "acoin"); // any value; customize - coins selection list html id; change it to any other - for example 'bb'; default 'acoin'
DEFINE("CRYPTOBOX_PREFIX_HTMLID", "acrypto_"); // any value; prefix for all html elements; change it to any other - for example 'cc'; default 'acrypto_'
// Open Source Bitcoin Payment Library
// ---------------------------------------------------------------
require_once(CRYPTOBOX_PHP_FILES_PATH . "cryptobox.class.php" );
/*********************************************************/
/**** PAYMENT BOX CONFIGURATION VARIABLES ****/
/*********************************************************/
// IMPORTANT: Please read description of options here - https://gourl.io/api-php.html#options
$userID = ""; // place your registered userID or md5(userID) here (user1, user7, uo43DC, etc).
// You can use php $_SESSION["userABC"] for store userID, amount, etc
// You don't need to use userID for unregistered website visitors - $userID = "";
// if userID is empty, system will autogenerate userID and save it in cookies
$userFormat = "COOKIE"; // save userID in cookies (or you can use IPADDRESS, SESSION, MANUAL)
$orderID = "invoice1"; // invoice number - 000383
$amountUSD = 2.21; // invoice amount - 2.21 USD; or you can use - $amountUSD = convert_currency_live("EUR", "USD", 22.37); // convert 22.37EUR to USD
$period = "NOEXPIRY"; // one time payment, not expiry
$def_language = "<?php echo CRYPTOBOX_LANGUAGE; ?>"; // default Language in payment box
$def_coin = "<?php echo strtolower($coinName); ?>"; // default Coin in payment box
// List of coins that you accept for payments
//$coins = array('bitcoin', 'bitcoincash', 'bitcoinsv', 'litecoin', 'dogecoin', 'dash', 'speedcoin', 'reddcoin', 'potcoin', 'feathercoin', 'vertcoin', 'peercoin', 'monetaryunit', 'universalcurrency');
$coins = array('bitcoin', 'litecoin', 'dogecoin'); // for example, accept payments in bitcoin, bitcoincash, litecoin, dash, speedcoin
<?php if ($numcoin == 1 && in_array($coinName, array('bitcoin', 'bitcoincash', 'litecoin', 'dogecoin'))) echo "\$coins = array(\"$coinName\"); // accept payments in $coinName only \n\r"; ?>
// Create record for each your coin - https://gourl.io/editrecord/coin_boxes/0 ; and get free gourl keys
// It is not bitcoin wallet private keys! Place GoUrl Public/Private keys below for all coins which you accept
$all_keys = array( "bitcoin" => array("public_key" => "-your public key for Bitcoin box-", "private_key" => "-your private key for Bitcoin box-"),
"bitcoincash" => array("public_key" => "-your public key for BitcoinCash box-", "private_key" => "-your private key for BitcoinCash box-"),
"litecoin" => array("public_key" => "-your public key for Litecoin box-", "private_key" => "-your private key for Litecoin box-")); // etc.
// Demo Keys; for tests (example - 5 coins)
$all_keys = array("bitcoin" => array( "public_key" => "25654AAo79c3Bitcoin77BTCPUBqwIefT1j9fqqMwUtMI0huVL",
"private_key" => "25654AAo79c3Bitcoin77BTCPRV0JG7w3jg0Tc5Pfi34U8o5JE"),
"bitcoincash" => array("public_key" => "25656AAeOGaPBitcoincash77BCHPUBOGF20MLcgvHMoXHmMRx",
"private_key" => "25656AAeOGaPBitcoincash77BCHPRV8quZcxPwfEc93ArGB6D"),
"litecoin" => array( "public_key" => "25657AAOwwzoLitecoin77LTCPUB4PVkUmYCa2dR770wNNstdk",
"private_key" => "25657AAOwwzoLitecoin77LTCPRV7hmp8s3ew6pwgOMgxMq81F"),
"dogecoin" => array( "public_key" => "25678AACxnGODogecoin77DOGEPUBZEaJlR9W48LUYagmT9LU8",
"private_key" => "25678AACxnGODogecoin77DOGEPRVFvl6IDdisuWHVJLo5m4eq")); // Demo keys!
// IMPORTANT: Add in file /lib/cryptobox.config.php your database settings and your gourl.io coin private keys (need for Instant Payment Notifications) -
/* if you use demo keys above, please add to /lib/cryptobox.config.php -
$cryptobox_private_keys = array("25654AAo79c3Bitcoin77BTCPRV0JG7w3jg0Tc5Pfi34U8o5JE", "25678AACxnGODogecoin77DOGEPRVFvl6IDdisuWHVJLo5m4eq",
"25656AAeOGaPBitcoincash77BCHPRV8quZcxPwfEc93ArGB6D", "25657AAOwwzoLitecoin77LTCPRV7hmp8s3ew6pwgOMgxMq81F",
"25678AACxnGODogecoin77DOGEPRVFvl6IDdisuWHVJLo5m4eq", "25658AAo79c3Dash77DASHPRVG7w3jg0Tc5Pfi34U8o5JEiTss",
"20116AA36hi8Speedcoin77SPDPRVNOwjzYNqVn4Sn5XOwMI2c");
Also create table "crypto_payments" in your database, sql code - https://github.com/cryptoapi/Payment-Gateway#mysql-table
Instruction - https://gourl.io/api-php.html
*/
// Re-test - all gourl public/private keys
$def_coin = strtolower($def_coin);
if (!in_array($def_coin, $coins)) $coins[] = $def_coin;
foreach($coins as $v)
{
if (!isset($all_keys[$v]["public_key"]) || !isset($all_keys[$v]["private_key"])) die("Please add your public/private keys for '$v' in \$all_keys variable");
elseif (!strpos($all_keys[$v]["public_key"], "PUB")) die("Invalid public key for '$v' in \$all_keys variable");
elseif (!strpos($all_keys[$v]["private_key"], "PRV")) die("Invalid private key for '$v' in \$all_keys variable");
elseif (strpos(CRYPTOBOX_PRIVATE_KEYS, $all_keys[$v]["private_key"]) === false)
die("Please add your private key for '$v' in variable \$cryptobox_private_keys, file /lib/cryptobox.config.php.");
}
// Current selected coin by user
$coinName = cryptobox_selcoin($coins, $def_coin);
// Current Coin public/private keys
$public_key = $all_keys[$coinName]["public_key"];
$private_key = $all_keys[$coinName]["private_key"];
/** PAYMENT BOX **/
$options = array(
"public_key" => $public_key, // your public key from gourl.io
"private_key" => $private_key, // your private key from gourl.io
"webdev_key" => "", // optional, gourl affiliate key
"orderID" => $orderID, // order id or product name
"userID" => $userID, // unique identifier for every user
"userFormat" => $userFormat, // save userID in COOKIE, IPADDRESS, SESSION or MANUAL
"amount" => 0, // product price in btc/bch/bsv/ltc/doge/etc OR setup price in USD below
"amountUSD" => $amountUSD, // we use product price in USD
"period" => $period, // payment valid period
"language" => $def_language // text on EN - english, FR - french, etc
);
// Initialise Payment Class
$box = new Cryptobox ($options);
// coin name
$coinName = $box->coin_name();
// php code end :)
// ---------------------
// NOW PLACE IN FILE "lib/cryptobox.newpayment.php", function cryptobox_new_payment(..) YOUR ACTIONS -
// WHEN PAYMENT RECEIVED (update database, send confirmation email, update user membership, etc)
// IPN function cryptobox_new_payment(..) will automatically appear for each new payment two times - payment received and payment confirmed
// Read more - https://gourl.io/api-php.html#ipn
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="">
<title>Payment Box</title>
<!-- Bootstrap4 CSS - -->
<?php echo $css; ?>
<!-- Note - If your website not use Bootstrap4 CSS as main style, please use custom css style below and delete css line above.
It isolate Bootstrap CSS to a particular class 'bootstrapiso' to avoid css conflicts with your site main css style -->
<!-- <?php echo $css2; ?> -->
<!-- JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" crossorigin="anonymous"></script>
<script defer src="https://use.fontawesome.com/releases/v5.12.0/js/all.js" crossorigin="anonymous"></script>
<script src="<?php echo CRYPTOBOX_JS_FILES_PATH; ?>support.min.js" crossorigin="anonymous"></script>
<!-- CSS for Payment Box -->
<style>
html { font-size: 14px; }
@media (min-width: 768px) { html { font-size: 16px; } .tooltip-inner { max-width: 350px; } }
.mncrpt .container { max-width: 980px; }
.mncrpt .box-shadow { box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05); }
img.radioimage-select { padding: 7px; border: solid 2px #ffffff; margin: 7px 1px; cursor: pointer; box-shadow: none; }
img.radioimage-select:hover { border: solid 2px #a5c1e5; }
img.radioimage-select.radioimage-checked { border: solid 2px #7db8d9; background-color: #f4f8fb; }
</style>
</head>
<body>
<?php
// Text above payment box
$custom_text = "<p class='lead'>Demo Text - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>";
$custom_text .= "<p class='lead'>Please contact us for any questions on [email protected]</p>";
// Display payment box
echo $box->display_cryptobox_bootstrap(<?php echo "\$coins, \$def_coin, \$def_language, \$custom_text, $coinImageSize, $qrcodeSize, ".($show_languages?"true":"false").", \"$logoimg_path\", \"$resultimg_path\", $resultimgSize, \"\", \"$method\", ".($debug?"true":"false"); ?>);
// You can setup method='curl' in function above and use code below on this webpage -
// if successful bitcoin payment received .... allow user to access your premium data/files/products, etc.
// if ($box->is_paid()) { ... your code here ... }
?>
</body>
</html></textarea>
</div>
<br>
<br><br>
<p><b>Next Steps</b></p>
<ul class="list-group">
<li class="list-group-item"><a target="_blank" href="https://gourl.io/lib/examples/box_only.php">1. View Payment Box Only (default settings, no menu, no footer)</a></li>
<li class="list-group-item"><a target="_blank" href="https://gourl.io/api-php.html">2. Payment Class Installation Instruction</a></li>
<li class="list-group-item"><a target="_blank" href="https://github.com/cryptoapi/Payment-Gateway">3. PHP Bitcoin Payment Class on GitHub (free open source)</a></li>
<li class="list-group-item"><a target="_blank" href="https://gourl.io/bitcoin-payment-gateway-api.html#p8">4. JSON Payment Box Instruction</a></li>
</ul>
</div>
<footer class="container pt-4 my-md-5 pt-md-5" style="border-top: 1px solid #e5e5e5;">
<div class="row">
<div class="col-12 col-md">
<img class="mb-2" src="https://getbootstrap.com/docs/4.4/assets/brand/bootstrap-solid.svg" alt="" width="24" height="24">
<small class="d-block mb-3 text-muted">© 2014-2024</small>
<br>
<div><a target="_blank" href="https://validator.w3.org/nu/?showsource=yes&doc=<?php echo "https://".$_SERVER[HTTP_HOST].urlencode($_SERVER[REQUEST_URI]); ?>"><img title="Markup Validation Service" src="https://gourl.io/images/w3c.png" alt="Valid HTML 5"></a></div>
</div>
<div class="col-6 col-md">
<h5>Features</h5>
<ul class="list-unstyled text-small">
<li><a class="text-muted" href="#a">Cool stuff</a></li>
<li><a class="text-muted" href="#a">Random feature</a></li>
<li><a class="text-muted" href="#a">Team feature</a></li>
<li><a class="text-muted" href="#a">Stuff for developers</a></li>
<li><a class="text-muted" href="#a">Another one</a></li>
<li><a class="text-muted" href="#a">Last time</a></li>
</ul>
</div>
<div class="col-6 col-md">
<h5>Resources</h5>
<ul class="list-unstyled text-small">
<li><a class="text-muted" href="#a">Resource</a></li>
<li><a class="text-muted" href="#a">Resource name</a></li>
<li><a class="text-muted" href="#a">Another resource</a></li>
<li><a class="text-muted" href="#a">Final resource</a></li>
</ul>
</div>
<div class="col-6 col-md">
<h5>About</h5>
<ul class="list-unstyled text-small">
<li><a class="text-muted" href="#a">Team</a></li>
<li><a class="text-muted" href="#a">Locations</a></li>
<li><a class="text-muted" href="#a">Privacy</a></li>
<li><a class="text-muted" href="#a">Terms</a></li>
</ul>
</div>
</div>
</footer>
</body>
</html>