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


PHP Stripe_Charge::retrieve方法代码示例

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


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

示例1: run

 function run()
 {
     //Get the data from stripe
     $data_raw = file_get_contents("php://input");
     $data = json_decode($data_raw);
     if (!$data) {
         CRM_Core_Error::Fatal("Stripe Callback: cannot json_decode data, exiting. <br /> {$data}");
     }
     $test_mode = !$data->livemode;
     $stripe_key = CRM_Core_DAO::singleValueQuery("SELECT user_name FROM civicrm_payment_processor WHERE payment_processor_type = 'Stripe' AND is_test = '{$test_mode}'");
     require_once "packages/stripe-php/lib/Stripe.php";
     Stripe::setApiKey($stripe_key);
     //Retrieve Event from Stripe using ID even though we already have the values now.
     //This is for extra security precautions mentioned here: https://stripe.com/docs/webhooks
     $stripe_event_data = Stripe_Event::retrieve($data->id);
     $customer_id = $stripe_event_data->data->object->customer;
     switch ($stripe_event_data->type) {
         //Successful recurring payment
         case 'invoice.payment_succeeded':
             //Get the Stripe charge object
             try {
                 $charge = Stripe_Charge::retrieve($stripe_event_data->data->object->charge);
             } catch (Exception $e) {
                 CRM_Core_Error::Fatal("Failed to retrieve Stripe charge.  Message: " . $e->getMessage());
                 break;
             }
             //Find the recurring contribution in CiviCRM by mapping it from Stripe
             $rel_info_query = CRM_Core_DAO::executeQuery("SELECT invoice_id, end_time FROM civicrm_stripe_subscriptions WHERE customer_id = '{$customer_id}'");
             if (!empty($rel_info_query)) {
                 $rel_info_query->fetch();
                 $invoice_id = $rel_info_query->invoice_id;
                 $end_time = $rel_info_query->end_time;
             } else {
                 CRM_Core_Error::Fatal("Error relating this customer ({$customer_id}) to the one in civicrm_stripe_subscriptions");
             }
             //Compare against now + 24hrs to prevent charging 1 extra day.
             $time_compare = time() + 86400;
             //Fetch Civi's info about this recurring object
             $recur_contrib_query = CRM_Core_DAO::executeQuery("SELECT id, contact_id, currency, contribution_status_id, is_test, contribution_type_id, payment_instrument_id, campaign_id FROM civicrm_contribution_recur WHERE invoice_id = '{$invoice_id}'");
             if (!empty($recur_contrib_query)) {
                 $recur_contrib_query->fetch();
             } else {
                 CRM_Core_Error::Fatal("ERROR: Stripe triggered a Webhook on an invoice not found in civicrm_contribution_recur: " . $stripe_event_data);
             }
             //Build some params
             $stripe_customer = Stripe_Customer::retrieve($customer_id);
             $recieve_date = date("Y-m-d H:i:s", $charge->created);
             $total_amount = $charge->amount / 100;
             $fee_amount = $charge->fee / 100;
             $net_amount = $total_amount - $fee_amount;
             $transaction_id = $charge->id;
             $new_invoice_id = $stripe_event_data->data->object->id;
             if (empty($recur_contrib_query->campaign_id)) {
                 $recur_contrib_query->campaign_id = 'NULL';
             }
             $first_contrib_check = CRM_Core_DAO::singleValueQuery("SELECT id FROM civicrm_contribution WHERE invoice_id = '{$invoice_id}' AND contribution_status_id = '2'");
             if (!empty($first_contrib_check)) {
                 CRM_Core_DAO::executeQuery("UPDATE civicrm_contribution SET contribution_status_id = '1' WHERE id = '{$first_contrib_check}'");
                 return;
             }
             //Create this instance of the contribution for accounting in CiviCRM
             CRM_Core_DAO::executeQuery("\n        \tINSERT INTO civicrm_contribution (\n        \tcontact_id, contribution_type_id, payment_instrument_id, receive_date, \n        \ttotal_amount, fee_amount, net_amount, trxn_id, invoice_id, currency,\n        \tcontribution_recur_id, is_test, contribution_status_id, campaign_id\n        \t) VALUES (\n        \t'{$recur_contrib_query->contact_id}', '{$recur_contrib_query->contribution_type_id}', '{$recur_contrib_query->payment_instrument_id}', '{$recieve_date}', \n        \t'{$total_amount}', '{$fee_amount}', '{$net_amount}', '{$transaction_id}', '{$new_invoice_id}', '{$recur_contrib_query->currency}', \n        \t'{$recur_contrib_query->id}', '{$recur_contrib_query->is_test}', '1', {$recur_contrib_query->campaign_id}\n        \t)");
             if ($time_compare > $end_time) {
                 $end_date = date("Y-m-d H:i:s", $end_time);
                 //Final payment.  Recurring contribution complete
                 $stripe_customer->cancelSubscription();
                 CRM_Core_DAO::executeQuery("DELETE FROM civicrm_stripe_subscriptions WHERE invoice_id = '{$invoice_id}'");
                 CRM_Core_DAO::executeQuery("UPDATE civicrm_contribution_recur SET end_date = '{$end_date}', contribution_status_id = '1' WHERE invoice_id = '{$invoice_id}'");
                 return;
             }
             //Successful charge & more to come so set recurring contribution status to In Progress
             if ($recur_contrib_query->contribution_status_id != 5) {
                 CRM_Core_DAO::executeQuery("UPDATE civicrm_contribution_recur SET contribution_status_id = 5 WHERE invoice_id = '{$invoice_id}'");
                 return;
             }
             break;
             //Failed recurring payment
         //Failed recurring payment
         case 'invoice.payment_failed':
             //Get the Stripe charge object
             try {
                 $charge = Stripe_Charge::retrieve($stripe_event_data->data->object->charge);
             } catch (Exception $e) {
                 CRM_Core_Error::Fatal("Failed to retrieve Stripe charge.  Message: " . $e->getMessage());
                 break;
             }
             //Find the recurring contribution in CiviCRM by mapping it from Stripe
             $invoice_id = CRM_Core_DAO::singleValueQuery("SELECT invoice_id FROM civicrm_stripe_subscriptions WHERE customer_id = '{$customer_id}'");
             if (empty($invoice_id)) {
                 CRM_Core_Error::Fatal("Error relating this customer ({$customer_id}) to the one in civicrm_stripe_subscriptions");
             }
             //Fetch Civi's info about this recurring object
             $recur_contrib_query = CRM_Core_DAO::executeQuery("SELECT id, contact_id, currency, contribution_status_id, is_test, contribution_type_id, payment_instrument_id, campaign_id FROM civicrm_contribution_recur WHERE invoice_id = '{$invoice_id}'");
             if (!empty($recur_contrib_query)) {
                 $recur_contrib_query->fetch();
             } else {
                 CRM_Core_Error::Fatal("ERROR: Stripe triggered a Webhook on an invoice not found in civicrm_contribution_recur: " . $stripe_event_data);
             }
             //Build some params
             $recieve_date = date("Y-m-d H:i:s", $charge->created);
//.........这里部分代码省略.........
开发者ID:peteainsworth,项目名称:bccgb_civicrm_custom,代码行数:101,代码来源:Webhook.php

示例2: testRetrieve

 public function testRetrieve()
 {
     authorizeFromEnv();
     $c = Stripe_Charge::create(array('amount' => 100, 'currency' => 'usd', 'card' => array('number' => '4242424242424242', 'exp_month' => 5, 'exp_year' => 2015)));
     $d = Stripe_Charge::retrieve($c->id);
     $this->assertEqual($d->id, $c->id);
 }
开发者ID:bulats,项目名称:chef,代码行数:7,代码来源:ChargeTest.php

示例3: testUpdateMetadataAll

 public function testUpdateMetadataAll()
 {
     authorizeFromEnv();
     $charge = Stripe_Charge::create(array('amount' => 100, 'currency' => 'usd', 'card' => array('number' => '4242424242424242', 'exp_month' => 5, 'exp_year' => 2015)));
     $charge->metadata = array('test' => 'foo bar');
     $charge->save();
     $updatedCharge = Stripe_Charge::retrieve($charge->id);
     $this->assertEqual('foo bar', $updatedCharge->metadata['test']);
 }
开发者ID:mickdane,项目名称:zidisha,代码行数:9,代码来源:ChargeTest.php

示例4: markAsSafe

 public function markAsSafe()
 {
     self::authorizeFromEnv();
     $card = array('number' => '4242424242424242', 'exp_month' => 5, 'exp_year' => 2015);
     $charge = Stripe_Charge::create(array('amount' => 100, 'currency' => 'usd', 'card' => $card));
     $charge->markAsSafe();
     $updatedCharge = Stripe_Charge::retrieve($charge->id);
     $this->assertEqual('safe', $updatedCharge['fraud_details']['user_report']);
 }
开发者ID:hoa32811,项目名称:wp_thanhtrung_hotel,代码行数:9,代码来源:ChargeTest.php

示例5: get_transaction

 public function get_transaction($transaction_id)
 {
     try {
         $ch = Stripe_Charge::retrieve($transaction_id);
         return $ch;
     } catch (Exception $e) {
         $this->error = TRUE;
         $this->message = $e->getMessage();
         $this->code = $e->getCode();
         return FALSE;
     }
 }
开发者ID:NimzyMaina,项目名称:sma,代码行数:12,代码来源:Stripe_payments.php

示例6: refund

 public function refund(Varien_Object $payment, $amount)
 {
     $transactionId = $payment->getParentTransactionId();
     try {
         Stripe_Charge::retrieve($transactionId)->refund();
     } catch (Exception $e) {
         $this->debugData($e->getMessage());
         Mage::throwException(Mage::helper('paygate')->__('Payment refunding error.'));
     }
     $payment->setTransactionId($transactionId . '-' . Mage_Sales_Model_Order_Payment_Transaction::TYPE_REFUND)->setParentTransactionId($transactionId)->setIsTransactionClosed(1)->setShouldCloseParentTransaction(1);
     return $this;
 }
开发者ID:FaisalRiaz115,项目名称:Inchoo_Stripe,代码行数:12,代码来源:Payment.php

示例7: post

 public function post()
 {
     $this->authenticate();
     $attendance = $this->app->db->queryRow('SELECT * FROM attendance WHERE person_id=%d AND event_id=%d', $this->person['id'], $this->event['id']);
     // Set your secret key: remember to change this to your live secret key in production
     // See your keys here https://dashboard.stripe.com/account
     \Stripe::setApiKey($this->app->config->stripe->secret_key);
     try {
         $ch = \Stripe_Charge::retrieve($attendance['ticket_id']);
         $re = $ch->refunds->create();
         $this->app->db->query('DELETE FROM attendance WHERE person_id=%d AND event_id=%d', $this->person['id'], $this->event['id']);
         $this->resp->setJSON(true);
     } catch (\Stripe_CardError $e) {
         $this->resp->setJSON($e->getMessage());
     }
 }
开发者ID:phamann,项目名称:edgeconf,代码行数:16,代码来源:BillingCancelController.php

示例8: stripe_refund

function stripe_refund($params)
{
    require_once 'stripe/Stripe.php';
    $gatewaytestmode = $params["testmode"];
    if ($gatewaytestmode == "on") {
        Stripe::setApiKey($params['private_test_key']);
    } else {
        Stripe::setApiKey($params['private_live_key']);
    }
    # Invoice Variables
    $transid = $params['transid'];
    # Perform Refund
    try {
        $ch = Stripe_Charge::retrieve($transid);
        $ch->refund();
        return array("status" => "success", "transid" => $ch["id"], "rawdata" => $ch);
    } catch (Exception $e) {
        $response['error'] = $e->getMessage();
        return array("status" => "error", "rawdata" => $response['error']);
    }
}
开发者ID:wallydz,项目名称:whmcs-stripe,代码行数:21,代码来源:stripe.php

示例9: post

 public function post()
 {
     $this->app->db->query('START TRANSACTION');
     // Get the next event
     $event = $this->app->db->queryRow('SELECT * FROM events WHERE end_time > NOW() ORDER BY start_time ASC LIMIT 1');
     $personid = $this->req->getPost('person_id');
     $person = $this->app->db->queryRow('SELECT * FROM people WHERE id=%d', $personid);
     $attendance = $this->app->db->queryRow('SELECT * FROM attendance WHERE person_id=%d AND event_id=%d', $personid, $event['id']);
     if ($this->req->getPost('action') === 'invite') {
         $code = substr(str_shuffle('QWERTYUIOPASDFGHJKLZXCVBNM1234567890'), 0, 20);
         $viewdata = array('summary' => "You're invited to Edge: claim your ticket now", 'person' => $person, 'event' => $event, 'attendance' => $attendance, 'code' => $code);
         $htmloutput = $this->app->view->render('emails/invite.html', $viewdata);
         $textoutput = $this->app->view->render('emails/invite.txt', $viewdata);
         $this->app->db->query("UPDATE attendance SET invite_date_sent=NOW(), invite_code=%s WHERE person_id=%d AND event_id=%d", $code, $personid, $event['id']);
         $this->sendEmail($person['email'], 'Invite to Edge conf', $textoutput, $htmloutput);
         $this->alert('info', 'Sent invite to ' . $person['email']);
     } else {
         if (isset($_POST['action']) and $_POST['action'] == 'remind') {
             $this->app->db->query("UPDATE attendance SET invite_date_reminded=NOW() WHERE person_id=%d AND event_id=%d", $personid, $event['id']);
             $viewdata = array('person' => $person, 'event' => $event, 'code' => $this->app->db->querySingle("SELECT invite_code FROM attendance WHERE person_id=%d AND event_id=%d", $personid, $event['id']));
             $htmloutput = $this->app->view->render('emails/reminder.html', $viewdata);
             $textoutput = $this->app->view->render('emails/reminder.txt', $viewdata);
             $this->sendEmail($person['email'], 'Reminder: Edge conf invite', $textoutput, $htmloutput);
             $this->alert('info', 'Sent reminder to ' . $person['email']);
         } else {
             if (isset($_POST['action']) and $_POST['action'] == 'cancel') {
                 \Stripe::setApiKey($this->app->config->stripe->secret_key);
                 try {
                     $ch = \Stripe_Charge::retrieve($attendance['ticket_id']);
                     $re = $ch->refunds->create();
                     $this->app->db->query('DELETE FROM attendance WHERE person_id=%d AND event_id=%d', $personid, $event['id']);
                 } catch (\Stripe_CardError $e) {
                     $this->resp->setStatus(500);
                     $this->resp->setJSON($e->getMessage());
                 }
             }
         }
     }
     $this->app->db->query("COMMIT");
 }
开发者ID:phamann,项目名称:edgeconf,代码行数:40,代码来源:InviteController.php

示例10: stripe_retrieve_charge

 public function stripe_retrieve_charge($charge_id)
 {
     return Stripe_Charge::retrieve($charge_id);
 }
开发者ID:puttyplayer,项目名称:CSGOShop,代码行数:4,代码来源:Payment.class.php

示例11: striper_order_status_completed

function striper_order_status_completed($order_id = null)
{
    global $woocommerce;
    if (!$order_id) {
        $order_id = $_POST['order_id'];
    }
    $data = get_post_meta($order_id);
    $total = $data['_order_total'][0] * 100;
    $params = array();
    if (isset($_POST['amount']) && ($amount = $_POST['amount'])) {
        $params['amount'] = round($amount);
    }
    $authcap = get_post_meta($order_id, 'auth_capture', true);
    if ($authcap) {
        Stripe::setApiKey(get_post_meta($order_id, 'key', true));
        try {
            $tid = get_post_meta($order_id, 'transaction_id', true);
            $ch = Stripe_Charge::retrieve($tid);
            if ($total < $ch->amount) {
                $params['amount'] = $total;
            }
            $ch->capture($params);
        } catch (Stripe_Error $e) {
            // There was an error
            $body = $e->getJsonBody();
            $err = $body['error'];
            if ($this->logger) {
                $this->logger->add('striper', 'Stripe Error:' . $err['message']);
            }
            wc_add_notice(__('Payment error:', 'striper') . $err['message'], 'error');
            return null;
        }
        return true;
    }
}
开发者ID:kilbot,项目名称:striper,代码行数:35,代码来源:stripe-gateway.php

示例12: get_charge

 /**
  * Get a Stripe charge object instance.
  *
  * @param string $charge_id Charge ID in Stripe.
  *
  * @return Stripe_Charge|string Charge object; else error message.
  */
 public static function get_charge($charge_id)
 {
     $input_time = time();
     // Initialize.
     $input_vars = get_defined_vars();
     // Arguments.
     require_once dirname(__FILE__) . '/stripe-sdk/lib/Stripe.php';
     Stripe::setApiKey($GLOBALS['WS_PLUGIN__']['s2member']['o']['pro_stripe_api_secret_key']);
     try {
         $charge = Stripe_Charge::retrieve($charge_id);
         self::log_entry(__FUNCTION__, $input_time, $input_vars, time(), $charge);
         return $charge;
         // Stripe charge object.
     } catch (exception $exception) {
         self::log_entry(__FUNCTION__, $input_time, $input_vars, time(), $exception);
         return self::error_message($exception);
     }
 }
开发者ID:SollyNZ,项目名称:damn-plugins,代码行数:25,代码来源:stripe-utilities.inc.php

示例13: process_modify

 /**
  * Process the changes from the Modify Pro Site Status metabox.
  *
  * @param $blog_id
  */
 public static function process_modify($blog_id)
 {
     global $psts, $current_user;
     $success_msg = $error_msg = '';
     if (isset($_POST['stripe_mod_action'])) {
         $customer_id = self::get_customer_data($blog_id)->customer_id;
         $exitsing_invoice_object = Stripe_Invoice::all(array("customer" => $customer_id, "count" => 1));
         $last_payment = $exitsing_invoice_object->data[0]->total / 100;
         $refund_value = $_POST['refund_amount'];
         $refund_amount = $refund_value * 100;
         $refund_amount = (int) $refund_amount;
         $refund = $last_payment;
         switch ($_POST['stripe_mod_action']) {
             case 'cancel':
                 $end_date = date_i18n(get_option('date_format'), $psts->get_expire($blog_id));
                 try {
                     $customer_data = self::get_customer_data($blog_id);
                     $customer_id = $customer_data->customer_id;
                     $sub_id = $customer_data->subscription_id;
                     $cu = Stripe_Customer::retrieve($customer_id);
                     // Don't use ::cancelSubscription because it doesn't know which subscription if we have multiple
                     $cu->subscriptions->retrieve($sub_id)->cancel();
                     //record stat
                     $psts->record_stat($blog_id, 'cancel');
                     $psts->log_action($blog_id, sprintf(__('Subscription successfully cancelled by %1$s. They should continue to have access until %2$s', 'psts'), $current_user->display_name, $end_date));
                     $success_msg = sprintf(__('Subscription successfully cancelled. They should continue to have access until %s.', 'psts'), $end_date);
                     update_blog_option($blog_id, 'psts_stripe_canceled', 1);
                 } catch (Exception $e) {
                     $error_msg = $e->getMessage();
                     $psts->log_action($blog_id, sprintf(__('Attempt to Cancel Subscription by %1$s failed with an error: %2$s', 'psts'), $current_user->display_name, $error_msg));
                 }
                 break;
             case 'cancel_refund':
                 $end_date = date_i18n(get_option('date_format'), $psts->get_expire($blog_id));
                 $cancellation_success = false;
                 try {
                     $customer_data = self::get_customer_data($blog_id);
                     $customer_id = $customer_data->customer_id;
                     $sub_id = $customer_data->subscription_id;
                     $cu = Stripe_Customer::retrieve($customer_id);
                     // Don't use ::cancelSubscription because it doesn't know which subscription if we have multiple
                     $cu->subscriptions->retrieve($sub_id)->cancel();
                     $cancellation_success = true;
                     //record stat
                 } catch (Exception $e) {
                     $error_msg = $e->getMessage();
                 }
                 if ($cancellation_success == false) {
                     $psts->log_action($blog_id, sprintf(__('Attempt to Cancel Subscription and Refund Prorated (%1$s) Last Payment by %2$s failed with an error: %3$s', 'psts'), $psts->format_currency(false, $refund), $current_user->display_name, $error_msg));
                     $error_msg = sprintf(__('Whoops, Stripe returned an error when attempting to cancel the subscription. Nothing was completed: %s', 'psts'), $error_msg);
                     break;
                 }
                 $refund_success = false;
                 if ($cancellation_success == true) {
                     try {
                         $charge_object = Stripe_Charge::all(array("count" => 1, "customer" => $customer_id));
                         $charge_id = $charge_object->data[0]->id;
                         $ch = Stripe_Charge::retrieve($charge_id);
                         $ch->refund();
                         $refund_success = true;
                     } catch (Exception $e) {
                         $error_msg = $e->getMessage();
                     }
                 }
                 if ($refund_success == true) {
                     $psts->log_action($blog_id, sprintf(__('Subscription cancelled and a prorated (%1$s) refund of last payment completed by %2$s', 'psts'), $psts->format_currency(false, $refund), $current_user->display_name));
                     $success_msg = sprintf(__('Subscription cancelled and a prorated (%s) refund of last payment were successfully completed.', 'psts'), $psts->format_currency(false, $refund));
                     update_blog_option($blog_id, 'psts_stripe_canceled', 1);
                 } else {
                     $psts->log_action($blog_id, sprintf(__('Subscription cancelled, but prorated (%1$s) refund of last payment by %2$s returned an error: %3$s', 'psts'), $psts->format_currency(false, $refund), $current_user->display_name, $error_msg));
                     $error_msg = sprintf(__('Subscription cancelled, but prorated (%1$s) refund of last payment returned an error: %2$s', 'psts'), $psts->format_currency(false, $refund), $error_msg);
                     update_blog_option($blog_id, 'psts_stripe_canceled', 1);
                 }
                 break;
             case 'refund':
                 try {
                     $charge_object = Stripe_Charge::all(array("count" => 1, "customer" => $customer_id));
                     $charge_id = $charge_object->data[0]->id;
                     $ch = Stripe_Charge::retrieve($charge_id);
                     $ch->refund();
                     $psts->log_action($blog_id, sprintf(__('A full (%1$s) refund of last payment completed by %2$s The subscription was not cancelled.', 'psts'), $psts->format_currency(false, $refund), $current_user->display_name));
                     $success_msg = sprintf(__('A full (%s) refund of last payment was successfully completed. The subscription was not cancelled.', 'psts'), $psts->format_currency(false, $refund));
                     $psts->record_refund_transaction($blog_id, $charge_id, $refund);
                 } catch (Exception $e) {
                     $error_msg = $e->getMessage();
                     $psts->log_action($blog_id, sprintf(__('Attempt to issue a full (%1$s) refund of last payment by %2$s returned an error: %3$s', 'psts'), $psts->format_currency(false, $refund), $current_user->display_name, $error_msg));
                     $error_msg = sprintf(__('Attempt to issue a full (%1$s) refund of last payment returned an error: %2$s', 'psts'), $psts->format_currency(false, $refund), $error_msg);
                 }
                 break;
             case 'partial_refund':
                 try {
                     $charge_object = Stripe_Charge::all(array("count" => 1, "customer" => $customer_id));
                     $charge_id = $charge_object->data[0]->id;
                     $ch = Stripe_Charge::retrieve($charge_id);
                     $ch->refund(array("amount" => $refund_amount));
//.........这里部分代码省略.........
开发者ID:vilmark,项目名称:vilmark_main,代码行数:101,代码来源:gateway-stripe.php

示例14: process_refund

 public function process_refund($order_id, $amount = NULL, $reason = '')
 {
     if ($amount > 0) {
         $CHARGE_ID = get_post_meta($order_id, '_transaction_id', true);
         $charge = Stripe_Charge::retrieve($CHARGE_ID);
         $refund = $charge->refunds->create(array('amount' => $amount * 100, 'metadata' => array('Order #' => $order_id, 'Refund reason' => $reason)));
         if ($refund) {
             $repoch = $refund->created;
             $rdt = new DateTime("@{$repoch}");
             $rtimestamp = $rdt->format('Y-m-d H:i:s e');
             $refundid = $refund->id;
             $wc_order = new WC_Order($order_id);
             $wc_order->add_order_note(__('Stripe Refund completed at. ' . $rtimestamp . ' with Refund ID = ' . $refundid, 'woocommerce'));
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
开发者ID:CImrie,项目名称:stripe-pci-compliant-woocommerce,代码行数:21,代码来源:stripe-woocommerce-addon.php

示例15: testChargeWithAdditionalInvalidChargeDataFields

 public function testChargeWithAdditionalInvalidChargeDataFields()
 {
     $data = array('amount' => 7.45, 'stripeToken' => 'tok_65Vl7Y7eZvKYlo2CurIZVU1z', 'statement_descriptor' => 'some chargeParams', 'invalid' => 'foobar');
     $result = $this->StripeComponent->charge($data);
     $this->assertRegExp('/^ch\\_[a-zA-Z0-9]+/', $result['stripe_id']);
     $charge = Stripe_Charge::retrieve('chargeParams');
     $this->assertEquals($result['stripe_id'], $charge->id);
     $this->assertEquals($data['statement_descriptor'], $charge->statement_descriptor);
     $this->assertObjectNotHasAttribute('invalid', $charge);
 }
开发者ID:wshafer,项目名称:CakePHP-StripeComponent-Plugin,代码行数:10,代码来源:StripeComponentTest.php


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