10 Jan

Ogone subscriptions implementation .Net – Delete and update

ogone_logo

Now that you know how to setup a Ogone subscription you can already start getting money. But what if you want to change the amount being charged or stop the subscription without going to their Back Office.
The final part in our Ogone subscription posts will show you how to simply delete and update an Ogone subscription. Without leaving your application.

Update a subscription

This one is simple.
Ogone does not support updating a subscription via your own website. You can however update the subscription in their Back Office, but for us this is not an option.
The only solution you have is to delete the old subscription and create a new one. How to create a subscription is explained in our previous post. How to delete on will be explained below.


Deleting a subscription

Deleting a subscription is easy.

Unlike creating one, you’ll only be needing the following things:

  • Your Ogone PSID: [PSID]
  • Name of your API user: [USERID]
  • Password of the API user: [PSWD]
  • The subscription id you want to delete: [SUBID]
Also an other difference compare to creating a subscription is that you’re going to do a whole other action. We’ll be creating a file, containing data to delete the subscription, and send it to Ogone. This file could also be made manually and uploaded manually into Ogones Back Office. This process is known as sending a Batch File.
The url [URL] you’ll be sending your data to is this:

  • Testing: https://secure.ogone.com/ncol/test/AFU_agree.asp
  • Production: https://secure.ogone.com/ncol/prod/AFU_agree.asp

 

This is the code used to send the batch file to Ogone together with our RemotePost class:

/// <summary>
/// Method which will send a batch file with the subscriptionid which will delete the subscription.
/// </summary>
public static void DeleteSubscription()
{
    var file = string.Format("{0};{1};{2};{3};{4};{5};{6};{7};{8};{9};{10};{11};{12};{13};{14};{15};{16};{17};{18};{19};{20};{21}",
        "DELSUBS", "", "", "", "", [PSID], [SUBID], "", "", "", "", "", "", "", "", "", "", "", "", "", "", "");

    //This will create an id used for the file.
    var filereference = string.Format("Delete_{0}",subscriptionId);

    var post = new RemotePost
            {
                Url = [URL]
            };

    post.Add("FILE", file);
    post.Add("FILE_REFERENCE", filereference);
    post.Add("PSPID", [PSID]);
    post.Add("USERID", [USERID]);
    post.Add("PSWD", [PSWD]);
    post.Add("MODE", "SYNC");
    //MTR is used for maintenance operations since this will no create a new order.
    post.Add("TRANSACTION_CODE", "MTR");
    post.Add("REPLY_TYPE", "XML");
    //With this method your file will be checked and processed at the same time.
    post.Add("PROCESS_MODE", "CHECKANDPROCESS");
    post.Add("NB_PAYMENTS", "1");
    post.Add("OPERATION", "DEL");

    post.Post();
}


After implementing this code you’ll be able to successfully create, update and delete a Ogone subscription.

 

Not everything seems logic and you can see Ogone has still a lot of work to do on their API. Maybe in the future this blog-series will get outdated, but I’ll make sure to keep it up-to-date.
Any question can be send to blog@dragoonflight.com and I will try to answer them as soon as possible.

Sources

 

4 thoughts on “Ogone subscriptions implementation .Net – Delete and update

  1. Can anyone tell me where i can find documentation on “deleting subscriptions”?

    I can’t find it on the Ingenico/Ogone website and even Ingenicos support desk can’t tell me how to do it. This is what they told me in a reply on my support call: “Change SUB_STATUS to 0, because it’s not possible to delete a subscription. You can only make it inactive”.

    But… How can i make an existing subscription inactive if it can’t be changed according to this article.

  2. Thanks for the quick reply. I had already read the document you mention above, but unfortunately there isn’t a chapter about deleting or updating subscriptions using their API, only with back office or in batch. Both aren’t usable options for us.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.