【问题标题】:paypal PPAPIService new SDKpaypal PPAPIService 新SDK
【发布时间】:2012-09-14 19:26:07
【问题描述】:

关于新的 Paypal SDK,几乎没有有用的示例代码,互联网上充斥着旧 SDK 的示例。我的问题涉及对我通过权限 API 获得令牌和 secretToken 的第三方贝宝帐户发出 API 请求。

在尝试构造 PPAPIService 对象时,可能的服务名称列表在哪里?
即:$this->serviceName = $serviceName; (在构造函数中)这些的字符串语法是什么?

关于makeRequest方法,如何定义$apiMethod变量,$params变量的格式是什么?有哪些不同的参数?

如何获取授权第三方账户的账户余额的简单示例将非常有帮助。 我正在使用 PHP。

来自 PPAPIService.php 文件:

class PPAPIService
{
public $endpoint;
public $serviceName;
private $logger;

public function __construct($serviceName = "")
{
    $this->serviceName = $serviceName; //is there ANY documentation about the syntax and types of service names?
    $config = PPConfigManager::getInstance();
    $this->endpoint = $config->get('service.EndPoint');
    $this->logger = new PPLoggingManager(__CLASS__);
}

public function setServiceName($serviceName)
{
    $this->serviceName = $serviceName;
}


public function makeRequest($apiMethod, $params, $apiUsername = null, $accessToken = null, $tokenSecret = null)
{
//what are the apiMethod types? syntax? and params? type.. options...??
}
}

【问题讨论】:

    标签: api sdk paypal


    【解决方案1】:

    好吧,您不必直接创建 PPAPIService 对象。假设您想使用 Invoicing SDK,您会这样做

    $invoiceService = new InvoiceService();
    $invoiceService->setAccessToken($accessToken);
    $invoiceService->setTokenSecret($tokenSecret);
    $createInvoiceResponse = $invoiceService->CreateInvoice($createInvoiceRequest);
    

    每个 API 都有一个服务类(例如此代码 sn-p 中的 InvoiceService),您可以根据需要对其进行实例化。 API 用户名/密码是从配置文件中挑选出来的,访问令牌/令牌密码是通过代码设置的,因为它们通常对于不同的调用往往是不同的。

    顺便问一下,您要调用哪个 API?

    【讨论】:

      【解决方案2】:

      为了回答您的其他问题,新的 PayPal SDK 将所有必需的示例都捆绑在 SDK 本身中。 SDK + 示例可从

      下载

      https://www.x.com/developers/paypal/documentation-tools/paypal-sdk-index

      【讨论】:

        猜你喜欢
        • 2016-03-21
        • 2016-10-30
        • 2021-09-17
        • 2020-06-30
        • 2014-10-26
        • 2013-03-21
        • 2014-11-23
        • 2014-02-14
        • 2018-02-08
        相关资源
        最近更新 更多