Click2Sell.EU API – Add Another Dimension to Your Business

Dear Click2Sell.EU blog readers,

this post will be about a new Click2Sell system feature: Instant order notification by API.

It will be a long post, so let me present an index of the post:

  1. Introduction to Click2Sell API;
  2. How it works;
  3. Notification structure;
  4. Script sample;

Introduction to Click2Sell API

Some advanced Click2Sell.EU members asked for a feature that would 'pass' a transaction's information to the specified URL location or the thank-you page. Why would merchants need this feature? It is simply not enough for some services to have their customers "simply" redirected to "thank-you" pages after a successful purchase. Membership websites, licence based softwares or just any product with some verifications usually need some data from payment processor in order to allow their customers to access purchased products/services.

Instant notifications allows merchants to take their business to the next level as they provide extra functionality, security and save merchants' time.

Even ordinary sellers could consider about automation of things happening after a successful purchase. Just let me give you some examples:

  • you're selling an ebook. After a successful sale your script could accept instant notification and add your customer's email address to your mailing list.
  • you have a forum with some paid content there. After a successful sale your script could automatically make changes in user account to allow your customer to access paid content.
  • you sell a service based on subscriptions. By monitoring our instant notifications you can track if any of your subscribers hasn't missed his/her payment (and automatically unsubscribe if there is a failed payment).

As you can see, notifications are used to transmit transaction/order information from the system server to the merchants' own servers/scripts. Because of our members requests, we have developed a fully working API.

How Click2Sell API works

Click2Sell API works via HTTP POST method. When the transaction occurs: sale, refund, subscription re-bill or cancellation, our system posts a transaction information to the specified URL location – to your servers and scripts where they 'listen' for such notifications.

Basically speaking, Click2Sell API notification contains:

  • Detailed buyer information;
  • Transaction information (payment processors ID, date, time and so on);
  • Click2Sell related information (transaction ID, username, affiliate name, etc.).

All merchants who want to use Click2Sell API have to visit: For Merchant –> My Products –> Edit Settings (click on a certain product) –> API Settings

On this page, you will be able to turn on/off API notifications. In order to turn these notifications on, you need to enter the location URL of your script or thank-you page that 'listens' for a data and then put a tick on the checkbox where it says: Enable/Disable remote server's notification.

Then our system will send all order information to your specified location.

As you can see, there is an additional 'Secret key' field. This field is optional. However, if you want to send the notifications and then verify if they really come from Click2Sell.EU, use this field. Just enter your desired secret keyword or use 'Generate' link under this field for our system to generate it. When this option is used, our system takes and merges the acquirer_transaction_id id with this key (secretkey + "_" + acquirer_transaction_id) and MD5 it. The variable is passed with 'checksum' paramether via API for your server to verify.

Moreover, in order to allow you identify the customer after a sale is made, API can post via POST method the acquirer_transaction_id to your specified Thank-you page. This feature can be turned on/off in the API Settings section.

Each product requires a separate API configuration. We made this in order to achieve the higest flexibility for our merchants.

 

Click2Sell API Parameters passed to your specified URL

Parameter Description Format, values
acquirer_transaction_id 
Transaction number in your payment processor’s (i.e. Paypal) system  
c2s_transaction_id Click2Sell.EU Transaction number e.g., 22222
order_id Click2Sell.EU Order number e.g., 22222
purchase_date Date when transaction occured yyyy-MM-dd (year-month-day)
e.g., 2008-09-09
purchase_time The time when transaction occured HH:mm:ss (hours: minutes: seconds)
e.g., 01:56:42
payment_type Payment method used VISA, MASTERCARD, AMEX, PayPal,
Moneybookers, Google Checkout
transaction_type Type of transaction Sale, Refund, Subscription
payment_status You will receive this in order to confirm that the transaction went through without any problems OK
subscription_status If you have subscription based product, you will receive this parameter too New, Recurring, Cancel
     
buyer_name Customer name

e.g., John

buyer_surname Customer surname e.g., Doe
buyer_address Customer address e.g., 1891 Something Rd Ste 5
buyer_city Customer living city e.g., London
buyer_province Customer state e.g., Ohio
buyer_zip Customer postal code/zip e.g., 22222
buyer_country Customer country e.g., France
buyer_email Customer email address e.g., my@email.com
buyer_phone Customer phone n/a, 888-999-44444
     
product_price Product price XX.YY
e.g., 49.95
product_currency Price currency USD, EUR, GBP
product_id Product ID in Click2Sell.EU system e.g., 1111
product_name Product name in Click2Sell.EU system e.g., How to find out the best deal
merchant_username Merchant username (account login) e.g., johndoe22
affiliate_username Affiliate username (if it is affiliated sale) e.g., affiliate1
checksum If you have entered "Secret key", the system join it with C2S transaction ID and encrypt it in MD5. Mind that MD5 hash sum will be uppercased.  

As you can see, we pass 24 different variables with our API to your servers, so you can do whatever you want with the order data: collect into your databases for the future use.

 

Click2Sell API Sample code

This code is an example code how to accept our sent notifications.

<?php

 /* reading click2sell notification parameters to local variables */

 $acqTransId = urldecode($_POST["acquirer_transaction_id"]); /* transaction number in acquirer system */

 $c2sTransId = urldecode($_POST["c2s_transaction_id"]);  /* click2sell transaction number */

 $purchaseDate = urldecode($_POST["purchase_date"]); /* format: yyyy-MM-dd (year-month-day) */

 $purchaseTime = urldecode($_POST["purchase_time"]); /* format: HH:mm:ss (hours:minutes:seconds) */

 $paymentType = urldecode($_POST["payment_type"]); /* Paypal, Moneybookers, Google Checkout, credit card */

 $transactionType = urldecode($_POST["transaction_type"]); /* Sale, Refund, Subscription */

 $paymentStatus = urldecode($_POST["payment_status"]); /* OK or Failed, now Always sends OK since we send notification only on successfull cases now */

 $subscriptionStatus = urldecode($_POST["subscription_status"]); /* in case of subscription: New, Recurring, Cancel*/

 /* information about the buyer */

 $buyerName = urldecode($_POST["buyer_name"]); /* name */

 $buyerSurname = urldecode($_POST["buyer_surname"]); /* surname */

 $buyerAddress = urldecode($_POST["buyer_address"]); /* address */

 $buyerCity = urldecode($_POST["buyer_city"]); /* city */

 $buyerProvince = urldecode($_POST["buyer_province"]); /* province */

 $buyerZip = urldecode($_POST["buyer_zip"]); /* postal code*/

 $buyerCountry = urldecode($_POST["buyer_country"]); /* country name */

 $buyerEmail = urldecode($_POST["buyer_email"]); /* email */

 $buyerPhone = urldecode($_POST["buyer_phone"]); /* phone */

 /* product information */

 $productPrice = urldecode($_POST["product_price"]); /* price: amount + currency – "###.## CUR", CUR is a currency code: USD, EUR or GBP */

 $productId = urldecode($_POST["product_id"]); /* product id in click2sell */

 $productName = urldecode($_POST["product_name"]); /* product name */

 $merchantName = urldecode($_POST["merchant_name"]); /* name of the merchant */

 $merchantUsername = urldecode($_POST["merchant_username"]); /* click2sell login name of the merchant */

 $merchantUsername = urldecode($_POST["affiliate_username"]); /* click2sell login of the affiliate in case of the affiliated sale */

 /* … process the necessary data …. */

?>

 


However, I must say that this feature is intended for use by people with some programming skills. You may need to hire someone to do all the coding, but be sure to consider what automatic notifications could improve in your business!

We tried to explain how Click2Sell API works as simple as possible. But there might still be some misunderstandings. So if you have any questions, thoughts or just need some help, please, post a response/comment under this post or just e-mail Click2Sell.EU customer support.

We will do our best to help you!

Egidijus & Vytis

Popular Posts:


Similar Posts:

5 Comments »

  1. How does Worldpay Select Invisible account work on Click2Sell? | Click2Sell.EU Support Database Said,

    November 30, 2008 @ 2:36 pm

    […] Moreover, Click2Sell system will send you a callback once the transaction is completed via Click2Sell API. You don’t have to use Worldpay’s API separately, since our API will pass all the […]

  2. How to pass customers information with transaction data? | Click2Sell.EU Support Database Said,

    December 3, 2008 @ 3:11 pm

    […] names, product’s names and all other possible data. All this information is passed by Click2Sell API to your remote location […]

  3. Bernice Fletcher Said,

    April 19, 2009 @ 4:53 pm

    Your information has been helpful, it is very detailed.

    I am checking out options for procuring my API and transaction key. Doing an inquiry to see what precautions I must adhere to as I do my business set-up. I need to know what your price ranges are. Also, what precautions must I be aware of (This is why I am checking out various entities…also, want to see if entities are registered with BBB?

    My URL is not in place for this business yet.
    Thanks for a response.

  4. Click2Sell API refund notifications | Click2Sell.EU Support Database Said,

    November 22, 2009 @ 5:13 am

    […] information, secret keys md-hashed with transaction ID for you to check, etc. You can read all the information about Click2Sell.EU API on our […]

  5. iphone ringtone maker Said,

    May 12, 2010 @ 4:19 pm

    I have to say that http://www.click2sell.eu is really a good website

RSS feed for comments on this post

Leave a Comment