Skip to content

Payment Gateways

Akram El Assas edited this page Feb 27, 2025 · 5 revisions

wexCommerce supports Stripe and PayPal payment gateways. You can choose either to use Stripe or PayPal for payments.

Supported countries

If your country is not supported by Stripe, you can check if it is supported by PayPal. And if so, you can use PayPal payment gateway instead of Stripe.

Stripe Configuration

API

To use Stripe, you need to set the following settings in api/.env:

WC_STRIPE_SECRET_KEY=STRIPE_SECRET_KEY

You can find Stripe secret key in Stripe Developer Dashboard.

Frontend

To use Stripe, you need to set the following settings in frontend/.env:

NEXT_PUBLIC_WC_PAYMENT_GATEWAY=Stripe # Stripe or PayPal
NEXT_PUBLIC_WC_STRIPE_PUBLISHABLE_KEY=STRIPE_PUBLISHABLE_KEY

You can find Stripe publishable key in Stripe Developer Dashboard.

You can test Stripe payments with the following card number: 4242 4242 4242 4242

For expiration date, set any date in the future. For CCV, set any three digits number.

Paypal Configuration

API

To use PayPal, you need to set the following settings in api/.env:

WC_PAYPAL_CLIENT_ID=PAYPAL_CLIENT_ID
WC_PAYPAL_CLIENT_SECRET=PAYPAL_CLIENT_SECRET
WC_PAYPAL_SANDBOX=true

You can find PayPal keys in PayPal Developer Dashboard.

For production, once your PayPal app is verified you need to set:

WC_PAYPAL_SANDBOX=false

At the beginning, toggle sandbox mode in PayPal Developer Dashboard and test that everything is working in sandbox mode.

When you want to go live, you need to register your application with PayPal.

Important: Before you register your PayPal application, make sure the status of the PayPal account used to submit the application is verified.

To submit your website, log into the PayPal Developer website by using the credentials of the PayPal account registered to the application owner.

Note: The PayPal account associated with the application must be a verified Premier or verified Business account.

Click My Apps & Credentials and toggle to the Live tab.

That's it. Your app will be reviewed and registered by PayPal. You can find more details about the review process here.

Frontend

To use PayPal, you need to set the following settings in frontend/.env:

NEXT_PUBLIC_WC_PAYMENT_GATEWAY=PayPal # Stripe or PayPal
NEXT_PUBLIC_WC_PAYPAL_CLIENT_ID=PAYPAL_CLIENT_ID

You can test PayPal payments with the following card number: 4005 5192 0000 0004

For expiration date, set any date in the future. For CCV, set any three digits number.

If you want to debug PayPal integration in case of issues, you can set:

NEXT_PUBLIC_WC_PAYPAL_DEBUG=true

And check the browser console logs.