Documentation for Coupon Code endpoint?
Jolg42 opened this issue · comments
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...!
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.
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.
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..
@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.