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


PHP Transaction::sale方法代码示例

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


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

示例1: testSaleWithInvalidAmount

 function testSaleWithInvalidAmount()
 {
     $this->expectException(new Errors\ValidationError(array(array('property' => 'payment_transaction.amount', 'message' => 'must have a minimum value of 1'))));
     $data = $this->fixture('sale.json');
     $data['amount'] = -10;
     Transaction::sale($this->channelToken, $data);
 }
开发者ID:hypercharge,项目名称:hypercharge-php,代码行数:7,代码来源:TransactionIntegrationTest.php

示例2:

<?php

/**
 * Created by PhpStorm.
 * User: David
 * Date: 2015-09-19
 * Time: 1:54 AM
 */
require "braintree-php/lib/Braintree.php";
Braintree_Configuration::environment('sandbox');
Braintree_Configuration::merchantId('f8hz5cfs97665c2r');
Braintree_Configuration::publicKey('289njc8rrdf47cwk');
Braintree_Configuration::privateKey('e23e1e9b16adfccd3208096b42bba5a9');
echo $clientToken = Braintree_ClientToken::generate();
//Process payment
$nonce = $_POST["payment_method_nonce"];
/* Use payment method nonce here */
//Amount of payment
$amount = $_POST["payment_amount"];
$result = Braintree . Transaction::sale(['amount' => $amount, 'paymentMethodNonce' => $nonce]);
echo $nonce . " for \$" . $amount . "\n";
开发者ID:jeffrey-xiao,项目名称:WhizBridge,代码行数:21,代码来源:braintree-test.php

示例3: processPayment

 private function processPayment()
 {
     Braintree_Configuration::environment('sandbox');
     Braintree_Configuration::merchantId('f8hz5cfs97665c2r');
     Braintree_Configuration::publicKey('289njc8rrdf47cwk');
     Braintree_Configuration::privateKey('e23e1e9b16adfccd3208096b42bba5a9');
     //echo($clientToken = Braintree_ClientToken::generate());
     //Process payment
     $nonce = $_POST["payment_method_nonce"];
     /* Use payment method nonce here */
     //Amount of payment
     $amount = $_POST["payment_amount"];
     $result = Braintree . Transaction::sale(['amount' => $amount, 'paymentMethodNonce' => $nonce]);
     $name = "Valid payment";
     switch ($nonce) {
         case "fake-valid-visa-nonce":
             $name = "Visa";
             break;
         case "fake-valid-mastercard-nonce":
             $name = "Mastercard";
             break;
         case "fake-valid-debit-nonce":
             $name = "Debit";
             break;
         default:
             break;
     }
     //echo($name . " for $" . $amount . "\n");
 }
开发者ID:jeffrey-xiao,项目名称:WhizBridge,代码行数:29,代码来源:controller.php


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