I set up PayPal for Poland in the react app while testing on a sandbox account. All the buttons I needed were displayed and worked perfectly, but as soon as I switched to a production account in PayPal, everything crashed. As a result, I had to leave only the PayPal button, but it is important for me to display the buttons of the Polish banks BLIK and Przelewy24. Here is the configuration for the button that I set up
const initialOptions = {
'client-id': clientId,
'disable-funding': 'credit,card',
'buyer-country': 'PL',
intent: 'capture',
currency: 'PLN',
locale: 'pl_PL',
};
The problem is created by this configuration: ‘buyer-country’: ‘PL’, the error that this attribute gives
error in text:
Failed to load the PayPal JS SDK script. Error: The script "https://www.paypal.com/sdk/js?client-id=ASUVJy6QpO2egf46Qhg0S-ORQ9ixk9oLadq%E2%80%A6kSxFzMz&enable-funding=przelewy24&intent=capture¤cy=PLN&locale=pl_PL" failed to load. Check the HTTP status code and response body in DevTools to learn more.
console.<computed>@index.js:9console.<computed>@sandbox.8eb7d3b62.js:[email protected]:57eval@
if someone configured the button for Poland, tell me what else needs to be configured for it to work, maybe in the business account settings somewhere to enable something.
<PayPalScriptProvider options={initialOptions}>
<PayPalButnContainer>
<p>Płatność online</p>
<PayPalButtons
style={styles}
createOrder={createdOrder}
onApprove={onApprove}
onCancel={() => navigate('/basket')}
onError={onError}
/>
</PayPalButnContainer>
</PayPalScriptProvider>
Added to the configuration 'enable-funding': 'paypal,blik,przelewy24'
,
assigned fundingSource={FUNDING.BLIK}
to the button
I’ve read a bunch of docs, combed through the entire Internet, and I can’t find anything and understand how to display all the buttons, maybe this is a problem in the library itself @paypal/react-paypal-js'
I want to get this result
here is the entire button code on GitHub
on line 149 I made notes that I corrected it and what it outputs
2
Answers
I'm jumping for joy))) here is a working config that gives what I need!
The parameter
buyer-country
can only be used in sandbox mode. Its purpose is to simulate what a buyer with an IP address in such a country will see.For the live environment, the actual IP of the payer is used to determine whether to show additional funding sources. Testing from a Polish IP will give the desired behavior.