Recurring Payments - 2Checkout Gateway Configuration
Recurring Payments integrates fully with 2Checkout. The 2Checkout payment gateway is available for Easy Digital Downloads via the 2Checkout extension. Documentation for installing, configuring, and using that extension is here.
Instant Notification Service (INS)
Important! If INS is not properly configured, purchase processing will not work.
2Checkout's Instant Notification Service allows 2Checkout to communicate with your store, keeping transaction data in sync. INS must be set up properly for purchase processing and recurring billing to work.
From your 2Checkout account, navigate to the Integrations / Webhooks & API screen and enable all notifications (INS & Global INS). The URL should be set to:
Note: Please replace "example.com" with the appropriate name of your website.
When using 2Checkout, a cancellation may be initiated either from within EDD or from the 2Checkout Dashboard.
EDD Subscription Cancellation Setup
Due to limitations of the 2Checkout API, cancellation options inside the EDD admin interface will only be available if you place a special username and password inside of your wp-config.php file.
1. Create an API user role
- From the 2Checkout Dashboard, click your username at to top right then go to settings -> Manage user access -> View roles -> Add role
- Name role and description. This is only for your information, any name and description will due.
- Under Privileges, only Api read/write should be selected. Deselect all other privileges.
- Save role.
2. Create a new user in your 2Checkout account and give them API access.
Click the View users -> Add user after creating the role
From the 2Checkout Dashboard, click your username at to top right then go to settings -> Manage user access -> Add User.
Fill out required for the API User. Make sure the following items are properly configured:
- Set Password lifetime to Never expire.
If the password expires it will prevent subscriptions from working on your site. If you want this feature, it's recommend manually update the password so the new password can be added to your WordPress site at the same time to prevent problems.
- Deselect "Require user to change the password on first login"
- Select the API user role
3. Add the username and password of the newly created user to your wp-config.php file:
define( 'TWOCHECKOUT_ADMIN_USER', 'USER NAME HERE' ); define( 'TWOCHECKOUT_ADMIN_PASSWORD', 'PASSWORD HERE' );
To cancel a subscription from the EDD admin
Go to Downloads → Subscriptions and click View on the item you want to cancel.
Then in the bottom of the next screen click on Cancel Subscription.
When you set a subscription to cancelled it's cancelled immediately, but the customer will still have access to their purchased material for as much time as they've paid for.
Example: they've paid $10/mo, and you cancel halfway through the month. They still have access to their material for the rest of the month, but they won't be re-billed, and access will stop at the end of the month.
To cancel a subscription from the 2Checkout Admin
- Go to Subscriptions management.
- Search for the subscription and edit its settings.
- Click Stop automatic billing.
- Enter the number of billing cycles to cancel the subscription after.
- Enable the Cancel subscription when automatic billing ends option.
- Click Apply.
- Once disabled, you can switch it back on, provided that payment data is available.
Note: EDD will always stop "After a specified number of billing cycles", therefore it doesn't matter if choose to stop automatic billing Now or After a specified number of billing cycles.
It doesn't matter if you cancel a subscription in EDD or in 2Checkout, the effect is exactly the same and the customer won't notice a difference.
When using the 2Checkout payment gateway refunds are processed the same way as any other transaction. Read our full documentation on refunds here.
Additionally, refunds may be processed from within the 2Checkout admin also.
- Go to Orders & customers -> Order search.
- Select the eStore orders tab.
- Use the filters to search for the order that you want to reimburse.
- Click the order reference number.
- Click Request refund.
- Choose the Total refund type.
- Fill in the details of the reimbursement, including whether or not to re-use keys or disable subscriptions.
- Fill in the cancellation reason box.
- Click Request refund.
Note: In 2018 2Checkout updated their user interface, it's possible some settings were changed/updated when the update occurred. If anything is not working as expected, review all settings in this document and 2Checkout Payment Gateway Setup Instructions. If you've had an account prior to the new interface, it's likely some settings need to be updated to work properly.
500 Internal Error Page On Purchase
Example of PHP error: PHP Fatal error: Uncaught Twocheckout_Error: : Invalid Username/Password thrown in /var/www/html/wp-content/plugins/edd-2checkout/sdk/lib/Twocheckout/Api/TwocheckoutUtil.php
If you are seeing a PHP error related to Invalid Username/Password, it's related to the API User. Confirm the API User's Password lifetime setting is set to Never expire then update the password. Update your wp-config.php file with the new password.
Cancelling EDD Subscription Does Not Cancel 2Checkout Subscription
To fix, confirm the API's user role is properly set to "API read/write" and confirm "API read only" is deselected, as detailed in the documentation above.