0

Any guidance or an example of exactly what I need to do to return the information below would be great. I'm using js, jquery & HTML

  1. I need to add this: Content-Type header is application/json
  2. When the request comes I need to reply with the Json below

https://docs.snipcart.com/configuration/json-crawler#validating-the-request

When Snipcart makes the request to the URL, if your response Content-Type header is application/json, we'll use our JSON validator instead of the HTML one.

You must return us a JSON having the following properties.

{
  "id": "20",
  "price": 50.00,
  "url": "https://snipcart.com/products/1.json"
}
user2238083
  • 583
  • 2
  • 9
  • 21

1 Answers1

0

I ended up doing this in PHP and getting the values using the URL.

<?php
    header('Content-Type: application/json');

    $myID = $_REQUEST['scene'];
    $myPrice = $_REQUEST['price'];

    $data = [
      "id" => $myID,
      "price" => $myPrice,
      "url" => "https://yoursite.com/shop/test/snipcart.php" 
    ];
    echo json_encode( $data );
?>
user2238083
  • 583
  • 2
  • 9
  • 21