· 9 years ago · Sep 13, 2016, 03:04 PM
1public function subscribe(){
2
3 $stripe_keys = array(
4 "secret_key" => "sk_test_XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
5 "publishable_key" => "pk_test_XXXXXXXXXXXXXXXXXXXXXXXXXX"
6 );
7
8 $get = \Stripe\Stripe::setApiKey($stripe_keys["secret_key"]);
9
10 echo $get;
11
12 $gett = \Stripe\Token::create(array(
13 "card" => array(
14 "number" => "4000000000000077",
15 "exp_month" => 7,
16 "exp_year" => 2017,
17 "cvc" => "314"
18
19 )
20 ));
21
22
23 $create_cust = \Stripe\Customer::create(array(
24 "description" => "Customer for test@example.com",
25 "source" => $gett ,// obtained with Stripe.js
26 "plan" => "SSPRE02",
27 "email" => "rajat@test.com"// obtained with Stripe.js
28 ));
29
30
31
32 $new = \Stripe\Subscription::all();
33
34 $customer_array = $new->__toArray(true);
35 print_r($customer_array); exit;
36
37 }
38
39 }