How to configure PayPal Express Checkout?

One of the most frequently used payment methods in e-commerce is PayPal. Its configuration in Sylius is really simple.

Configure the gateway

Note

To test this configuration properly you will need a developer account on Paypal. Use its data (username, password and signature) in the parameters.yml file.

# app/config/parameters.yml
parameters:
    paypal.express_checkout.username: TEST
    paypal.express_checkout.password: TEST
    paypal.express_checkout.signature: TEST
    paypal.express_checkout.sandbox: true

Having these parameters defined you can configure the gateway inside the app/config/payum.yml file which has to be imported in the app/config/config.yml.

# app/config/payum.yml
payum:
    gateways:
        paypal_express_checkout:
            factory: "paypal_express_checkout"
            payum.http_client: "@sylius.payum.http_client"
            username: "%paypal.express_checkout.username%"
            password: "%paypal.express_checkout.password%"
            signature: "%paypal.express_checkout.signature%"
            sandbox: "%paypal.express_checkout.sandbox%"
# app/config/config.yml
imports:
    - { resource: "payum.yml" }

Add a payment method with the Paypal Expresss gateway in the Admin Panel

  • Create a new payment method, choose the Paypal Express Checkout gateway for it and enable it in chosen channels.

Go to the http://localhost:8000/admin/payment-methods/new url.

../_images/paypal_express_create.png

Save the new method.

Choosing Paypal Express method in Checkout

From now on Paypal Express will be available in Checkout in the channel you have created it for.

../_images/paypal_express_checkout.png

Done!