我正在将shopify集成到我管理的网站之一,这是一个送货网站。我正在使用API来创建包含数据库中项目的订单。 \
发出订单时,将根据从我们网站选择的网关(现金,支票或信用卡)进行交易。此交易的订单发送到我们的商店,可以在POS应用程序上看到。
问题是我无法访问POS应用程序中的退款或收据按钮。我可以使用shopify后端退款,但不能在POS上退款。这是令人烦恼的,是我能够在我们的网站上实现此功能之前唯一剩下的事情。
以下是发送的订单代码
$order = array( 'fulfillment_status' => 'fulfilled', 'send_receipt' => 'true', 'send_fulfillment_receipt' => 'true', ); // Second part of order with items and customer if($ShippingQuantity !== 0.00){ $order2 = array('line_items' => array( array('title' => 'Shipping', 'price' => '10', 'quantity' => $ShippingQuantity, ) ) ); } if($HandlingQuantity !== 0.00){ $order3 =array('title' => 'Handling', 'price' => '5', 'quantity' => $HandlingQuantity, ); $order2['line_items'][] = $order3; } if($DutyQuantity !== 0.00){ $order4 =array('title' => 'Duty', 'price' => '0.01', 'quantity' => $DutyQuantity, ); $order2['line_items'][] = $order4; } if($ConsolidationQuantity !== 0.00){ $order5 =array('title' => 'Consolidation', 'price' => '10', 'quantity' => $ConsolidationQuantity, ); $order2['line_items'][] = $order5; } if($DeliveryQuantity !== 0.00){ $order6 =array('title' => 'Delivery', 'price' => '20', 'quantity' => $DeliveryQuantity, ); $order2['line_items'][] = $order6; } $customerandtrans = array('customer' => array( 'id' => $currentcustID, ),'note' =>'purchase made at '.$pickup.'', 'transactions' => array( array('amount' => $Total, 'gateway' => $gateway, ) ) ); $final = array_merge($order,$order2,$customerandtrans); $finaljson = json_encode($final); } } $ch = curl_init($baseUrl.'orders.json'); //set the url $data_string = json_encode(array('order'=>$final)); //encode the product as json curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); //specify this as a POST curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); //set the POST string curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //specify return value as string curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Content-Length: ' . strlen($data_string)) ); //specify that this is a JSON call $server_output = curl_exec ($ch); //get server output if you wish to error handle / debug curl_close ($ch); //close the connection //var_dump($data_string); //var_dump($server_output); $decoded = json_decode($server_output,true); //var_dump($decoded); $reg_id = $decoded['order']['id']; $amount = $decoded['order']['total_price']; if($reg_id){ echo "An order has been created with ID $reg_id
";
这是交易代码
$order_target2="orders/".$reg_id."/transactions.json"; $trans = array('kind' => 'sale', 'receipt' => array( 'testcase' => 'true', 'authorization' => '123456',),); $ch = curl_init($baseUrl.$order_target2); //set the url $data_string = json_encode(array('transaction'=>$trans)); //encode the product as json curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); //specify this as a POST curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); //set the POST string curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //specify return value as string curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Content-Length: ' . strlen($data_string)) ); //specify that this is a JSON call $server_output = curl_exec ($ch); //get server output if you wish to error handle / debug curl_close ($ch); //close the connection //var_dump($data_string); //var_dump($server_output); $decoded = json_decode($server_output,true); //var_dump($decoded); $order_id = $decoded['transaction']['order_id']; if($order_id){ echo "Transaction successfully made at order $order_id
"; }
答案 0 :(得分:1)
在我与shopify支持技术人员谈到有关情况后,我会将此标记为已解决。他表示,任何非来自POS的交易都将通过POS显示收到和退款的选项。但是,您仍然可以通过商店后端的管理面板访问这些功能。