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:

http://example.com/index.php?edd-listener=2COINS

Note: Please replace "example.com" with the appropriate name of your website.

Cancelling Subscriptions

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

  1. From the 2Checkout Dashboardclick your username at to top right then go to settings -> Manage user access -> View roles -> Add role
  2. Name role and description. This is only for your information, any name and description will due.

  3. Under Privileges, only Api read/write should be selected. Deselect all other privileges.
  4. 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
OR
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

  1. Go to Subscriptions management.
  2. Search for the subscription and edit its settings.
  3. Click Stop automatic billing.
  4. Enter the number of billing cycles to cancel the subscription after.
  5. Enable the Cancel subscription when automatic billing ends option.
  6. Click Apply.
  7. 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.

Click to see the 2Checkout documentation for details

Cancelling Summary

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.

Refunds

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. 

  1. Go to Orders & customers -> Order search.
  2. Select the eStore orders tab.
  3. Use the filters to search for the order that you want to reimburse.
  4. Click the order reference number.
  5. Click Request refund.
  6. Choose the Total refund type.
  7. Fill in the details of the reimbursement, including whether or not to re-use keys or disable subscriptions.
  8. Fill in the cancellation reason box.
  9. Click Request refund.

Click to see the 2Checkout documentation for details

Troubleshooting

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: [0]: 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.

Subscription Cancel Button Missing and/or Renewals Are Not Recorded In EDD
First, review the subscription details in EDD, the Profile ID should not start with 2Checkout and it should match the 2Checkout subscription ID. If they do not match, update the Profile ID with the correct Subscription ID. Otherwise, review all documentation to confirm 2Checkout is properly configured.
If the Profile ID is incorrect for a couple transitions, there may have been a temporary communication issue. If most or all subscriptions have the wrong Profile ID, first confirm that 2Checkout is properly configured per the instructions above, specifically INS. If everything is properly configured, reach out to support so we can further investigate.

Related Articles