Jump to content

Work with tokens on redirect plugin


Recommended Posts

Hi,

We finished to build new third party gateway module.

(customer leaves my site and make the payment on the gateway providers).

After billing process is finished the gateway calls to the callback page of the module with POST request

and send the token and other transaction data.

I would like to save the token for future recurring billing so I did as you described in the documentation.

I build the function _storeremote() and call it from the callback page.

This is the code:

 

name of module = pcredirect:

 

 

pcredirect.php

 

function pcredirect_storeremote()

{

 

$token = $_POST['token'];

return array("status"=>"success","gatewayid"=>$token,"rawdata"=>$results);

}

 

callback/pcredirect.php

 

 

pcredirect_storeremote();

 

 

This function doesn't work because the data of the token doesn't saved in the database.

 

 

any Idea?

 

Best Regards,

Star Network.

Link to comment
Share on other sites

The storeremote function is called internally by WHMCS when updating a credit card via the WHMCS admin or client interface, calling the method directly would do nothing other than return an array back to call back containing the values you return.

 

To save the token you would need to do this manually via SQL.

e.g. This is how I do this from my stripe gateway module.

 

full_query("UPDATE tblclients set expdate = AES_ENCRYPT('".$params['cardexp']."','". $cchash. "') WHERE id = ". $whmcs_client_id);
update_query("tblclients", array("cardtype" => $stripe_customer->active_card->type, "cardnum" => '', "gatewayid" =>$stripe_customer->id,"cardlastfour" => $stripe_customer->active_card->last4), array("id" => $whmcs_client_id));

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated