0

新しいPaypalSDKに関しては、有用なサンプルコードはほとんどなく、インターネットには古い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...??
}
}
4

2 に答える 2

3

さて、PPAPIServiceオブジェクトを直接作成する必要はありません。Invoicing SDKを使用したいとします。これが、あなたが行うことです。

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

APIごとに1つのサービスクラス(このコードスニペットのInvoiceServiceなど)があり、必要に応じてインスタンス化します。APIユーザー名/パスワードは構成ファイルから選択され、アクセストークン/トークンシークレットは通常、呼び出しごとに異なる傾向があるため、コードを介して設定されます。

ちなみに、どのAPIを呼び出そうとしていますか?

于 2012-09-24T16:06:09.500 に答える
0

他の懸念に答えるために、新しいPayPal SDKには、必要なすべてのサンプルがSDK自体にバンドルされています。SDK+サンプルはからダウンロードできます

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

于 2012-09-27T16:36:24.247 に答える