API経由で注文を追加する方法は?
投稿:http://www.namedoseusite.com.br/api_ds_orders.php?action=add_orders
<テーブルスタイル= "幅:100%;">
パラメーター | フォーマット | 説明 | |
products_id | json | APIを使用して注文データをリストしてproduct_id 形式を取得します:int(11)< /td> | |
products_quantity | json | 数量番号 番号のみが必要です< /td> | |
製品 | json | products_id&amp; Products_Quantity | |
deliviry_firstname | json | firstName フォーマット:varchar(255) *フィールドが必要< /td> | |
delivery_lastname | json | lastName 形式:varchar(255) * field execly < /td> | |
DERVILY_STREET_ADDRESS | json | Streetアドレス 形式:Varchar(255) *フィールドが必要< /td> | |
delivery_number | json | 配送番号 形式:varchar(255) *フィールドが必要< /td> | |
delivery_suburb | json | 郊外 フォーマット:varchar(255) *フィールドが必要< /td> | |
DERVILY_CITY | json |
|
|
delivery_postcode | json | post code 形式:varchar(11) *フィールドが必要< /td> | |
DERVILY_COUNTRY | json | 国名 フォーマット:varchar(255) * field execly < /td> | |
DERVILY_STATE | json | state name 形式:varchar(2) *フィールドが必要< /td> | |
payment_method | json | apiを支払いに使用してください | |
shipping_method | json | APIを使用してcalculate_shipping フォーマット:varchar(255) *必要< /td> |
phpサンプル
//サンプルadd_orders
$ url = $ tabain_url。 &#39; /api_ds_orders.php?action = add_orders&#39 ;;
$ data_products [0] = array( "products_id" =&gt; "215"、//例:130(番号のみが必要) *フィールドが必要です
「Products_Quantity」=&gt; 「1」//例:1(番号のみが必要です) *フィールドが必要です
);$ data_products [1] = array( "products_id" =&gt; "215"、//例:130(番号のみが必要) *フィールドが必要です
「Products_Quantity」=&gt; 「1」//例:1(番号のみが必要です) *フィールドが必要です
);$ data = array( "products" =&gt; $ data_products、// * field required
"deliviry_firstname" =&gt; utf8_encode( "name")、//例:name(firstName) *フィールドが必須
"delivery_lastname" =&gt; utf8_encode( "surname")、//例:surname(lastname) *フィールドが必須
"Deliviry_street_address" =&gt; utf8_encode( "strend address")、//例:通りの住所(通りの住所) *フィールドが必須
「delivery_number」=&gt; 「123」、//例:123(配達番号) *フィールドが必要
"delivery_suburb" =&gt; utf8_encode( "郊外")、//例:郊外(郊外) *フィールドが必要
"delivery_city" =&gt; utf8_encode( "sao paulo")、//例:sao paulo(city) *フィールドが必須
"Deliviry_PostCode" =&gt; 「04267000」、//例:04267000(郵便番号) *フィールドが必要
"delivery_country" =&gt; utf8_encode( "brazil")、//例:ブラジル(国) *フィールドが必須
"delivery_state" =&gt; utf8_encode( "sp")、//例:sp(state) *フィールドが必須
"Payment_method" =&gt; 「PayPal_Standard」、//例:PayPal_Standard(支払い方法) *フィールドが必要
「shipping_method」=&gt; 「Sedex」//例:Sedex(配送方法) *フィールドが必要
);$ data_string = json_encode($ date);
// print_r($ data_string);
// die;$ ch = curl_init($ url);
curl_setopt($ ch、curlopt_customrequest、 "post");
curl_setopt($ ch、curlopt_postfields、$ data_string);
curl_setopt($ ch、curlopt_returntransfer、true);
curl_setopt($ ch、curlopt_ssl_verifypeer、false);
curl_setopt($ ch、curlopt_httpheader、array(
&#39; content-type:application/json&#39;、
「キャッシュコントロール:キャッシュなし」、
&#39;トークン:&#39; 。 base64_encode($ token)、
&#39;秘密:&#39; 。 base64_encode($ secret)、
&#39;電子メール:&#39; 。 base64_encode($ email)、
&#39;コンテンツレングス:&#39; 。 strlen($ data_string)))
);$ result = curl_exec($ ch);
curl_close($ ch);print_r($ result);
//サンプルadd_orders eof戻りエラー:
code
メッセージ< /p>戻り成功:
code
products_model
products_id
メッセージ< /p>