commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-old / civicrm / packages / Google / demo / subscriptiondemo.php
1 <?php
2
3 /**
4 * Copyright (C) 2007 Google Inc.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18 /**
19 * This example creates 2 buttons one for a Google Handled subscription and one for a Merchant Handled
20 */
21 chdir("..");
22
23 require_once('library/googlecart.php');
24 require_once('library/googleitem.php');
25 require_once('library/googlesubscription.php');
26
27
28 MerchantSubscription();
29 GoogleSubscription();
30
31 function MerchantSubscription() {
32 echo "<h2>Merchant Handled Subscription Request</h2>";
33
34 $merchant_id = ""; // Your Merchant ID
35 $merchant_key = ""; // Your Merchant Key
36 $server_type = "sandbox"; // or production
37 $currency = "USD";
38
39 $cart = new GoogleCart($merchant_id, $merchant_key, $server_type, $currency);
40
41
42 $item = new GoogleItem("fee", "sign up fee", 1, 12.00);
43 $subscription_item = new GoogleSubscription("merchant", "DAILY", 30.00);
44
45 $item->SetSubscription($subscription_item);
46 $cart->AddItem($item);
47
48 echo $cart->CheckoutButtonCode("SMALL");
49 }
50
51 function GoogleSubscription() {
52 echo "<h2>Google Handled Subscription Request</h2>";
53
54 $merchant_id = ""; // Your Merchant ID
55 $merchant_key = ""; // Your Merchant Key
56 $server_type = "sandbox"; // or production
57 $currency = "USD";
58
59 $cart = new GoogleCart($merchant_id, $merchant_key, $server_type, $currency);
60
61 $item = new GoogleItem("fee", "sign up fee", 1, 12.00);
62 $subscription_item = new GoogleSubscription("google", "DAILY", 30.00);
63 $recurrent_item = new GoogleItem("fee", "recurring fee", 1, 30.00);
64 $subscription_item->SetItem($recurrent_item);
65 $item->SetSubscription($subscription_item);
66 $cart->AddItem($item);
67
68 echo $cart->CheckoutButtonCode("MEDIUM");
69
70 }
71 ?>