Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for Coupon Code endpoint? #11

Open
Jolg42 opened this issue Nov 2, 2016 · 4 comments
Open

Documentation for Coupon Code endpoint? #11

Jolg42 opened this issue Nov 2, 2016 · 4 comments

Comments

@Jolg42
Copy link

Jolg42 commented Nov 2, 2016

Hi!

The only documentation I found is https://github.com/fastspring/fastspring-api/blob/master/sections/misc.mdown

And there are no doc about the parameters & infos needed to create a coupon...

By the is it doable in JSON instead of XML? It would be easier in javascript...!

@Jolg42
Copy link
Author

Jolg42 commented Nov 9, 2016

I found a more complete documentation on https://docs.fastspring.com/integrating-with-fastspring/fastspring-api

But it's not clear which parts of the API are for the "Classic" or "Contextual" store product.

@shanetj
Copy link

shanetj commented Nov 9, 2016

Hi Joel,

I responded to you via Email within our Ticketing system, but it sounds like you didn't receive my response.

This was my response -

Hi Joel,

I received your request in GitHub about this issue below.

You are currently on our Classic system and in our API we do not have that functionality.

We are currently working towards a Contextual Platform that has better API handling.
Take a look at the following documentation -
https://docs.fastspring.com/integrating-with-fastspring/fastspring-api

If it's crucial to your business, we can create a contextual store for you so you could use all the API functionality if needed.

To answer your second question. Everything on docs.fastspring.com is for Contextual.

@hopewise
Copy link

hopewise commented Jan 9, 2019

I am on classical store, I am not able to generate random coupon, based on this doc setting prefix to the new coupon name, I get this error:

Coupon not found.

it seems that I have to provide a pre-existing coupon? and if do so, I get this error:

Coupon is not the correct type.

what I need to do, is to create new codes on the fly..

@Jolg42
Copy link
Author

Jolg42 commented Jan 9, 2019

@hopewise Here is a complete example that works for me:

      var couponURL = 'https://api.fastspring.com/company/REPLACE_BY_YOUR_COMPANY_LOGIN/coupon/REPLACE_WITH_COUPON_NAME/generate'

      var httpOptions = {
        url: couponURL,
        method: 'POST',
        json: false,
        headers: {
          'Authorization': 'Basic REPLACE_BY_AUTH'
        }
      }

      request(httpOptions, function (err, httpResp, body) {
        ...
      }

It returns an XML though.
See https://support.fastspring.com/hc/en-us/articles/207436366-Generating-a-Random-Coupon-using-an-API

It's recommended that you create a new user on your account and use these credentials for auth.
REPLACE_BY_AUTH is username:password encoded in base64.

If my final coupon code is FREE-CSYDK, REPLACE_WITH_COUPON_NAME is FREE- for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants