3

我正在实施条带结帐系统。

每次我尝试调用结帐视图时,我都会遇到一个奇怪的 javascript 错误:IntegrationError: SKUs for Checkout 需要一个name属性。

在仪表板中,用于结帐集成的按钮显示为灰色。

关于如何在创建 SKU 时传递名称的任何线索?

这是我通过条带 api curl 调用发布 SKU 的 PHP:

$sku = [
        'active' => 'true',
        'inventory' => ['type' => 'infinite', 'value' => null],
        "currency" => "eur",
        "price" => $price,
        "product" => $stripe_product_id
    ];
4

2 回答 2

3

经过多次组合,以及对条带 API 的深入分析,找到了我一直在寻找的答案。

产品创作:

$pacoteSMS = [
        'name' => $name,
        'type' => 'good',
        'active' => 'true',
        'description' => $description,
        "attributes" => [
            "name"
        ],
    ];

SKU 创建:

$sku = [
        'product' => $stripe_product_id,
        "attributes" => [
            "name" => $name,
        ],
        "price" => $price,
        "currency" => "eur",
        "inventory" => [
            "type" => "infinite",
        ],
        "active" => "true",
    ];
于 2019-05-22T09:32:33.623 回答
1

nameattributes位于 SKU 对象的内部。您可以attributes[name]在创建或更新 SKU 时进行设置。例如:

'attributes' => ['name' => 'the name'],

于 2019-05-21T18:59:03.317 回答