AMember Cancellation Script

This script is a basic API to expire a membership in AMember. It will look up an AMember account based on AMember ID, or email, or first and last name. It will then set the expired date for a subscription to a date in the past. The effectively cancels the subscription, but it keeps
all of the data intact in the database. This script does nothing to cancel payments, it just expires
the subscription.

This script is absolutely free to use! I hope that others can find this script helpful. If you have
any feedback or problems with it, please email me at tim@golen.net and I will try to help you out.

FEATURES
- Looks up an amember account by amember id, or email, or first and last name
- variables can be passed as GET or POST
- password protected
- expires accounts so all data is left in tact
- can be used by payment gateways to expire a membership if the payment subscription is cancelled
(see advanced use section)
- debug features
- sends an email on success and failure

amembercancel.zip

STANDARD USE

Expire a subscription by amember id

http://www.example.com/cancel.php?PW=scriptPassword&AmemberId=1

Expire a subscription by email

http://www.example.com/cancel.php?PW=scriptPassword&Email=test@example.com

Expire a subscription by first and last name

http://www.example.com/cancel.php?PW=scriptPassword&Email=test@example.com&FirstName=test&LastName=test

Some simple rules to follow:
- The password ALWAYS needs to be passed as a GET variable
- The other variables can be passed as GET or POST variables
- AMemberId OR Email must be passed
if it can’t locate the account by the email address it will attempt to lookup the account using the first and last name

ADVANCED USE

We use InfusionSoft for our CMS and have an action sequence once a credit card hits max retrys for
payments. At that point we use the HTTP POST feature to http://www.example.com/cancel.php?PW=scriptPassword
InfusionSoft will pass all of the contact fields through as POST variables, so we can grab the email
address and attempt to do a match on that. If we can’t find a match we move to matching with the
first and last name.

- 2009-11-28 Update: there was an error in the cancel.php file that wasn’t allowing the script password to work properly.