Set Up PayPal
Connect your PayPal business account to EverShop, so customers can pay with PayPal at checkout.
Before you start
- To take real payments, you need a verified PayPal Business account.
- Your store needs a public, secure address that starts with
https://. PayPal sends webhook messages only to an address like this. - Check the Currency in Setting › Store Setting. PayPal accepts only the currencies on its list, such as USD, EUR and GBP. With another currency, every PayPal payment fails.
- You set up PayPal in two places. On PayPal's website, you get the API credentials and create a webhook. API (application programming interface) credentials are the keys that let EverShop use your PayPal account. In EverShop, you enter what PayPal gives you.
- The Client Secret shows as plain text in Setting › Payment Setting. Anyone who can open this page in your admin panel can read it.
Get your PayPal API credentials
You do these steps on PayPal's website. PayPal explains them in Get client ID and client secret.
- Log in to the PayPal Developer Dashboard with your PayPal business account.
- Go to Apps & Credentials.
- Use the Sandbox and Live toggle. Choose Sandbox to test, or Live to take real payments.
- Under REST API apps, open your app. A new account already has one, named Default Application. To make another, click Create App.
- Copy the client ID and the client secret. Keep the secret private, like a password.
Create the PayPal webhook
A webhook is a message that PayPal sends to your store when a payment changes. EverShop reacts to five PayPal events:
| PayPal event | What EverShop does |
|---|---|
CHECKOUT.ORDER.APPROVED | The customer approved the payment. If the customer did not come back to your store, EverShop completes the payment now. |
PAYMENT.CAPTURE.PENDING | PayPal has not finished the payment. The payment status becomes Payment Pending. |
PAYMENT.CAPTURE.COMPLETED | PayPal finished the payment. The payment status becomes Captured. |
PAYMENT.CAPTURE.DENIED | PayPal refused a pending payment. The payment status becomes Failed. You decide whether to cancel the order. |
PAYMENT.CAPTURE.REFUNDED | You refunded money in your PayPal account. EverShop records the refund on the order. |
You do these steps on PayPal's website. PayPal explains them in Integrate webhooks.
- In Apps & Credentials, open the same app as in Get your PayPal API credentials.
- In the app's webhooks section, add a webhook.
- For the webhook URL (web address), enter your store address followed by
/api/paypal/webhook. For example:https://www.example.com/api/paypal/webhook. - Select the five events in the table above.
- Save the webhook, and copy its webhook ID.
PayPal checkout works without the webhook, but EverShop then misses these events. A Payment Pending order never changes by itself. Refunds made in your PayPal account do not show on the order.
Turn on PayPal in EverShop
-
Go to Setting › Payment Setting.
-
In the PayPal Payment card, turn on Enable?. It now shows Yes.
-
Optional: in Display Name, change the name customers see at checkout. It is Paypal by default.
-
In Client ID, paste the client ID from PayPal.
-
In Client Secret, paste the client secret from PayPal.
-
In Webhook ID, paste the webhook ID from PayPal.
-
In Environment, choose Sandbox or Live: the same one you chose on PayPal's website. See Sandbox and Live.
-
In Payment mode, choose Capture or Authorize only. See Choose the payment mode.
-
Click Save at the bottom of the page. This button saves every card on the page.
The message "Payment setting saved" appears, and PayPal is now a payment method at checkout. To check your credentials, see Test Payments Before Going Live.
Choose the payment mode
The PayPal Payment mode decides when PayPal takes the customer's money.
- Capture (the default): EverShop asks PayPal to take the money as soon as the customer approves. The payment status becomes Captured.
- Authorize only: PayPal only holds the money, and the payment status becomes Authorized. You take the money later: see Capture a Payment. If you cancel the order instead, EverShop asks PayPal to release the money.
PayPal holds authorized money for up to 29 days. PayPal recommends that you capture within the first 3 days, when a capture is most likely to succeed. See PayPal's authorization and honor period. A new Payment mode applies to payments that start after you save.
Sandbox and Live
Sandbox is PayPal's test environment: no real money moves. Live takes real payments. The PayPal Environment is Sandbox by default, so a new store takes no real money. Sandbox and Live each have their own client ID, client secret and webhook. When you change Environment, also change Client ID, Client Secret and Webhook ID. To test PayPal and then go live, see Test Payments Before Going Live.
What happens when a customer pays with PayPal
With PayPal, the customer leaves your store to pay on PayPal's website, then comes back.
- The customer chooses PayPal and clicks Pay with PayPal.
- EverShop creates the order with the payment status Pending. The stock of the items goes down, and the order shows in Sale › Orders.
- The customer goes to PayPal, logs in and approves the payment.
- PayPal sends the customer back to your store. EverShop asks PayPal to take the money, or only to hold it with Authorize only.
- The customer sees the order confirmation page. EverShop sends the order confirmation email now, if email sending is set up.
When a customer does not finish the PayPal payment:
- The customer cancels on PayPal. EverShop cancels the order and puts the items back in stock. The customer returns to the checkout page with their cart.
- The customer leaves before approving. The order stays Pending. The customer's cart in your store is empty, because the items are in this order. EverShop cancels the order after 6 hours or more: see Orders canceled automatically.
- The customer approves, then closes the window. The webhook tells EverShop, and EverShop completes the payment. Without the webhook, EverShop finds the payment only after 6 hours or more.
What your customers see
- At checkout: PayPal shows with your display name and the PayPal logo. A customer who chooses it reads "You will be redirected to PayPal for payment processing." The checkout button becomes Pay with PayPal. PayPal is not offered when the order total is 0.
- On PayPal's website: PayPal shows your Store Name from Setting › Store Setting. For an order with shipping, PayPal also shows the shipping address from checkout.
- After paying: the order confirmation page shows your display name as the payment method.
- When the payment fails after approval: the customer sees a page titled "Error". It says: "We are sorry. There was a problem completing your payment. If you approved the payment at PayPal, please do not try again — contact us and we will confirm your payment status." The order stays Pending until EverShop checks it again.
In your PayPal account, each payment has the EverShop order number, such as 10015, as its invoice ID.
Settings on this page
| Field | What it does | Default |
|---|---|---|
| Enable? | Yes shows PayPal at checkout. | No |
| Display Name | The payment method name at checkout, on the order confirmation page and on the order in your admin panel. | Paypal |
| Client ID | The public ID of your PayPal app. | Empty |
| Client Secret | The private key of your PayPal app. | Empty |
| Webhook ID | EverShop uses it to check that a webhook message comes from PayPal. When it is empty, EverShop refuses every webhook message. | Empty |
| Environment | Sandbox for test payments, Live for real payments. | Sandbox |
| Payment mode | Capture takes the money at checkout. Authorize only holds it until you capture it. | Capture |
Troubleshooting
Why does a PayPal order stay in Payment Pending?
PayPal has not finished the payment. For example, the customer paid by eCheck, a bank payment that takes some days to clear. Or the payment is in a currency your PayPal account does not hold. Then the payment waits until you accept it in your PayPal account. See currency codes.
Only the PayPal webhook changes Payment Pending.
- Check that the webhook exists in PayPal, and that its ID is in Webhook ID.
- If Webhook ID was empty or wrong, EverShop refused the messages. PayPal tries each one again, up to 25 times in 3 days. Correct the ID, and the order updates at the next try.
- After 3 days, PayPal stops trying. Open the webhook events dashboard in PayPal, and click Resend next to the message.
- A Payment Pending order has the order status Processing. Do not ship it while its payment status is Payment Pending. See Payment status.
Why do customers see an error after they click Pay with PayPal?
PayPal refused to start the payment. The customer sees an error message, and the checkout page reloads after 2 seconds. Check three things:
- Client ID and Client Secret are correct.
- Environment matches the credentials. Sandbox credentials do not work with Live, and Live credentials do not work with Sandbox.
- PayPal accepts your store Currency.
EverShop created the order before the error. The order shows in Sale › Orders with the payment status Pending. EverShop cancels it after 6 hours or more.
Next steps
- Test Payments Before Going LiveTry PayPal with Sandbox, then switch to Live.
- Capture a PaymentTake the money for an Authorized payment.
- Refund an OrderGive a PayPal payment back, in full or in part.
- PaymentsAll payment methods in EverShop.
For developers
To change what EverShop sends to PayPal, see Integrating PayPal Payment Gateway. It also shows how to set these values in the configuration file. Values there win over the same fields in this card.