第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

WooCommerce Rest API 端點(diǎn),用于獲取與特定客戶相關(guān)的所有訂閱

WooCommerce Rest API 端點(diǎn),用于獲取與特定客戶相關(guān)的所有訂閱

PHP
qq_笑_17 2022-12-23 16:14:23
我不知道如何使用 Woocommerce API 獲得特定客戶的活躍訂閱。我有一個(gè)連接到中間層的移動(dòng)應(yīng)用程序,這個(gè)中間層需要提供用戶激活的訂閱列表。我需要知道我可以調(diào)用哪些 Woocommerce API 端點(diǎn)或端點(diǎn)組合來獲取用戶的活動(dòng)訂閱。幾天來一直在努力解決這個(gè)問題。請(qǐng)幫忙例如,使用 WooCommerce API v1 應(yīng)該返回活動(dòng)訂閱: https://....com/wp-json/wc/v1/subscriptions?customer=1&status=active 但事實(shí)并非如此,很多用戶都缺少活動(dòng)訂閱.我也試過: 1. https://….com/wp-json/wc/v3/memberships/members 雖然這確實(shí)會(huì)返回會(huì)員資格,但它不提供產(chǎn)品 ID 等,其中許多產(chǎn)品 ID 為空會(huì)員資格“id”: 355,“customer_id”: 1,“plan_id”: 430,“status”: “active”,“order_id”: null,“product_id”: null,“subscription_id”: null,2. https://….com/wp-json/wc/v3/orders?customer=1 這也缺少訂閱和其他購買
查看完整描述

3 回答

?
MMMHUHU

TA貢獻(xiàn)1834條經(jīng)驗(yàn) 獲得超8個(gè)贊

/**

 * Register the routes for this class

 *

 * GET /customers/<id>/subscriptions

 *

 * @since 2.0

 * @param array $routes

 * @return array

 */

public function register_routes( $routes ) {

    # GET /customers/<id>/subscriptions

    $routes[ $this->base . '/(?P<id>\d+)/subscriptions' ] = array(

        array( array( $this, 'get_customer_subscriptions' ), WC_API_SERVER::READABLE ),

    );


    return $routes;

}

你的端點(diǎn)應(yīng)該是 /customers/<id>/subscriptions- 這里<id>是customer_id


WCS API 函數(shù)獲取與特定客戶相關(guān)聯(lián)的所有訂閱。


查看完整回答
反對(duì) 回復(fù) 2022-12-23
?
不負(fù)相思意

TA貢獻(xiàn)1777條經(jīng)驗(yàn) 獲得超10個(gè)贊

您可能不再尋找這個(gè),但我想我會(huì)澄清答案,因?yàn)?@mujuonly 不方便地遺漏了它僅適用于Legacy WooCommerce API. 無論如何,它已被棄用。但它現(xiàn)在有效。

  1. 在 WooCommerce -> 設(shè)置 -> 高級(jí) -> 舊版 API 中啟用舊版 API

  2. 獲取您的訪問令牌

  3. 訪問https://___.com/wc-api/v3/customers/<customer_id>/subscriptions/

截至目前,我沒有看到本機(jī) API 支持類似此端點(diǎn)的任何內(nèi)容。希望它會(huì)在不久的將來被添加。


查看完整回答
反對(duì) 回復(fù) 2022-12-23
?
互換的青春

TA貢獻(xiàn)1797條經(jīng)驗(yàn) 獲得超6個(gè)贊

您可以使用以下方式獲得有效訂閱:

/wp-json/wc/v1/subscriptions/<id> //To get particular subscription
/wp-json/wc/v1/subscriptions //To get all subscriptions

您可以在此處獲取更多信息: https ://prospress.github.io/subscriptions-rest-api-docs/?php#list-all-subscriptions

如果您覺得有幫助,請(qǐng)告訴我。


查看完整回答
反對(duì) 回復(fù) 2022-12-23
  • 3 回答
  • 0 關(guān)注
  • 175 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)