Shopify 收据和退款按钮灰显
Shopify Receipt and refund button grayed out
我正在将 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
";
}
在我与 shopify 支持技术人员讨论了这个情况后,我会将此标记为已解决。他表示,任何不是来自 POS 的交易都将通过 POS 接收和退款的选项变灰。但是,您仍然可以通过商店后端的管理面板访问这些功能。
我正在将 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
"; }
在我与 shopify 支持技术人员讨论了这个情况后,我会将此标记为已解决。他表示,任何不是来自 POS 的交易都将通过 POS 接收和退款的选项变灰。但是,您仍然可以通过商店后端的管理面板访问这些功能。