Jump to content

Third Party Gateway module with recurring payments (subscriptions).


Kipras

Recommended Posts

Hello,

I am developing a gateway module for a company which uses external checkout (meaning it redirects the client to an external page where he inputs his credit card info), after that the client gets redirected back to WHMCS  callback file, where the signature is checked, etc. To redirect a client to the companies external checkout, I use a _link function, then in the callback file I mark the invoice as paid and try to store the transaction id, that I get from the external checkout page, as a subscription id, because the external checkout page later on accepts the transaction id (UUID) as a token for recurring payments. I say try, because I am not successful in doing so. This is the code to store the subscription id:

function storeSubscriptionId($invoiceId, $transactionId)
{
    $orderId = Capsule::table('tblorders')->select('id')
    ->where('invoiceid', $invoiceId)
    ->first();

    Capsule::table('tblhosting')
    ->where('orderid', $orderId)
    ->update([
        "subscriptionid" => $transactionId
    ]); 
}

Sometimes I get a 500 error, sometimes I do not, but all of the times, no matter what outcome, I cannot seem to get the error message, which I would be fine about if the transaction id would be successfully stored in 'tblhosting'. In order to implement the recurring part of the payment, I also implement a _capture function in my modules/gateways/ file, which I then cannot use as there is no subscription id stored so I cannot 'Attempt Capture' on an unpaid invoice (attached image for reference).

Contacting WHMCS support did not bring success as I was given the same links to the documentation again and again , which I have read, yet I cannot say with certainty that I understand.

Quote

Implementing In Payment Gateway Modules
This feature should only be defined for payment gateways which create automatic recurring subscriptions that are processed outside of WHMCS (for example PayPal Subscriptions).

Implementation is a two-step process:

A subscription ID must be stored in tblhosting.subscriptionid for the given service in order for the cancel subscription function to be invokable. Typically this value should be set as part of a payment gateway callback routine (see callbacks)

So I am stuck on this step and whatever I try - it yields no result. Hopefully someone could be of service here.

Screenshot from 2020-01-10 11-30-30.png

Link to comment
Share on other sites

  • 2 weeks later...

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