1

I'm running into issues handing off a cart transaction to Paypal Express. I've set the paymentMethodId correctly on the cart, but when I submit to commerce/payments/pay I am only getting redirected to my cart page and nothing is showing in the Commerce debug logs.

Aside from having cart items and a paymentMethodId, is there anything else required for the Paypal handoff? How can I further debug this?

<form method="POST" id="paypal_checkout_form">
  <input type="hidden" name="action" value="commerce/payments/pay"/>
  <input type="hidden" name="redirect" value="/thank-you?oid={{ cart.number }}"/>
  <input type="hidden" name="cancelUrl" value="/shop/cancel"/>
  <input type="hidden" name="orderNumber" value="{{ cart.number }}"/>

  {{ getCsrfInput() }}
</form>
2

There is most likely some error in your configuration, or what you're sending to the cart.

The following code (when in devMode) will show you any errors that are coming back from Commerce/Paypal when you're redirected back to the cart:

   {# SHOW ANY ERRORS IF THERE ARE ANY! #}

{% if craft.config.devMode and (craft.session.hasFlash('commerce') or craft.session.hasFlash('notice') or craft.session.hasFlash('error')) %}

    {% set isErrors = true %}
    {% set commerceFlash = craft.session.getFlash('commerce')|join('|') %}
    {% set noticeFlash = craft.session.getFlash('notice')|join('|') %}
    {% set errorFlash = craft.session.getFlash('error')|join('|') %}

    Commerce: [{{  commerceFlash }}]
    Notice: [{{  noticeFlash }}]
    Error: [{{  errorFlash }}]

{% endif %}
1
  • Thank you, this was the debug info I needed, pointed out I was missing an email on the order (though I was hopeful paypal alone could just capture that for us).
    – ghoward
    Feb 20 '17 at 23:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.