-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_stripe.php
46 lines (38 loc) · 1.46 KB
/
test_stripe.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
<?php
include_once "config.php";
include_once "include/headernew.php";
try {
$stripeClassesDir = __DIR__ . '/Stripe/lib/';
$stripeUtilDir = $stripeClassesDir . 'Util/';
$stripeErrorDir = $stripeClassesDir . 'Error/';
set_include_path($stripeClassesDir . PATH_SEPARATOR . $stripeUtilDir . PATH_SEPARATOR . $stripeErrorDir);
function __autoload($class) {
$parts = explode('\\', $class);
require end($parts) . '.php';
}
\Stripe\Stripe::setApiKey('sk_test_0grA60KbtsaU2qHyycnz9P5F');
$charge = \Stripe\Transfer::create(array(
"amount" => '1950',
"currency" => "usd",
"recipient" => 'rp_16yJ9dKxyzah3hYNTDCmrCWc',
"card" =>'card_16yJBbKxyzah3hYNJi0qOnWO',
//"destination" => '',
"source_transaction" => 'ch_16z19MKxyzah3hYNpeBPTOYW',
"description" => "Transfer Successfully"
));
$data = $charge->__toArray(true);
echo "<pre>"; print_r($data);
} catch (Stripe_CardError $e) {
$error = $e->getMessage();
echo $error;
} catch (stripe_InvalidRequestError $e) {
$error = $e->getMessage();
echo $error;
} catch (stripe_AuthenticationError $e) {
$error = $e->getMessage();
echo $error;
} catch (Exception $e) {
$error = $e->getMessage();
echo $error;
}
?>