Vendors Sell products online
How to start selling?
1 | Open free account |
2 | Add your product to Marketplace |
3 | Place payment buttons on your website |
4 | Relax and enjoy your income! |
Easier way to sell and earn more
API notifications to automate your selling
Click2Sell API will immediately notify your listening script about any new event - sales, rebillings, refunds, subscriptions and their cancelations. Automate content delivery, account creation or upgrade, customers' information collection and many more.
Instant notifications allows vendors to take their businesses to the next level as they provide extra functionality, security and save vendors' time.
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!
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.
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 vendors who want to use Click2Sell API have to visit:
For Vendor –> My Products –> Edit Settings (click on a certain product) –> API Settings
On that 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.
There is an additional 'Secret key' field as well. 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 (upper-cased). 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 in order to achieve the highest flexibility.
Click2Sell API Parameters
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 |
acquirer_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, Skrill, Google Checkout |
transaction_type | Type of transaction | Sale, Refund, Subscription, Chargeback |
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, Cancelled, Completed |
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_price_vat | Product price VAT | XX.YY e.g., 2.10 |
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 | Vendor 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 (in upper-case) |
Passing your own parameters
You can pass unlimited amount of your own parameters to Click2Sell checkout page and then have them returned to you once a purchase is completed.
In order to enable this, just add your parameters into buy link (e.g. https://www.click2sell.eu/buy?testere123) of the product:
https://www.click2sell.eu/buy?testere123&m1=[value]&m2=[value2]
(param1 & param2 are example names, you can use whatever name you need like user, id, tr9e, etc.).
API notification and sale notification email will contain your parameters with cp_ prefix in this way:
cp_param1=[value]
cp_param2=[value2].
If you have "Enable posting of Acquirer Transaction ID to "Thank you" page" enabled (For Vendor -> Edit Settings -> API Settings), your parameters will also be sent to your thank-you page by POST method.
Subscription API parameters explained
When using Click2Sell API for subscription based products you'll be receiving notifications with additional subscription_status parameter. This parameter indicates current status of a subscription. The following table describes what possible combinations of transaction_type and subscription_status parameters you will receive when particular event happens.
Event | transaction_type | subscription_status |
---|---|---|
Successful initial purchase of subscription based product | Subscription | New |
Successful re-bill (recurring transaction) | Subscription | Recurring |
Subscription cancellation (by client or vendor) | Subscription | Cancelled |
Subscription completed (end of subscription terms) | Subscription | Completed |
Refund of one of subscription's transactions | Refund | Cancelled or Completed * |
Chargeback of one of subscription's transactions | Chargeback | Cancelled or Completed * |
Click2Sell API Sample code
This code is an example code how to accept our sent notifications.
/* reading click2sell notification parameters to local variables */$acqTransId = urldecode($_POST["acquirer_transaction_id"]);$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, Skrill, 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 vendor */
$merchantUsername = urldecode($_POST["merchant_username"]);/* click2sell login name of the vendor */
$merchantUsername = urldecode($_POST["affiliate_username"]);/* click2sell login of the affiliate in case of the affiliated sale */
/* … process the necessary data …. */
?>