4 * Copyright (C) 2007 Google Inc.
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 * This example creates 2 buttons one for a Google Handled subscription and one for a Merchant Handled
23 require_once('library/googlecart.php');
24 require_once('library/googleitem.php');
25 require_once('library/googlesubscription.php');
28 MerchantSubscription();
31 function MerchantSubscription() {
32 echo "<h2>Merchant Handled Subscription Request</h2>";
34 $merchant_id = ""; // Your Merchant ID
35 $merchant_key = ""; // Your Merchant Key
36 $server_type = "sandbox"; // or production
39 $cart = new GoogleCart($merchant_id, $merchant_key, $server_type, $currency);
42 $item = new GoogleItem("fee", "sign up fee", 1, 12.00);
43 $subscription_item = new GoogleSubscription("merchant", "DAILY", 30.00);
45 $item->SetSubscription($subscription_item);
46 $cart->AddItem($item);
48 echo $cart->CheckoutButtonCode("SMALL");
51 function GoogleSubscription() {
52 echo "<h2>Google Handled Subscription Request</h2>";
54 $merchant_id = ""; // Your Merchant ID
55 $merchant_key = ""; // Your Merchant Key
56 $server_type = "sandbox"; // or production
59 $cart = new GoogleCart($merchant_id, $merchant_key, $server_type, $currency);
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);
68 echo $cart->CheckoutButtonCode("MEDIUM");