在Paypal上安装适用于Express Checkout API的Merchant SDK

时间:2014-06-22 13:42:30

标签: php paypal composer-php

正如标题所示,我正在尝试在Paypal上安装适用于Express Checkout API的Merchant SDK。

composer.json

{
    "name": "paypal/merchant-sdk-php",
    "description": "PayPal Merchant SDK for PHP",
    "keywords": ["paypal", "php", "sdk"],
    "homepage": "https://developer.paypal.com",
    "license": "proprietary",
    "authors": [
        {
            "name": "PayPal",
            "homepage": "https://github.com/paypal/merchant-sdk-php/contributors"
        }
    ],
    "require": {
              "php": ">=5.3",
              "ext-curl": "*",
              "paypal/merchant-sdk-php":"v3.6.106"
            },
    "autoload": {
        "psr-0": {
            "PayPal\\Service": "lib/",
            "PayPal\\CoreComponentTypes": "lib/",
            "PayPal\\EBLBaseComponents": "lib/",
            "PayPal\\EnhancedDataTypes": "lib/",
            "PayPal\\PayPalAPI": "lib/"
        }
    } 
}

当我运行composer update时,这是我得到的错误:

Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package paypal/merchant-sdk-php 1.0.0 could not be found.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your min
imum-stability setting
   see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> f
or more details.

Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common
 problems.

我尝试安装另一个包,即按钮管理器SDK。这需要我将"require"中的最后一行更改为"paypal/buttonmanager-sdk-php":"v3.6.106" 这很有用。

我不知道为什么在商家SDK的情况下搜索版本1.0.0并报告无法找到它的错误。

我正在从官方网页here

中接受我的指示

请提供有关我的问题的见解,如果需要,请询问任何其他信息。

1 个答案:

答案 0 :(得分:1)

composer.json中只保留所需的内容。如果您只创建需要通过composer安装的组件/包,则需要定义名称,描述,关键字等。

因此,对于您的项目需要任何包,只需保留包名称和版本名称。因此,composer.json看起来像

{
    "require": {
         "paypal/merchant-sdk-php": "3.6.106"
    }
}

或者,您可以通过composer require paypal/merchant-sdk-php并提供版本名称。