Closed vandres closed 1 year ago
Got it working, by changing the template to the following:
<div class="paypal-rest-form" data-env="{{ gateway.testMode ? 'sandbox' : 'production' }}"
data-prepare="{{ actionUrl('commerce/payments/pay', {'siteToken': currentSite.id|hash }) }}"
data-complete="{{ actionUrl('commerce/payments/complete-payment', {'siteToken': currentSite.id|hash }) }}">
<div id="paypal-button-container"></div>
</div>
Hi @vandres
Thank you for your message.
Just to clarify you need this because you specifically want to post the data to a different URL/site?
Because, in testing this all works as expected if you are browsing the site you are wanting to submit the payment on.
Thanks
Thanks for the reply @nfourtythree
I don't really need a different url, but I need the siteToken included in my setup.
So you have a test setup, with the commerce url underneath the "normal" url and it works for you? The products are also disabled in the normal url?
Normal: example.com Shop: example.com/shop
Hi @vandres
Thank you, due to the information you provided I went back and did some more testing and managed to replicate the issue.
From that, we have just pushed up a fix fo this which will be included in the next release of the plugin (likely to be soon).
Thanks!
@nfourtythree Is this fix released, yet?
Description I found an issue with my multi-site setup. I am having 6 sites:
Products are only available in the shop sites, not in the CMS part.
When I am in the checkout and want to proceed with PayPal, the form looks correct:
Different to e.g. the manual Gateway though, the payment-form of this Plugin is sending its request directly to the action url. In my case 'http://zs.test/index.php?p=actions/commerce/payments/pay'
I debugged a little into the
Request
class of Craft. Since the request url is now "zs.test" and not "zs.test/shop", Craft takes the CMS-site as the current site. Then Commerce recalculates the cart. Since there are no active products in the CMS, the cart will be empty.Maybe I am doing something wrong. If not, Craft offers to send a
siteToken
or a site header with the requests. Maybe that could resolve that issue.Additional info