Giter Site home page Giter Site logo

Blank Page is Showing about fetchapp HOT 10 OPEN

jasontwong avatar jasontwong commented on July 1, 2024
Blank Page is Showing

from fetchapp.

Comments (10)

jasontwong avatar jasontwong commented on July 1, 2024

Can you give a snippet of your code? It's been a while since I've used the FetchApp api and it looks like they have a single endpoint for all API requests now. Below is the code I used and I'm getting account information.

// replace $key and $token with your own
$key = 'demokey';
$token = 'demotoken';
$fetch_app = new FetchApp( 'https://app.fetchapp.com', $key, $token );
$account = $fetch_app->account();
var_dump($account);

from fetchapp.

shashankkumrawat avatar shashankkumrawat commented on July 1, 2024

Hi,,
thanks for your reply. Here is the code -

include 'Fetchapp.php';

$xml = '<?xml version="1.0" encoding="UTF-8"?>
                 <order>
                    <id>1</id>
                    <vendor_id>1554898798</vendor_id>
                   <first_name>Bugs</first_name>
                   <last_name>Bunny</last_name>
                   <email>[email protected]</email>
                   <currency>USD</currency>
                   <custom_1>Optional</custom_1>
                   <custom_2>Custom</custom_2>
                   <custom_3>Values</custom_3>
                   <expiration_date type="datetime">2010-09-07T15:08:02+00:00</expiration_date>
                   <download_limit type="integer">5</download_limit>
                   <send_email>true</send_email>
                   <order_items type="array">
                     <order_item>
                        <sku>1</sku>
                        <downloads_remaining type="integer">4</downloads_remaining>
                        <price type="float">4.99</price>
                  </order_item>
               </order_items>
  </order>';


        $fetch_app = new FetchApp( 'https://myname.fetchapp.com', 'myname', 'mytocken' );
        $new_order = simplexml_load_string($xml);
        $order_create_response = $fetch_app->orders('create', $new_order);

But this code not creating any order. However I tried your account inforamtion code which is working fine.

from fetchapp.

jasontwong avatar jasontwong commented on July 1, 2024

Have you tried to var_dump your $order_create_response? When I use your code there is an error response from Fetch.

object(SimpleXMLElement)#3 (1) {
  [0]=>
  string(51) "Order does not contain FetchApp SKUs and is ignored"
}

from fetchapp.

shashankkumrawat avatar shashankkumrawat commented on July 1, 2024

You can see in my above pasted code that I have set sku of product in xml. then why this error is coming.?

from fetchapp.

jasontwong avatar jasontwong commented on July 1, 2024

Can you var_dump your response?

var_dump($order_create_response);

from fetchapp.

shashankkumrawat avatar shashankkumrawat commented on July 1, 2024

yes, I did that and got same error-

object(SimpleXMLElement)#3 (1) { [0]=> string(51) "Order does not contain FetchApp SKUs and is ignored" } 

and if I var_dump() my xml variable i.e. $new_order, I got this-

object(SimpleXMLElement)#2 (13) { ["id"]=> string(1) "1" ["vendor_id"]=> string(10) "1554898798" ["first_name"]=> string(4) "Bugs" ["last_name"]=> string(5) "Bunny" ["email"]=> string(14) "[email protected]" ["currency"]=> string(3) "USD" ["custom_1"]=> string(8) "Optional" ["custom_2"]=> string(6) "Custom" ["custom_3"]=> string(6) "Values" ["expiration_date"]=> string(25) "2010-09-07T15:08:02+00:00" ["download_limit"]=> string(1) "5" ["send_email"]=> string(4) "true" ["order_items"]=> object(SimpleXMLElement)#4 (2) { ["@attributes"]=> array(1) { ["type"]=> string(5) "array" } ["order_item"]=> object(SimpleXMLElement)#5 (3) { ["skus"]=> string(1) "1" ["downloads_remaining"]=> string(1) "4" ["price"]=> string(4) "4.99" } } }

I have set sku of product in xml. then why this error is coming.?

from fetchapp.

shashankkumrawat avatar shashankkumrawat commented on July 1, 2024

Hello Json,

Have you understood my problem or have you any solution for my problem.?
Please let me know soon.

Thanks

from fetchapp.

jasontwong avatar jasontwong commented on July 1, 2024

The SKU id you have in your XML is 1. Do you have a product with that SKU number?

SKU numbers must match one of the products in your account in order to create a valid order with it.

from fetchapp.

shashankkumrawat avatar shashankkumrawat commented on July 1, 2024

I have only one product already created with sku 43324.
I am creating new product not updating the existing one, then why should my sku number should match with one of the product in my account.?

Although I changed sku in xml to 43324 and and then checked but still same problem there,

from fetchapp.

jasontwong avatar jasontwong commented on July 1, 2024

According to your code, you are trying to create a new order. A new order requires a valid product SKU. If you want to create a product, you have to change the endpoint and the XML to follow the specs at http://www.fetchapp.com/pages/help-api2

from fetchapp.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.