1. Go to this page and download the library: Download gatioo/yotpo library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
// retrieving the utoken - will be valid for 24 hours
$credentials = $yotpo->get_oauth_token();
$utoken = $credentials->access_token;
// first creating the products that are in the order, notice that the key of the product hash is the product_sku
$products = array(
"BLABLA1" => array(
'url' => "http://shop.yotpo.com/products/amazing-yotpo-poster",
'name' => "Yotpo Amazing Poster",
'image_url' => "http://cdn.shopify.com/s/files/1/0098/1912/products/qa2_medium.png?41",
'description' => "this is the most awesome poster in the world!",
'price' => "100"
)
);
//now we will create a purchase using this the token we have received in the previous step
$response = $yotpo->create_purchase(array( 'app_key' => $ak,
'utoken' => $utoken,
'email' => "[email protected]",
'customer_name' => "bob",
'order_id' => "13444",
'platform' => "Shopify",
'order_date' => "2013-05-28",
'products' => $products,
'currency_iso' => "USD"
));