Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

No Way To Check Coupon Codes Via Api ? Rate Topic   - - - - -

 
  • lesan
  • Member
  • Members
  • Join Date: 06-Sep 13
  • 29 posts

Posted 30 August 2014 - 02:03 AM #1

I can not find a way to use the CS-Cart API for checking if a Coupon-Code is still useable, NOR even if it does exist.

I am wondering why? This functionality should be onboard.

Or do I just miss how to do it ? http://docs.cs-cart..../api/index.html

The only way I see by now is using the Orders Object, but this even have no filters, only way is to get ALL Orders.

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11336 posts

Posted 30 August 2014 - 04:34 AM #2

Can you explain the use-case to check if a coupon code exists and is active as it relates to an API?

Note that there are many aspects of promotions that can only really be evaluated in real-time and runtime.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • lesan
  • Member
  • Members
  • Join Date: 06-Sep 13
  • 29 posts

Posted 30 August 2014 - 08:25 PM #3

Hello tbirnseth,

we have an external affiliate marketing app which is showing coupons which only can be used 1 time. When the coupon has been used, we have to hide it on that app and prepare to show the next one. Therefore we need a way to check the coupon is still available like every 10 seconds.

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11336 posts

Posted 30 August 2014 - 08:59 PM #4

Okay, that makes sense for a need. But not sure I'd make that the api's responsibility.
Why don't just write a small web-service (in my-changes or another addon) that will respond quickly to your specific needs? It would be a lot more efficient, especially if you're going to invoke it every 10 seconds. The api has quite a bit of overhead to it since it needs to account for many things.

In fact, I'd probably just do this as a stand-alone web-service running on the site with little to no cart overhead. It would consist or returning true/false based on a single DB query.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • lesan
  • Member
  • Members
  • Join Date: 06-Sep 13
  • 29 posts

Posted 08 September 2014 - 10:48 PM #5

Thanks for answer tbirnseth, I have been off for a while - I looked into the functions, but they does not seem to work without the $cart var. Is there a internal function which can give me the result of the amount rule of a coupon code ?

Kind regards

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11336 posts

Posted 08 September 2014 - 11:04 PM #6

No, as I said, this is all done dynamically in the cart calculation (versus anything outside the cart).
You would have to write a function to query the db table cscart_promotions for the promotion you want info for (note it will be based on promotion_id).

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • lesan
  • Member
  • Members
  • Join Date: 06-Sep 13
  • 29 posts

Posted 07 April 2015 - 11:14 PM #7

I hope this will be possible soon, this is essential for make cs-cart work with affiliate programms.

 

Posted 26 August 2019 - 10:14 AM #8

Hello all,

 

I'm in a process of extending current API for a new mobile application.

 

I have faced an issue similar to this.

 

But this is for same promotions feature which is on the website. 

 

My approach would be to create a separate entity as Promotions just to perform necessary checking for promotions codes.After validation I return new cart values to be shown on the app.

 

I would like to know your suggestions on this approach. 

 

Are there better way of implementing promotion code validation/ implementation  via API?

 

Thanks in advance

 

 



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11336 posts

Posted 26 August 2019 - 07:08 PM #9

I would probably use a different entity name than Promotions just to ensure future compatibility in case cs-cart decides to implement.

 

Is your intent to synthesize a cart on cs-cart and then to return the discount value to your app?  Might suggest using an iFrame instead versus trying to manage all the various business rules and criteria.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 

Posted 27 August 2019 - 10:41 AM #10

Thank you for your suggestion I would chose a different name in that case,

 

Yes, my intention is to do the same.

 

The problem with iFrame is how it will be implemented with a native mobile app? 

 

For me I see no other option but to go with a new API entity.

 

Thank you,