0
shopify를 관리하는 웹 사이트 중 하나 인 배송 웹 사이트에 통합하려고합니다. API를 사용하여 데이터베이스의 항목으로 주문을 만듭니다. \Shopify 영수증 및 환불 버튼이 회색으로 표시됨
주문이 발행되면 당사 웹 사이트에서 선택한 게이트웨이 (현금, 수표 또는 신용)를 기준으로 거래가 이루어집니다. 거래와 관련된이 주문은 상점에 보내지고 POS 응용 프로그램에서 볼 수 있습니다.
문제는 POS 응용 프로그램에서 환불 또는 영수증 버튼에 액세스 할 수 없다는 것입니다. 나는 shopify 백 엔드를 사용하여 환불 할 수 있지만 POS는 환불 할 수 없습니다. 이것은 당황스럽고 웹 사이트에이 기능을 구현하기 전에 남은 유일한 것입니다. 다음은
이 트랜잭션 코드$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입니다
"; }
$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
";
전송되는 주문 코드