Giter Site home page Giter Site logo

braintree / braintree_php Goto Github PK

View Code? Open in Web Editor NEW
546.0 96.0 224.0 4.05 MB

Braintree PHP library

Home Page: https://developer.paypal.com/braintree/docs/start/overview

License: MIT License

Ruby 0.14% Shell 0.01% PHP 99.78% Makefile 0.04% Dockerfile 0.03%
braintree php payments

braintree_php's Introduction

Braintree PHP library

The Braintree PHP library provides integration access to the Braintree Gateway.

TLS 1.2 required

The Payment Card Industry (PCI) Council has mandated that early versions of TLS be retired from service. All organizations that handle credit card information are required to comply with this standard. As part of this obligation, Braintree has updated its services to require TLS 1.2 for all HTTPS connections. Braintrees require HTTP/1.1 for all connections. Please see our technical documentation for more information.

Dependencies

The following PHP extensions are required:

  • curl
  • dom
  • hash
  • openssl
  • xmlwriter

PHP version >= 7.3 is required. The Braintree PHP SDK is tested against PHP versions 7.3 and 7.4, and 8.0.

The PHP core development community has released End-of-Life branches for PHP versions 5.4 - 7.2, and are no longer receiving security updates. As a result, Braintree does not support these versions of PHP.

Versions

Braintree employs a deprecation policy for our SDKs. For more information on the statuses of an SDK check our developer docs.

Major version number Status Released Deprecated Unsupported
6.x.x Active March 2021 TBA TBA
5.x.x Inactive March 2020 March 2023 March 2024
4.x.x Deprecated May 2019 March 2022 March 2023
3.x.x Deprecated May 2015 March 2022 March 2023

Documentation

Updating from an Inactive, Deprecated, or Unsupported version of this SDK? Check our Migration Guide for tips.

Quick Start Example

<?php

require_once 'PATH_TO_BRAINTREE/lib/Braintree.php';

// Instantiate a Braintree Gateway either like this:
$gateway = new Braintree\Gateway([
    'environment' => 'sandbox',
    'merchantId' => 'your_merchant_id',
    'publicKey' => 'your_public_key',
    'privateKey' => 'your_private_key'
]);

// or like this:
$config = new Braintree\Configuration([
    'environment' => 'sandbox',
    'merchantId' => 'your_merchant_id',
    'publicKey' => 'your_public_key',
    'privateKey' => 'your_private_key'
]);
$gateway = new Braintree\Gateway($config)

// Then, create a transaction:
$result = $gateway->transaction()->sale([
    'amount' => '10.00',
    'paymentMethodNonce' => $nonceFromTheClient,
    'deviceData' => $deviceDataFromTheClient,
    'options' => [ 'submitForSettlement' => True ]
]);

if ($result->success) {
    print_r("success!: " . $result->transaction->id);
} else if ($result->transaction) {
    print_r("Error processing transaction:");
    print_r("\n  code: " . $result->transaction->processorResponseCode);
    print_r("\n  text: " . $result->transaction->processorResponseText);
} else {
    foreach($result->errors->deepAll() AS $error) {
      print_r($error->code . ": " . $error->message . "\n");
    }
}

Namespacing

As of major version 5.x.x, only PSR-4 namespacing is supported. This means you'll have to reference classes using PSR-4 namespacing:

$gateway = new Braintree\Gateway([
    'environment' => 'sandbox',
    'merchantId' => 'your_merchant_id',
    'publicKey' => 'your_public_key',
    'privateKey' => 'your_private_key'
]);

// or

$config = new Braintree\Configuration([
    'environment' => 'sandbox',
    'merchantId' => 'your_merchant_id',
    'publicKey' => 'your_public_key',
    'privateKey' => 'your_private_key'
]);
$gateway = new Braintree\Gateway($config)

Google App Engine Support

When using Google App Engine include the curl extention in your php.ini file (see #190 for more information):

extension = "curl.so"

and turn off accepting gzip responses:

$gateway = new Braintree\Gateway([
    'environment' => 'sandbox',
    // ...
    'acceptGzipEncoding' => false,
]);

Developing (Docker)

The Makefile and Dockerfile will build an image containing the dependencies and drop you to a terminal where you can run tests.

make

Linting

The Rakefile includes commands to run PHP Code Sniffer and PHP Code Beautifier & Fixer. To run the linter commands use rake:

rake lint:fix # runs the auto-fixer first, then sniffs for any remaining code smells
rake lint:sniff[y] # gives a detailed report of code smells

Testing

The unit specs can be run by anyone on any system, but the integration specs are meant to be run against a local development server of our gateway code. These integration specs are not meant for public consumption and will likely fail if run on your system. To run unit tests use rake: rake test:unit.

To lint and run all tests, use rake: rake test.

License

See the LICENSE file.

braintree_php's People

Contributors

719media avatar atmattpatt avatar beane avatar billwerges avatar bmcdonnel avatar bocharsky-bw avatar braintreeps avatar bryanagee avatar chrissiedunham avatar crookedneighbor avatar dan-manges avatar demerino avatar edebill avatar ericbraintree avatar jingminglake avatar jonjchew avatar jplukarski avatar lkorth avatar matthewarkin avatar mborosh-bt avatar pgr0ss avatar ph-7 avatar plainlystated avatar pupitooo avatar rmurali-paypal avatar saralvasquez avatar scannillo avatar sebdesign avatar sestevens avatar skunkworks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

braintree_php's Issues

SSL_Braintree Exception on checkout page

Hi,

I am using the following plugin (woocommerce-gateway-braintree) by WooThemes and it is not working as it throws a SSL exception after you submit the card details. I tried reinstalling the SSL certificate on my domain again but it still throws the same exception. I tried SandBox and production both and it throws the same exception. Below is the exception:
"An error occurred, please try again or try an alternate form of payment.
Error Type Braintree_Exception_SSLCertificate"

Website link: www.rowdyjewellery.com

Fire webhooks form the sandbox control panel

Hi there.

Would you consider adding webhook triggers form the control panel?

I think this would imitate a real expected behaviour and verify that the webhook implementation on the server is correct.

UTC not a valid timezone in CentOS 6.6

/braintree-php-2.35.2/lib/Braintree/TransparentRedirectGateway.php Line 239
$now = new DateTime('now', new DateTimeZone('UTC'));

Causes exception to be thrown:
PHP Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone (UTC)'

Any of the following would work:
$now = new DateTime('now', new DateTimeZone('Etc/UTC'));
$now = new DateTime('now', new DateTimeZone('GMT0'));

Only observed on CentOS 6.6

Transparent redirect error

I am using transparent redirect and I am trying to add a credit card to a user using createCreditCardData() as the TR data.

When the gateway redirects the user back to my page, and we confirm() the TR, we get this error:

Notice: Undefined property: Braintree_Result_Successful::$_attributes in /www/app/vendor/lib/Braintree/Instance.php on line 40

Warning: array_key_exists() expects parameter 2 to be array, null given in /www/app/vendor/lib/Braintree/Instance.php on line 40

Undefined property on Braintree_Result_Successful: _attributes in /www/app/vendor/lib/Braintree/Instance.php on line 43

Warning: array_key_exists() expects parameter 2 to be array, null given in /www/app/vendor/lib/Braintree/Instance.php on line 40

Notice: Undefined property on Braintree_Result_Successful: customer in /www/app/vendor/lib/Braintree/Instance.php on line 43

This might be related to #8.

We are using 2.21.0.

Serialize Braintree objects

Why Braintree objects are not serializable? Our applications could benefit from storing a serialized version of Braintree_Transaction and/or Braintree_Subscription. This would help us to improve customer support, and debugging in production, because just saving the string version isn't enough, and saving by hand all the attributes is cumbersome.

PaymentMethod::Create() does not take raw credit card fields

According to the docs, the PaymentMethod::Create() API call should support taking raw credit card fields (number, cvv, etc.)
https://developers.braintreepayments.com/javascript+php/reference/request/payment-method/create

However, the PHP SDK doesn't actually allow it:
https://github.com/braintree/braintree_php/blob/master/lib/Braintree/PaymentMethodGateway.php#L102

 private static function baseSignature($options)
{
$billingAddressSignature = Braintree_AddressGateway::createSignature();
return array(
'customerId',
'paymentMethodNonce',
'token',
'billingAddressId',
'deviceData',
array('options' => $options),
array('billingAddress' => $billingAddressSignature)
);
}
public static function createSignature()
{
$options = array(
'makeDefault',
'verifyCard',
'failOnDuplicatePaymentMethod',
'verificationMerchantAccountId'
);
$signature = self::baseSignature($options);
return $signature;
}

Subscription Update Documentation Inaccurate, Drop-In UI Needs Payment Token

Currently have a site utilizing PHP + JS SDK (via DropIn UI).

According to the current PHP SDK Docs, one of the fields that can be updated for a subscription is paymentMethodToken, which can be by token or payment method nonce.

However, when passing a valid/unprocessed nonce to this call, a Braintree_Exception_NotFound() error is thrown. Per Payment Method Documentation, this exception is thrown when a payment method cannot be located.

This suggests that the API does not allow for using nonce when updating subscription payment method. If that is the case, the documentation should be updated and the DropIn UI should be updated in such a way that the client can determine which payment method was added (since, presently, only a nonce is sent back by the client).

'Class 'Braintree_Modification' not found'

Environment: Laravel PHP and "braintree/braintree_php" : "2.35.2"
When performing a call:

         $addOns = Braintree_AddOn::all();

I get an exception:
[2014-12-18 23:14:46] production.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Class 'Braintree_Modification' not found' in /var/www/vendor/braintree/braintree_php/lib/Braintree/Discount.php:3
Stack trace:
#0 [internal function]: Illuminate\Exception\Handler->handleShutdown()
#1 {main} [] []

How do I fix this?

Operations that depend upon the public/private key should fail if they aren't set

For example, the verify method doesn't complain if it's called before you've set your keys with Braintree_Configuration::privateKey() and Braintree_Configuration::publicKey(). I just spent half an hour wondering why I was constantly getting a "Destination could not be verified" error from the webhooks panel before finally realising my mistake - which the library could in principle have pointed out to me.

Undefined property on Braintree_Subscription:update()

Mar  8 08:32:36 squeeze64 ool www[836]: PHP Notice:  Undefined property: Braintree_Result_Successful::$_attributes in /webroot/base/branches/3/classes/_extensions/braintree/lib/Braintree/Instance.php on line 40
Mar  8 08:32:36 squeeze64 ool www[836]: PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in /webroot/base/branches/3/classes/_extensions/braintree/lib/Braintree/Instance.php on line 40
Mar  8 08:32:36 squeeze64 ool www[836]: PHP Notice:  Undefined property on Braintree_Result_Successful: _attributes in /webroot/base/branches/3/classes/_extensions/braintree/lib/Braintree/Instance.php on line 43
Mar  8 08:32:36 squeeze64 ool www[836]: PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in /webroot/base/branches/3/classes/_extensions/braintree/lib/Braintree/Instance.php on line 40
Mar  8 08:32:36 squeeze64 ool www[836]: PHP Notice:  Undefined property on Braintree_Result_Successful: message in /webroot/base/branches/3/classes/_extensions/braintree/lib/Braintree/Instance.php on line 43

Any idea what this might be? The Braintree_Result_Successful object doesn't appear to have an $_attributes instance variable.

The call made to cause this to happen was:

$result = Braintree_Subscription::update($subscriptionToken, array('price' => 20));

$subscriptionToken is a valid token ID.

travis-ci & test suite

It would be neat if you guys got travis-ci to automatically test pull-requests (it's free).

Furthermore, would you be interested in some test suite improvements?

HTTP timeout throws Braintree_Exception_SSLCertificate if SSL is enabled

I was getting a misleading exception during a recent sandbox outage. I believe curl was timing out, but the exception I saw was Braintree_Exception_SSLCertificate.

Apparently BrainTree_Http::_doRequest() throws Braintree_Exception_SSLCertificate if SSL is enabled and curl_getinfo($curl, CURLINFO_HTTP_CODE) == 0.

This doesn't seem quite right to me; I reckon the exception type should be more general. I didn't find an appropriate one in the lib -- possibly Braintree_Exception_ServerError?

errors->deepAll() returning null with Braintree_Customer::create with paymentMethodNonce

the following code doesn't return the gateway error when the card fails validation

I used this card number : 378734493671000

  $params = array(
        "company" => element('name',$data),
        'paymentMethodNonce' => $data['payment_method_nonce'],
        'customFields' => array(
            'id_company' => $data['id_company'],
            'reference' => $data['reference'],
        )
    );

    $gateway_response=Braintree_Customer::create($params);

   foreach($gateway_response->errors->deepAll() AS $error) {
        print_r($error->code . ": " . $error->message . "\n");
   }

Braintree_CreditCard not Found

I am getting the following error when I try to delete a card. I am using the current version of the SDK

Request error {"message":"Class 'Braintree_CreditCard' not found","line":143,"file":"/home/lawrenberg/PhpstormProjects/Delivery-API-V2/laravel/vendor/braintree/braintree_php/lib/Braintree/Customer.php","trace":[{"function":"handleShutdown","class":"Illuminate\\Exception\\Handler","type":"->","args":[]}],"human_id":"952503"}

Create Plans with API call

Hi ,
I'm creating a WordPress plugin where user can make subscription plan and they can add recurring billing system . Is there any way to create the plans dynamically into Braintree ? i saw in the documentation that we can not create plans through the API .
I found other payment gateway has this option . Is there any possibility to add this feature in future ? Thanks

create_function should be replaced by anonymous function

There are currently two uses of the "create_function" in the PHP SDK codebase. They can both be easily replaced with anonymous functions (closures). This would be a great win because:

  1. HHVM does not support the create_function function. Currently the PHP SDK cannot be used under HHVM because of this.
  2. PHP's own documentation advises against use of create_function: "Caution
    This function internally performs an eval() and as such has the same security issues as eval(). Additionally it has bad performance and memory usage characteristics."

Thanks!

error when submiting a transaction for refund - please advise


Fatal error: Uncaught exception 'Braintree_Exception_NotFound' in /public_html/vendor/braintree/lib/Braintree/Util.php:59 Stack trace: #0 /public_html/vendor/braintree/lib/Braintree/Http.php(44): Braintree_Util::throwStatusCodeException(404) #1 /public_html/vendor/braintree/lib/Braintree/TransactionGateway.php(373): Braintree_Http->post('/merchants/dvnd...', Array) #2 /public_html/vendor/braintree/lib/Braintree/Transaction.php(492): Braintree_TransactionGateway->refund('043240', '479.94') #3 /public_html/admin/modules/payment/braintreepayments/function_process_braintree_refund.php(98): Braintree_Transaction::refund('043240', '479.94') #4 {main}

thrown in /public_html/vendor/braintree/lib/Braintree/Util.php on line 59

using Laravel 5

can you show us an options for loading this in Laravel environment?

Method not allowed on subscription update

Trying to update a subscription on the sandbox gives a method not allowed.

This is what I'm sending (values replaced).

$result = Braintree_Subscription::update('subscription_id', array( 'price' => 10, 'options' => array('prorateCharges' => true) ));

Return:
Braintree_Exception_Unexpected: Unexpected HTTP_RESPONSE #405

Class SimpleXMLIterator not implemented on HHVM

Hi all,
the SimpleXMLIterator class, used in Braintree_Xml_Parser, seems not implemented on HHVM (facebook/hhvm#3292), so every call results in a Fatal Error and the library is unusable on HHVM.

I have this error with braintree library 3.0.1 and HHVM 3.7.2, but maybe the problem persist for all braintree library version because the SimpleXMLIterator class is used everywhere.

I can't find this problem mentioned anywhere in your issues . . . am I missing something?

"no matching public key" error when trying to generate sample webhook notification

When I use the code from https://developers.braintreepayments.com/javascript+php/sdk/server/webhooks/testing to try to generate a sample webhook notification, so I can understand what I'll be getting back from the server, I only get an error saying "no matching public key".

I am using the exact code from the aforementioned page, so I don't think I'm missing anything, but alas, it doesn't work.

Can anyone point me in the right direction, please?

Payment Method Update Issue

I'm getting the error message "Payment Method nonces cannot be used to update an existing card" when trying to use Braintree_PaymentMethod::update. This seems to be the opposite of the what documentation says.

Credit card update doesn't check for duplicates

Don't know if it's just a sandbox thing but when I create a credit card i can pass the fail on duplicate option so that no duplicate credit cards can be created.

The update method does not accept this option - furthermore it allows to card number to an already existing one

Braintree_Exception_NotFound triggered by : Braintree_Transaction::refund returns empty message

when I run transaction refund method with a non existent transaction it throws an error but the exception returns an empty message so cannot display the error to the gui

Braintree_Transaction::refund('nonExistent');

as a workaround i run
Braintree_Transaction::find('nonExistent');

which throws an exception with an error, but if possible I would prefer to run a single api call.

catch(Exception $e){
print_r($e->getMessage());
}

Sub merchant account creation issue?

I want to create new merchant account from my account and i need to send money to that sub accounts using php. so i have create a file. my file link is given below.

https://gist.github.com/Nathan-Srivi/7010e94b7e74295550d1

But i unable to create sub account from this file.

i got this script from the following link
https://github.com/braintree/braintree_php/blob/master/tests/integration/MerchantAccountTest.php

when i run my file means
i got the the following issues

[message] =&gt; Master merchant account ID is invalid.

I am using sandbox account. so please help me. how can i create merchant sub account and how can i transfer the account from my merchant account to merchant sub account using php.

Undefined index: subject in Braintree/WebhookNotification.php

Hi, I'm receiving this error on line 72 of WebhookNotification. I'm using the most recent version, and I'm not passing any attributes to the factory method. The following seems to be causing the issue:

if (isset($attributes['subject']['apiErrorResponse'])) {
$wrapperNode = $attributes['subject']['apiErrorResponse'];
} else {
$wrapperNode = $attributes['subject'];
}

It seems to check for whether or not $attributes['subject']['apiErrorResponse'] is set, but then assumes $attributes['subject'] is set if that fails. Perhaps a change to the following would help?

if (isset($attributes['subject']['apiErrorResponse'])) {
$wrapperNode = $attributes['subject']['apiErrorResponse'];
} else if (isset($attributes['subject'])) {
$wrapperNode = $attributes['subject'];
}

drop in UI - issues

  1. Lets say customer adds two cards - Card number โ€“ 4009348888881881 and 4012888888881881.

The drop in UI when initialized with the customer ID will display the cards like

image

This is confusing and defeats the purpose of allowing the customer to choose the desired card.

Call to member function setEnvironment() on a non-object

As of version 2.35.0, I'm getting the following error

"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Call to a member function setEnvironment() on a non-object","file":"\/home2\/...\/vendor\/braintree\/braintree_php\/lib\/Braintree\/Configuration.php","line":81}}

confirm() method in TransparentRedirect cannot convert DateTime to string

Made a couple simple pages to create users following along the tutorial here: http://www.braintreepaymentsolutions.com/docs/php/customers/create_tr

When I try to create customers, I get errors trying to convert DateTime to string. Specifically, I see:
Catchable fatal error: Object of class DateTime could not be converted to string in /var/www/braintree/braintree-php-2.6.0/lib/Braintree/Customer.php on line 404

Here's my complete code, with my keys removed:
index.php:



<title>Braintree Test Page</title>

  <body>
    <form method="POST" action="<?= Braintree_TransparentRedirect::url() ?>">
      <input type="hidden" name="tr_data" value="<?= htmlentities(Braintree_TransparentRedirect::createCustomerData(array('redirectUrl' => 'http://172.16.97.128/braintree/confirm.php'))) ?>" />
      First Name: <input type="text" name="customer[first_name]" /><br/>
      Last Name: <input type="text" name="customer[last_name]" /><br/>
      Credit Card Number: <input type="text" name="customer[credit_card][number]" /><br/>
      Expiration Date: <input type="text" name="customer[credit_card][expiration_date]" /><br/>
      <input type="submit" />
    </form>
  </body>
</html>

confirm.php:

<p>
  Transparent Redirect Callback Page
</p>

<? $result = Braintree_TransparentRedirect::confirm($_SERVER['QUERY_STRING']) ?>
<?= print_r($result) ?>

move boilerplate out of Braintree.php and into a file for those who don't have autoloaders.

The problem with Braintree.php is it sets include paths and require's all braintree api files even if a fair amount of them are not going to be used in handling the request.

A preferable way would be to keep Braintree class in Braintree.php and move the boilerplate into a file that would only be used for those who do not handle their own PSR-0 compliant class libraries. Braintree DOES appear to manage their class definitions in a PSR-0 file hierarchy so we should be good with this.

Class 'Braintree_Customer'

Hello everybody,

somehow Customer class could not be found.

I get this error:

Fatal error: Class 'Braintree_Customer' not found in D:\_homestead\a\vendor\braintree\braintree_php\lib\Braintree\TransparentRedirect.php on line 86

I have simple composer.json file:

{

    "require": {
        "braintree/braintree_php": "2.27.1"
    }

}

tried 27.2 and 28.0 - same results.

index.php is plain simple:

<?php

require 'vendor/autoload.php';

$result = Braintree_Customer::create(array(
    'firstName' => 'Mike',
    'lastName' => 'Jones',
    'company' => 'Jones Co.',
    'email' => '[email protected]',
    'phone' => '281.330.8004',
    'fax' => '419.555.1235',
    'website' => 'http://example.com'
));

Where could be the problem?

IIf I use subscription like so:

$result = Braintree_Subscription::create(array(
  'paymentMethodToken' => 'a_token',
  'planId' => 'silver_plan'
));

I get valid errors like:

Fatal error: Uncaught exception 'Braintree_Exception_Configuration' with message 'environment needs to be set.' in D:\_homestead\a\vendor\braintree\braintree_php\lib\Braintree\Configuration.php:117 Stack trace: #0 D:\_homestead\a\vendor\braintree\braintree_php\lib\Braintree\Configuration.php(139): Braintree_Configuration::get('environment') #1 D:\_homestead\a\vendor\braintree\braintree_php\lib\Braintree\Configuration.php(152): Braintree_Configuration::setOrGet('environment', NULL) #2 D:\_homestead\a\vendor\braintree\braintree_php\lib\Braintree\Configuration.php(329): Braintree_Configuration::environment() #3 D:\_homestead\a\vendor\braintree\braintree_php\lib\Braintree\Configuration.php(265): Braintree_Configuration::sslOn() #4 D:\_homestead\a\vendor\braintree\braintree_php\lib\Braintree\Configuration.php(195): Braintree_Configuration::protocol() #5 D:\_homestead\a\vendor\braintree\braintree_php\lib\Braintree\Configuration.php(181): Braintree_Configuration::baseUrl() #6 D:\_homestead\a\vendor\braintree\braintree_php\lib\Br in D:\_homestead\a\vendor\braintree\braintree_php\lib\Braintree\Configuration.php on line 117

Thank you

Docs don't match for extra trData

The valid keys for submitting extra TR data are these. The docs for example have first_name and not firstName, store_in_vault is now storeInVault

Array
(
[0] => redirectUrl
[1] => transaction[amount]
[2] => transaction[billing][company]
[3] => transaction[billing][countryCodeAlpha2]
[4] => transaction[billing][countryCodeAlpha3]
[5] => transaction[billing][countryCodeNumeric]
[6] => transaction[billing][countryName]
[7] => transaction[billing][extendedAddress]
[8] => transaction[billing][firstName]
[9] => transaction[billing][lastName]
[10] => transaction[billing][locality]
[11] => transaction[billing][postalCode]
[12] => transaction[billing][region]
[13] => transaction[billing][streetAddress]
[14] => transaction[creditCard][cardholderName]
[15] => transaction[creditCard][cvv]
[16] => transaction[creditCard][expirationDate]
[17] => transaction[creditCard][expirationMonth]
[18] => transaction[creditCard][expirationYear]
[19] => transaction[creditCard][number]
[20] => transaction[creditCard][token]
[21] => transaction[customFields][anyKey]
[22] => transaction[customerId]
[23] => transaction[customer][company]
[24] => transaction[customer][email]
[25] => transaction[customer][fax]
[26] => transaction[customer][firstName]
[27] => transaction[customer][id]
[28] => transaction[customer][lastName]
[29] => transaction[customer][phone]
[30] => transaction[customer][website]
[31] => transaction[descriptor][name]
[32] => transaction[descriptor][phone]
[33] => transaction[merchantAccountId]
[34] => transaction[options][addBillingAddressToPaymentMethod]
[35] => transaction[options][storeInVaultOnSuccess]
[36] => transaction[options][storeInVault]
[37] => transaction[options][storeShippingAddressInVault]
[38] => transaction[options][submitForSettlement]
[39] => transaction[orderId]
[40] => transaction[paymentMethodToken]
[41] => transaction[purchaseOrderNumber]
[42] => transaction[recurring]
[43] => transaction[shippingAddressId]
[44] => transaction[shipping][company]
[45] => transaction[shipping][countryCodeAlpha2]
[46] => transaction[shipping][countryCodeAlpha3]
[47] => transaction[shipping][countryCodeNumeric]
[48] => transaction[shipping][countryName]
[49] => transaction[shipping][extendedAddress]
[50] => transaction[shipping][firstName]
[51] => transaction[shipping][lastName]
[52] => transaction[shipping][locality]
[53] => transaction[shipping][postalCode]
[54] => transaction[shipping][region]
[55] => transaction[shipping][streetAddress]
[56] => transaction[taxAmount]
[57] => transaction[taxExempt]
[58] => transaction[type]
)

Possible solution to validating custom fields with transparent redirect

I am currently in the process of implementing Braintree into my application. One of the disadvantages of transparent redirect is that it is difficult to perform custom validations on the form data because it never passes through your system as noted here

If we want to do anything using transparent redirect, we need to use confirm() before the transparent redirect request is actually saved/charged/etc on Braintree's servers.

What if there is a method implemented, that processes a request but does not confirm it? This means we can get the custom field values, perform validation and confirm it only if the fields validates:

$result = Braintree_TransparentRedirect::process($queryString);

$success = validate($result->transaction->customFields['custom_field_one']);

if($success){
   $result->confirm();
}else{
   //Failure mode, so perhaps display the form again or do something else.
}

What do you guys think?

issue while integrating Braintree

Hi,

I am getting this error while including Braintree.php, please help me

Fatal error: Call to undefined function set_require_once_path() in C:\xampp\htdocs\braintree\lib\Braintree.php on line 11

Regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.