Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Commit

Permalink
Merge pull request #278 from seand7565/vault
Browse files Browse the repository at this point in the history
Disable PayPal messaging when vault flow is enabled
  • Loading branch information
kennyadsl authored Nov 5, 2020
2 parents 5753999 + 2d944fa commit 720f2d1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ The checkout view
[initializes the PayPal button](/lib/views/frontend/spree/checkout/payment/_paypal_braintree.html.erb)
using the
[Vault flow](https://developers.braintreepayments.com/guides/paypal/overview/javascript/v3),
which allows the source to be reused. If you want, you can use [Checkout with PayPal](https://developers.braintreepayments.com/guides/paypal/checkout-with-paypal/javascript/v3)
which allows the source to be reused. Please note that PayPal messaging is disabled with vault flow. If you want, you can use [Checkout with PayPal](https://developers.braintreepayments.com/guides/paypal/checkout-with-paypal/javascript/v3)
instead, which doesn't allow you to reuse sources but allows your customers to pay with their PayPal
balance and with PayPal financing options ([see setup instructions](#create-a-new-payment-method)).

Expand All @@ -190,7 +190,7 @@ render "spree/shared/paypal_cart_button"

### PayPal Financing Messaging

PayPal offers an [on-site messaging component](https://www.paypal.com/us/webapps/mpp/on-site-messaging) to notify the customer that there are financing options available. By default, this component is used in both the cart and checkout partials.
PayPal offers an [on-site messaging component](https://www.paypal.com/us/webapps/mpp/on-site-messaging) to notify the customer that there are financing options available. This component is included in both the cart and checkout partials, but is disabled by default. To enable this option, you'll need to use the `checkout` flow, and set the `paypal button messaging` option to `true` in your Braintree configuration.

You can also include this view partial to implement this messaging component anywhere - for instance, on the product page:
```ruby
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ SolidusPaypalBraintree.PaypalButton.prototype.initializeCallback = function() {
currency: this._paypalOptions.currency,
commit: true,
vault: this._paypalOptions.flow == "vault",
components: this.style['messaging'] == "true" ? "buttons,messages" : "buttons",
components: this.style['messaging'] == "true" && this._paypalOptions.flow != "vault" ? "buttons,messages" : "buttons",
intent: this._paypalOptions.flow == "vault" ? "tokenize" : "authorize"
}).then(() => {
var create_method = this._paypalOptions.flow == "vault" ? "createBillingAgreement" : "createOrder"
Expand Down
2 changes: 1 addition & 1 deletion app/models/solidus_paypal_braintree/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Configuration < ::Spree::Base
label: { availables: %w[checkout credit pay buynow paypal installment], default: 'checkout' },
tagline: { availables: %w[true false], default: 'false' },
layout: { availables: %w[horizontal vertical], default: 'horizontal' },
messaging: { availables: %w[true false], default: 'true' }
messaging: { availables: %w[true false], default: 'false' }
}.freeze

belongs_to :store, class_name: 'Spree::Store'
Expand Down

0 comments on commit 720f2d1

Please sign in to comment.