Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when trying to make a payment #52

Open
angieherrera opened this issue Oct 16, 2023 · 3 comments
Open

Error when trying to make a payment #52

angieherrera opened this issue Oct 16, 2023 · 3 comments

Comments

@angieherrera
Copy link

Hi!

I have successfully installed this plugin on a Craft 4.5.5 / Commerce 4.3.0 set up. However, whenever I try to make a payment, I get the following error:

TypeError
webdnalcommercelbraintree|responses|PaymentResponse:_construct(): Argument #1 (Sdata) must be of type array, Braintree|Result Error given, called in /[my]/[path]/[to]/vendor/webdna/commerce-braintree/src/gateways/Gateway.php on line 516

Full screenshot:
231014-1

The code to render the form looks like this:

<form id="paymentForm" method="post" action="">
   {{ csrfInput() }}
   {{ actionInput('commerce/payments/pay') }}
   {{ redirectInput('/store/checkout/order?number={number}') }}
   {{ hiddenInput('cancelUrl', '/store/checkout/payment'|hash) }}
   {{ hiddenInput('orderEmail', cart.email) }}

   {% namespace cart.gateway.handle|commercePaymentFormNamespace %}
      {{ cart.gateway.getPaymentFormHtml({})|raw }}
   {% endnamespace %}

   <button class="btn secondary">Pay Now</button>
</form>

That renders like so (note missing CVV field):
CleanShot 2023-10-16 at 09 32 25

I'm not sure what, if anything, needs to be adjusted in my code, or if this is an issue with the plugin.

Thank you!

@smockensturm
Copy link

Same. Is this gateway no longer supported?

@jalendport
Copy link

jalendport commented Oct 19, 2023

I ran into this as well, and evidently there are several newer beta versions of this plugin that somehow Craft doesn't know about (I'll poke P&T and have them check into why that is happening). In the meantime, make sure the line in your composer.json is updated to "webdna/commerce-braintree": "^3.0.0-beta.1" (note the presence of the ^ which means Composer isn't version locked to beta.1), and then run a composer update. The latest beta at the time of this comment is beta.11, and updating to that fixed my errors.

@angieherrera also fwiw, if you update the SDK versions in the gateway settings to the latest available, particularly the "Drop-in UI SDK Version", you'll want to make sure your "Pay Now" button has the type="submit" attribute, or it won't load the payment form on the frontend.

In order to get the CVV field showing up in the payment form on the frontend, you'll want to make sure you set up some CVV rules in your Braintree dashboard per https://developer.paypal.com/braintree/docs/guides/drop-in/setup-and-integration/javascript/v3/#credit-cards (see also: https://developer.paypal.com/braintree/articles/guides/fraud-tools/basic/avs-cvv-rules).

@smockensturm
Copy link

Awesome. Yeah, we chased it down and we're operational. But this is very helpful. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants