對於發現此帖的任何人,都支持REST API。
從RestGateway.php
摘錄在源代碼中完整文檔
- 貝寶的REST API在兩個環境中支持找到。使用沙箱環境
- 用於測試目的,然後移至生產環境進行生產處理。
- 測試時,使用您的測試憑證生成訪問令牌,以撥打
- Sandbox URI。當您開始投入使用時,請使用分配給您的應用的實時憑證
- 來生成一個新的訪問令牌,以便與實時URI一起使用。
提交 https://github.com/thephpleague/omnipay-paypal/pull/21
// Create a gateway for the PayPal RestGateway
// (routes to GatewayFactory::create)
$gateway = Omnipay::create('RestGateway');
// Initialise the gateway
$gateway->initialize(array(
'clientId' => 'MyPayPalClientId',
'secret' => 'MyPayPalSecret',
'testMode' => true, // Or false when you are ready for live transactions
));
// Create a credit card object
// DO NOT USE THESE CARD VALUES -- substitute your own
// see the documentation in the class header.
$card = new CreditCard(array(
'firstName' => 'Example',
'lastName' => 'User',
'number' => '4111111111111111',
'expiryMonth' => '01',
'expiryYear' => '2020',
'cvv' => '123',
'billingAddress1' => '1 Scrubby Creek Road',
'billingCountry' => 'AU',
'billingCity' => 'Scrubby Creek',
'billingPostcode' => '4999',
'billingState' => 'QLD',
));
// Do an authorisation transaction on the gateway
$transaction = $gateway->authorize(array(
'amount' => '10.00',
'currency' => 'AUD',
'description' => 'This is a test authorize transaction.',
'card' => $card,
));
$response = $transaction->send();
if ($response->isSuccessful()) {
echo "Authorize transaction was successful!\n";
// Find the authorization ID
$auth_id = $response->getTransactionReference();
}
從RestAuthorizeRequest.php
你已經獲得瞭解決? PayPal提供的測試簽名不起作用,您遇到過這種情況嗎? –