Ejemplo n.º 1
0
/*
try {
    $select_sql_3 = "SELECT `id` FROM `general_settings` WHERE `shop` = '" . $shop . "' ORDER BY `id` DESC LIMIT 1";
    $res3 = mysql_query($select_sql_3);
    if (mysql_num_rows($res3) <= 0) {
        mysql_query("insert into general_settings(`shop`,`display_related_product`,`product_number`,`heading_text`,`heading_color`,`heading_style`,`product_title_color`,`product_title_style`,`product_price_color`,`product_price_style`,`display_button`,`button_color`,`button_text`,`button_text_color`) VALUES('" . mysql_real_escape_string($shop) . "','1','5','Related Product','#000','normal','#000','normal','#000','normal','1','#000','View','#fff') ");
    }
   
} catch (Exception $ex) {
    
}*/
if (PLAN == 'paid') {
    $charge_id = $_GET['charge_id'];
    if ($shop != '' && $charge_id != '') {
        /* Recurring Charge Code Start */
        $charge_stat = $sc->call('GET', "/admin/recurring_application_charges/{$charge_id}.json");
        if ($charge_stat['status'] == 'accepted') {
            $billing_on = date("Y-m-d") . "T00:00:00+00:00";
            $create_at = date("Y-m-d\\TH:i:s") . "+05:30";
            $updated_at = date("Y-m-d\\TH:i:s") . "+05:30";
            $trial_ends_on = date("Y-m-d\\TH:i:s", strtotime("+7 days")) . "+05:30";
            $act_recurring_charge_arr = array("recurring_application_charge" => array("activated_on" => null, "billing_on" => $billing_on, "cancelled_on" => null, "created_at" => $create_at, "id" => $charge_id, "name" => "Standard Plan", "price" => PLAN_PRICE, "return_url" => SITE_URL . "/index.php", "status" => "accepted", "test" => PLAN_MODE, "trial_days" => PLAN_TRIAL, "trial_ends_on" => $trial_ends_on, "updated_at" => $updated_at));
            try {
                $act_recurring_charge_call = $sc->call('POST', "/admin/recurring_application_charges/{$charge_id}/activate.json", $act_recurring_charge_arr);
                $update_sql = "UPDATE `app` SET `payment_status` = 'accepted' WHERE `shop` = '" . $shop . "'";
                mysql_query($update_sql);
                /* Webhook for App Uninstall Track */
                $themes = $sc->call('GET', '/admin/themes.json');
                $active_theme_arr = loopAndFind($themes, 'role', 'main');
                $active_theme_id = $active_theme_arr[0]['id'];
                /* Webhook for App Uninstall Track */
Ejemplo n.º 2
0
<?php

// echo "signature: " . $_GET['signature'];
require __DIR__ . '/ShopifyApi/ShopifyClient.php';
session_start();
define("SHOPIFY_API_KEY", "");
define("SHOPIFY_SECRET", "");
$sc = new ShopifyClient($_SESSION['shop'], $_SESSION['token'], SHOPIFY_API_KEY, SHOPIFY_SECRET);
try {
    // Get all products
    $products = $sc->call('GET', '/admin/shop.json?page=1', array());
    echo "shop: " . $_SESSION['shop'];
    echo "<br/>token: " . $_SESSION['token'];
    echo "<br/>";
    echo "<pre>";
    var_dump($products);
    echo "</pre>";
} catch (ShopifyApiException $e) {
    /* 
             $e->getMethod() -> http method (GET, POST, PUT, DELETE)
             $e->getPath() -> path of failing request
             $e->getResponseHeaders() -> actually response headers from failing request
             $e->getResponse() -> curl response object
             $e->getParams() -> optional data that may have been passed that caused the failure
    */
}
Ejemplo n.º 3
0
     $res_arr = mysql_fetch_assoc($res);
     $token = $res_arr['token'];
     $payment_status = $res_arr['payment_status'];
     $app_status = $res_arr['app_status'];
     $id = $res_arr['id'];
 }
 if (($payment_status == 'accepted' || $payment_status == 'free') && $app_status == 'installed') {
     header("Location: admin/add_image.php?shop=" . $shop);
     exit;
 }
 if ($_SESSION['token'] != '') {
     $token = $_SESSION['token'];
 }
 $sc = new ShopifyClient($shop, $token, SHOPIFY_API_KEY, SHOPIFY_SECRET);
 $fields_arr = array("fields" => "myshopify_domain,domain");
 $shop_resp = $sc->call('GET', "/admin/shop.json", $fields_arr);
 $domain = preg_replace('/^www\\./', '', $shop_resp['domain']);
 $app_update_sql = "UPDATE `app` SET `shop_domain` = '" . $domain . "' WHERE `id` = '" . $id . "'";
 mysql_query($app_update_sql);
 $status_update_sql = "UPDATE `app` SET `app_status` = 'installed' WHERE `id` = '" . $id . "'";
 mysql_query($status_update_sql);
 if (PLAN == 'paid') {
     /*Recurring Charge Code Start*/
     $recurring_charge_arr = array("recurring_application_charge" => array("name" => "Standard Plan", "price" => PLAN_PRICE, "return_url" => SITE_URL . "/install.php?shop={$shop}", "trial_days" => PLAN_TRIAL, "test" => PLAN_MODE));
     $recurring_charge_call = $sc->call('POST', "/admin/recurring_application_charges.json", $recurring_charge_arr);
     session_unset();
     if (count($recurring_charge_call) > 0) {
         if ($recurring_charge_call['confirmation_url'] != '') {
             header("Location: " . $recurring_charge_call['confirmation_url']);
         }
     }