Jump to content

Squarespace variable for discount code (promo code)

Recommended Posts

I am trying to setup integration with an affiliate program. I'm sending an XHR to the affiliate on order confirmation (using the code-injection tool), but I can't figure out what the SquareSpace variable is to get the discount code. I need to include this in the JSON I'm sending. Does anyone know what that variable is called?
What I have already is below. I've tested it with hardcoded data to confirm that it does work correctly, but I need to know what that "coupon" variable is on the SquareSpace side.

<script type="text/javascript">
  let request = new XMLHttpRequest;
  request.open("POST", "AFFILIATE_LINK");
  request.setRequestHeader('Api-Key', 'APIKEY');
  request.setRequestHeader('Content-Type', 'application/json');
  request.send(JSON.stringify({
      "coupon": promoCodeThatINeedFromSquareSpace,
      "amount": {orderSubtotal},
      "customer_id": {customerEmailAddress},
      "external_id": {orderID}
  }));
</script>

 

Thanks in advance for any help!

Link to comment
  • 1 year later...
  • Replies 1
  • Views 682
  • Created
  • Last Reply

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.