Payment Gateway Return - Subscription Activation

Hello :slight_smile:

I am writing a custom gateway and I understand that support doesn't cover customizations, however if anybody can help with some info it would be greatly appreciated.

Everything is working in regards to going to the payment processor and creating the user account.

However I am struggling to get the subscription activated on payment return.

Checking out the other gateways I have tried adding a function:

function handle_zombaio_return($content, $error) {
/* Zombaio Approval Return */
if(isset($_POST['webmaster'])) {
list($timestamp, $user_id, $sub_id, $key) = explode(':', $_POST['webmaster']);

// create_subscription
$member = new M_Membership($user_id);
if($member) {
$member->create_subscription($sub_id, $this->gateway);

do_action('membership_payment_subscr_signup', $user_id, $sub_id);

$content .= '<div id="reg-form">'; // because we can't have an enclosing form for this part

$content .= '<div class="formleft">';

$message = get_option( $this->gateway . "_completed_message", $this->defaultmessage );
$content .= stripslashes($message);

$content .= '</div>';

$content .= "</div>";

$content = apply_filters('membership_subscriptionform_signedup', $content, $user_id, $sub_id);

return $content;

Zombaio allows sending of 1 unique string named webmaster that is sent back to the return url, like so (which is why I have changed custom to webmaster in the above code):

$form .= '<input type="hidden" name="webmaster" value="' . $this->build_custom($user_id, $subscription->id, '0') .'">';

At the beginning of my gateway file I have also added this line like the other gateways:

if($this->is_active()) {
// Subscription form gateway
add_action('membership_handle_payment_return_' . $this->gateway, array(&$this, 'handle_zombaio_return'));

Am I heading in the write direction with this? Or is there a better way of activating the subscription on payment return?

Thanks in advance for any advice :smiley: