This repository has been archived by the owner on Jun 29, 2018. It is now read-only.
forked from siddarth/Stripe.com-Wordpress-Plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin_form.php
107 lines (93 loc) · 4.02 KB
/
admin_form.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
<?php
if($_POST) {
// Form data sent
$livePublicKey = $_POST['live_public_key'];
update_option('stripe_payment_live_public_key', $livePublicKey);
$liveSecretKey = $_POST['live_secret_key'];
update_option('stripe_payment_live_secret_key', $liveSecretKey);
$testPublicKey = $_POST['test_public_key'];
update_option('stripe_payment_test_public_key', $testPublicKey);
$testSecretKey = $_POST['test_secret_key'];
update_option('stripe_payment_test_secret_key', $testSecretKey);
$isLiveKeys = $_POST['is_live_keys'];
update_option('stripe_payment_is_live_keys', $isLiveKeys);
$currencySymbol = $_POST['currency_symbol'];
update_option('stripe_payment_currency_symbol', $currencySymbol);
$transPrefix = $_POST['trans_prefix'];
update_option('stripe_payment_trans_prefix', $transPrefix);
?>
<div class="updated"><p><strong><?php _e('Options saved.'); ?></strong></p></div>
<?php
} else {
// Normal page display
$livePublicKey = get_option('stripe_payment_live_public_key');
$liveSecretKey = get_option('stripe_payment_live_secret_key');
$testPublicKey = get_option('stripe_payment_test_public_key');
$testSecretKey = get_option('stripe_payment_test_secret_key');
$isLiveKeys = get_option('stripe_payment_is_live_keys');
$currencySymbol = get_option('stripe_payment_currency_symbol');
$transPrefix = get_option('stripe_payment_trans_prefix');
}
?>
<div id="stripe-payments-admin-wrap" class="wrap">
<h2>Stripe Payments - Options</h2>
<h4>Instructions</h4>
<div class="instructions">
<p>To add a payment form to a page or post use the following short code:</p>
<code>
[stripe_payment amount=100.0]
</code>
<ul>
<li><strong>amount</strong> - The amount that will be shown in the form.</li>
</ul>
</div>
<form name="stripe_payment_form" method="post" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>">
<p class="info">Log into <a href="http://stripe.com" target="_blank">stripe.com</a> to access your keys and determine the 3-letter ISO code for currency.</p>
<h4>Live Keys</h4>
<p>These keys are configured to a real account and <strong>will</strong> result in actual credit card charges.</p>
<ul>
<li>
<label for="live_public_key">Publishable Key:</label>
<input type="text" name="live_public_key" value="<?php echo $livePublicKey; ?>" />
</li>
<li>
<label for="live_secret_key">Secret Key:</label>
<input type="text" name="live_secret_key" value="<?php echo $liveSecretKey; ?>" />
</li>
</ul>
<h4>Test Keys</h4>
<p>These keys are configured to a test account and <strong>will not</strong> result in actual credit card charges.</p>
<ul>
<li>
<label for="test_public_key">Publishable Key:</label>
<input type="text" name="test_public_key" value="<?php echo $testPublicKey; ?>" />
</li>
<li>
<label for="test_secret_key">Secret Key:</label>
<input type="text" name="test_secret_key" value="<?php echo $testSecretKey; ?>" />
</li>
</ul>
<h4>Other</h4>
<p>The following string will stored as a prefix for all transactions processed by this plugin.</p>
<ul>
<li>
<label for="is_live">Use Live Keys?:</label>
<input type="checkbox" name="is_live_keys" <?php if($isLiveKeys){echo 'checked=checked';} ?> />
<span>Leave unchecked for testing. Check when you are ready to <strong>go live</strong>.</span>
</li>
<li>
<label for="currency_symbol">Currency Symbol:</label>
<input type="text" name="currency_symbol" value="<?php echo $currencySymbol; ?>" />
<span>Visit <a href="http://stripe.com">stripe.com</a> to determine the appropriate 3-letter ISO code. (e.g. usd)</span>
</li>
<li>
<label for="trans_prefix">Prefix:</label>
<input type="text" name="trans_prefix" value="<?php echo $transPrefix; ?>" />
<span>This will prefix all transactions in the stripe dashboard. (e.g. Terminal)</span>
</li>
</ul>
<p class="submit">
<input class="button-primary" type="submit" name="Submit" value="<?php _e('Save Options'); ?>" />
</p>
</form>
</div>