Paypal Smart Checkout – Multiple merchant ids throw error

Viewed 822

On a checkout page, loading the PayPal Javascript SDK, I provide multiple merchant-ids like this (where [my_client_id] is replaced with my id, of course), the email addresses shown have been modified for privacy reasons:

<script src="https://www.paypal.com/sdk/js?client-id=[my_client_id]&currency=EUR&locale=de_DE&merchant-id=*" 
data-merchant-id="lobo***@gmail.com,suic***@squar***.de,einkauf@***-games.de,paypal@***.events,***@kst***.at"></script>

I then create a separate Paypal Smart button for each of the merchants. But although I provide the multiple merchant-ids, I will get the following error as soon as a payment button is clicked:

Error: Payee(s) passed in transaction does not match expected merchant
id. Please ensure you are passing merchant-id=****55TUNG or
merchant-id=lobo***@gmail.com to the sdk url.

But that merchant-id is provided in the URL as you can see above. If I press another merchant's pay button, I get the same error message but with that merchant's id listed in the error message.

The payee passed by the PHP script using createOrder is the corresponding email address of the merchant 100 percent correctly.

Is this a bug in the PayPal SDK or am I listing the merchant-ids maybe in the wrong way in the SDK-URL (though it is the way PayPal has described it a discussion on github)?

IMPORTANT SIDE NOTE: If I totally omit providing the merchant-ids in the SDK-URL, I get Javascript warnings about the missing merchant-id, but the payment buttons work just fine (which makes me sure that the PHP backend script is working 100 percent correctly), the payments are being processed.

What interesting, too: If I omit the merchant-ids in the SDK-URL, PayPal will render four different payment options, if I include the merchant-ids in the URL, then only two are shown (and both of them will throw the error).

All of this is referring to production mode.

1 Answers

Only pass a single merchant-id, and have it correspond to the payee that you are going to use.

Alternatively, pass no merchant-id at all, for transaction types that don't require it.

Related