当前位置: 首页>>代码示例>>PHP>>正文


PHP Stripe::setApiVersion方法代码示例

本文整理汇总了PHP中Stripe::setApiVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP Stripe::setApiVersion方法的具体用法?PHP Stripe::setApiVersion怎么用?PHP Stripe::setApiVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Stripe的用法示例。


在下文中一共展示了Stripe::setApiVersion方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * @param string $apiKey
  * @param string $apiVersion
  */
 public function __construct($apiKey, $apiVersion = null)
 {
     $this->apiKey = $apiKey;
     $this->apiVersion = $apiVersion;
     \Stripe::setApiKey($this->apiKey);
     if ($this->apiVersion) {
         \Stripe::setApiVersion($this->apiVersion);
     }
 }
开发者ID:andywooyay,项目名称:KJPaymentStripeBundle,代码行数:13,代码来源:Client.php

示例2: init

 public function init()
 {
     require craft()->path->getPluginsPath() . 'charge/vendor/stripe/lib/Stripe.php';
     $plugin = craft()->plugins->getPlugin('charge');
     if (!$plugin) {
         throw new Exception('Couldn’t find the Charge plugin!');
     }
     $settings = $plugin->getSettings();
     $this->_mode = $settings->stripeAccountMode;
     $keyName = 'stripe' . ucwords($settings->stripeAccountMode) . 'CredentialsSK';
     if (isset($settings->{$keyName})) {
         \Stripe::setApiKey($settings->{$keyName});
     }
     \Stripe::setApiVersion($this->apiVersion);
 }
开发者ID:jamiepittock,项目名称:WhereForArt,代码行数:15,代码来源:ChargeService.php

示例3: __construct

 function __construct()
 {
     global $psts;
     //setup the Stripe API
     if (!class_exists('Stripe')) {
         require_once $psts->plugin_dir . "gateways/gateway-stripe-files/lib/Stripe.php";
     }
     $stripe_secret_key = $psts->get_setting('stripe_secret_key');
     Stripe::setApiKey($stripe_secret_key);
     // Stripe::setApiVersion( '2013-08-13' );
     Stripe::setApiVersion('2015-02-16');
     //make sure everyone is using the same API version. we can update this if/when necessary.
     if (!is_admin()) {
         add_action('wp_enqueue_scripts', array('ProSites_Gateway_Stripe', 'do_scripts'));
     }
     //settings
     add_action('psts_gateway_settings', array(&$this, 'settings'));
     add_action('psts_settings_process', array('ProSites_Gateway_Stripe', 'settings_process'), 10, 1);
     //checkout stuff
     add_filter('psts_force_ssl', array('ProSites_Gateway_Stripe', 'force_ssl'));
     //handle webhook notifications
     add_action('wp_ajax_nopriv_psts_stripe_webhook', array('ProSites_Gateway_Stripe', 'webhook_handler'));
     add_action('wp_ajax_psts_stripe_webhook', array('ProSites_Gateway_Stripe', 'webhook_handler'));
     //sync levels with Stripe
     add_action('update_site_option_psts_levels', array('ProSites_Gateway_Stripe', 'update_psts_levels'), 10, 3);
     //plug management page
     add_action('psts_subscription_info', array('ProSites_Gateway_Stripe', 'subscription_info'));
     add_action('psts_subscriber_info', array('ProSites_Gateway_Stripe', 'subscriber_info'));
     add_action('psts_modify_form', array('ProSites_Gateway_Stripe', 'modify_form'));
     add_action('psts_modify_process', array('ProSites_Gateway_Stripe', 'process_modify'));
     add_action('psts_transfer_pro', array('ProSites_Gateway_Stripe', 'process_transfer'), 10, 2);
     //filter payment info - Deprecated
     add_action('psts_payment_info', array('ProSites_Gateway_Stripe', 'payment_info'), 10, 2);
     //return next payment date for emails
     add_filter('psts_next_payment', array('ProSites_Gateway_Stripe', 'next_payment'));
     //cancel subscriptions on blog deletion
     add_action('delete_blog', array('ProSites_Gateway_Stripe', 'cancel_subscription'));
     //display admin notices
     add_action('admin_notices', array(&$this, 'admin_notices'));
     //transaction hooks
     add_filter('prosites_transaction_object_create', array('ProSites_Gateway_Stripe', 'create_transaction_object'), 10, 3);
     //update install script if necessary
     if ($psts->get_setting('stripe_version') != $psts->version) {
         $this->install();
     }
 }
开发者ID:vilmark,项目名称:vilmark_main,代码行数:46,代码来源:gateway-stripe.php

示例4: initialize

 public function initialize($credentials)
 {
     if (!function_exists('curl_init')) {
         throw new Exception('stripe needs the CURL PHP extension.');
     }
     $this->type = $credentials->type;
     $this->name = $credentials->name;
     $this->mode = $credentials->mode;
     $this->TRANSACTION_KEY = $credentials->fields['TRANSACTION_KEY'];
     $this->SECRET_KEY = $credentials->fields['SECRET_KEY'];
     Stripe::setApiKey($this->TRANSACTION_KEY);
     Stripe::setApiVersion("2014-11-05");
     if (trim($credentials->mode) == 'test') {
         $this->AUTHORIZENET_SANDBOX = 'true';
     } else {
         $this->AUTHORIZENET_SANDBOX = 'false';
     }
 }
开发者ID:jmangarret,项目名称:webtuagencia24,代码行数:18,代码来源:stripeProcessor.php

示例5: execute

 public function execute(\Payment $payment)
 {
     libraries_load('stripe-php');
     $context =& $payment->contextObj;
     $api_key = $payment->method->controller_data['private_key'];
     switch ($context->value('donation_interval')) {
         case 'm':
             $interval = 'month';
             break;
         case 'y':
             $interval = 'year';
             break;
         default:
             $interval = NULL;
             break;
     }
     try {
         \Stripe::setApiKey($api_key);
         \Stripe::setApiVersion('2014-01-31');
         $customer = $this->createCustomer($payment->method_data['stripe_payment_token'], $this->getName($context), $context->value('email'));
         $stripe = NULL;
         $plan_id = NULL;
         if (!$interval) {
             $stripe = $this->createCharge($customer, $payment);
         } else {
             $plan_id = $this->createPlan($customer, $payment, $interval);
             $stripe = $this->createSubscription($customer, $plan_id);
         }
         $payment->setStatus(new \PaymentStatusItem(PAYMENT_STATUS_SUCCESS));
         $payment->save();
         $params = array('pid' => $payment->pid, 'stripe_id' => $stripe->id, 'type' => $stripe->object, 'plan_id' => $plan_id);
         \Drupal::database()->insert('stripe_payment')->fields($params)->execute();
     } catch (\Stripe_Error $e) {
         $payment->setStatus(new \PaymentStatusItem(PAYMENT_STATUS_FAILED));
         $payment->save();
         $message = '@method payment method encountered an error while contacting ' . 'the stripe server. The status code "@status" and the error ' . 'message "@message". (pid: @pid, pmid: @pmid)';
         $variables = array('@status' => $e->getHttpStatus(), '@message' => $e->getMessage(), '@pid' => $payment->pid, '@pmid' => $payment->method->pmid, '@method' => $payment->method->title_specific);
         \Drupal::logger('stripe_payment')->error($message, []);
     }
 }
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:40,代码来源:CreditCardController.php

示例6: executeStripe

 public function executeStripe()
 {
     $response = null;
     $userData = new AB_UserBookingData($this->getParameter('form_id'));
     if ($userData->load()) {
         if ($userData->get('service_id')) {
             Stripe::setApiKey(get_option('ab_stripe_secret_key'));
             Stripe::setApiVersion("2014-10-07");
             $price = $userData->getFinalServicePrice() * $userData->get('number_of_persons');
             $stripe_data = array('number' => $this->getParameter('ab_card_number'), 'exp_month' => $this->getParameter('ab_card_month'), 'exp_year' => $this->getParameter('ab_card_year'), 'cvc' => $this->getParameter('ab_card_code'));
             try {
                 $charge = Stripe_Charge::create(array('card' => $stripe_data, 'amount' => intval($price * 100), 'currency' => get_option('ab_paypal_currency'), 'description' => "Charge for " . $userData->get('email')));
                 if ($charge->paid) {
                     $appointment = $userData->save();
                     $customer_appointment = new AB_CustomerAppointment();
                     $customer_appointment->loadBy(array('appointment_id' => $appointment->get('id'), 'customer_id' => $userData->getCustomerId()));
                     $payment = new AB_Payment();
                     $payment->set('total', $price);
                     $payment->set('type', 'stripe');
                     $payment->set('customer_appointment_id', $customer_appointment->get('id'));
                     $payment->set('created', current_time('mysql'));
                     $payment->save();
                     $response = array('status' => 'success');
                 } else {
                     $response = array('status' => 'error', 'error' => 'unknown error');
                 }
             } catch (Exception $e) {
                 $response = array('status' => 'error', 'error' => $e->getMessage());
             }
         }
     } else {
         $response = array('status' => 'error', 'error' => __('Session error.', 'bookly'));
     }
     // Output JSON response.
     wp_send_json($response);
 }
开发者ID:patrickcurl,项目名称:monks,代码行数:36,代码来源:AB_StripeController.php

示例7: process_payment

 public function process_payment($order_id)
 {
     global $woocommerce;
     $wc_order = new WC_Order($order_id);
     $grand_total = $wc_order->order_total;
     $amount = (int) $grand_total;
     include plugin_dir_path(__FILE__) . "lib/Stripe.php";
     Stripe::setApiKey($this->stripe_secretkey);
     Stripe::setApiVersion("2014-06-17");
     $token_id = Stripe_Token::create(array("card" => array("number" => $_POST['cardno_stripe'], "exp_month" => $_POST['expmonth_stripe'], "exp_year" => $_POST['expyear_stripe'], "cvc" => $_POST['cardcvv_stripe'])));
     $charge = Stripe_Charge::create(array("amount" => $amount, "currency" => "USD", "card" => $token_id->id, "metadata" => array("order_id" => $order_id)));
     if ($token_id->id != '') {
         if ($charge->paid == true) {
             $wc_order->add_order_note(__(' Stripe payment completed. ', 'woocommerce'));
             $wc_order->payment_complete();
             return array('result' => 'success', 'redirect' => $this->get_return_url($wc_order));
         } else {
             $wc_order->add_order_note(__('Stripe payment failed. Payment declined.', 'woocommerce'));
             $woocommerce->add_error(__('Sorry, the transaction was declined.', 'woocommerce'));
         }
     } else {
         $wc_order->add_order_note(__('Stripe payment failed. Payment declined. Please Check your Admin settings', 'woocommerce'));
         $woocommerce->add_error(__('Sorry, the transaction was declined. Please Check your Admin settings', 'woocommerce'));
     }
 }
开发者ID:raminabsari,项目名称:phonicsschool,代码行数:25,代码来源:woocommerce-stripe.php

示例8:

<?php

// map class name to file
Autoloader::map(array('Stripe' => __DIR__ . '/lib/Stripe.php'));
Stripe::setApiKey(Config::get('stripe.api_key', ''));
Stripe::setApiVersion(Config::get('stripe.api_version', ''));
开发者ID:SerdarSanri,项目名称:laravel-stripe-php-bundle,代码行数:6,代码来源:start.php

示例9: onPaymentNotification

 function onPaymentNotification(&$statuses)
 {
     if (!$this->init()) {
         return false;
     }
     $order_id = (int) $_REQUEST['orderid'];
     $dbOrder = $this->getOrder($order_id);
     $this->loadPaymentParams($dbOrder);
     if (empty($this->payment_params)) {
         echo 'The system can\'t load the payment params';
         return false;
     }
     $this->loadOrderData($dbOrder);
     $return_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=after_end&order_id=' . $order_id . $this->url_itemid;
     $cancel_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=order&task=cancel_order&order_id=' . $order_id . $this->url_itemid;
     $currency = $this->currency->currency_code;
     $amout = round($dbOrder->order_full_price, 2) * 100;
     $desc = JText::sprintf('ORDER_NUMBER') . ' : ' . $order_id;
     Stripe::setApiKey(trim($this->payment_params->secret_key));
     Stripe::setApiVersion('2013-12-03');
     $token = $_POST['stripeToken'];
     try {
         $charge = Stripe_Charge::create(array("amount" => $amout, "currency" => $currency, "card" => $token, "description" => $desc));
     } catch (Exception $e) {
         $this->modifyOrder($order_id, $this->payment_params->invalid_status, true, true);
         $this->app->redirect($cancel_url, 'Error charge : ' . $e->getMessage());
         return false;
     }
     $this->modifyOrder($order_id, $this->payment_params->verified_status, true, true);
     $this->app->redirect($return_url);
     return true;
 }
开发者ID:rodhoff,项目名称:MNW,代码行数:32,代码来源:stripe.php


注:本文中的Stripe::setApiVersion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。