Open Monograph Press  3.3.0
Omnipay\PayPal\Message\RestCompleteSubscriptionRequest Class Reference
Inheritance diagram for Omnipay\PayPal\Message\RestCompleteSubscriptionRequest:
Omnipay\PayPal\Message\AbstractRestRequest Omnipay\Common\Message\AbstractRequest Omnipay\Common\Message\RequestInterface Omnipay\Common\Message\MessageInterface

Public Member Functions

 getData ()
 
 getData ()
 
- Public Member Functions inherited from Omnipay\PayPal\Message\AbstractRestRequest
 getClientId ()
 
 getClientId ()
 
 getPayerId ()
 
 getPayerId ()
 
 getSecret ()
 
 getSecret ()
 
 getToken ()
 
 getToken ()
 
 sendData ($data)
 
 sendData ($data)
 
 setClientId ($value)
 
 setClientId ($value)
 
 setPayerId ($value)
 
 setPayerId ($value)
 
 setSecret ($value)
 
 setSecret ($value)
 
 setToken ($value)
 
 setToken ($value)
 
 toJSON ($data, $options=0)
 
 toJSON ($data, $options=0)
 
- Public Member Functions inherited from Omnipay\Common\Message\AbstractRequest
 __construct (ClientInterface $httpClient, HttpRequest $httpRequest)
 
 __construct (ClientInterface $httpClient, HttpRequest $httpRequest)
 
 formatCurrency ($amount)
 
 formatCurrency ($amount)
 
 getAmount ()
 
 getAmount ()
 
 getAmountInteger ()
 
 getAmountInteger ()
 
 getCancelUrl ()
 
 getCancelUrl ()
 
 getCard ()
 
 getCard ()
 
 getCardReference ()
 
 getCardReference ()
 
 getClientIp ()
 
 getClientIp ()
 
 getCurrency ()
 
 getCurrency ()
 
 getCurrencyDecimalPlaces ()
 
 getCurrencyDecimalPlaces ()
 
 getCurrencyNumeric ()
 
 getCurrencyNumeric ()
 
 getDescription ()
 
 getDescription ()
 
 getIssuer ()
 
 getIssuer ()
 
 getItems ()
 
 getItems ()
 
 getNotifyUrl ()
 
 getNotifyUrl ()
 
 getParameters ()
 
 getPaymentMethod ()
 
 getPaymentMethod ()
 
 getResponse ()
 
 getResponse ()
 
 getReturnUrl ()
 
 getReturnUrl ()
 
 getTestMode ()
 
 getTestMode ()
 
 getTransactionId ()
 
 getTransactionId ()
 
 getTransactionReference ()
 
 getTransactionReference ()
 
 initialize (array $parameters=array())
 
 initialize (array $parameters=array())
 
 send ()
 
 send ()
 
 setAmount ($value)
 
 setAmount ($value)
 
 setAmountInteger ($value)
 
 setCancelUrl ($value)
 
 setCancelUrl ($value)
 
 setCard ($value)
 
 setCard ($value)
 
 setCardReference ($value)
 
 setCardReference ($value)
 
 setClientIp ($value)
 
 setClientIp ($value)
 
 setCurrency ($value)
 
 setCurrency ($value)
 
 setDescription ($value)
 
 setDescription ($value)
 
 setIssuer ($value)
 
 setIssuer ($value)
 
 setItems ($items)
 
 setItems ($items)
 
 setMoney (Money $value)
 
 setNotifyUrl ($value)
 
 setNotifyUrl ($value)
 
 setPaymentMethod ($value)
 
 setPaymentMethod ($value)
 
 setReturnUrl ($value)
 
 setReturnUrl ($value)
 
 setTestMode ($value)
 
 setTestMode ($value)
 
 setTransactionId ($value)
 
 setTransactionId ($value)
 
 setTransactionReference ($value)
 
 setTransactionReference ($value)
 
 toFloat ($value)
 
 validate ()
 

Protected Member Functions

 getEndpoint ()
 
 getEndpoint ()
 
- Protected Member Functions inherited from Omnipay\PayPal\Message\AbstractRestRequest
 createResponse ($data, $statusCode)
 
 createResponse ($data, $statusCode)
 
 getHttpMethod ()
 
 getHttpMethod ()
 
- Protected Member Functions inherited from Omnipay\Common\Message\AbstractRequest
 getCurrencies ()
 
 getParameter ($key)
 
 setParameter ($key, $value)
 
 setParameter ($key, $value)
 

Additional Inherited Members

- Data Fields inherited from Omnipay\PayPal\Message\AbstractRestRequest
const API_VERSION = 'v1'
 
- Protected Attributes inherited from Omnipay\PayPal\Message\AbstractRestRequest
 $liveEndpoint = 'https://api.paypal.com'
 
 $payerId = null
 
 $testEndpoint = 'https://api.sandbox.paypal.com'
 
- Protected Attributes inherited from Omnipay\Common\Message\AbstractRequest
 $currencies
 
 $httpClient
 
 $httpRequest
 
 $negativeAmountAllowed = false
 
 $parameters
 
 $response
 
 $zeroAmountAllowed = true
 

Detailed Description

PayPal REST Complete Subscription Request

Use this call to execute an agreement after the buyer approves it.

Note: This request is only necessary for PayPal payments. Billing agreements for credit card payments execute automatically at the time of creation and so this request is not necessary for credit card payments.

Request Data

Pass the token in the URI of a POST call to execute the subscription agreement after buyer approval. You can find the token in the execute link returned by the request to create a billing agreement.

No other data is required.

Example

To create the agreement, see the code example in RestCreateSubscriptionRequest.

At the completion of a createSubscription call, the customer should be redirected to the redirect URL contained in $response->getRedirectUrl(). Once the customer has approved the agreement and be returned to the returnUrl in the call. The returnUrl can contain the following code to complete the agreement:

// Create a gateway for the PayPal REST Gateway // (routes to GatewayFactory::create) $gateway = Omnipay::create('PayPal_Rest');

// Initialise the gateway $gateway->initialize(array( 'clientId' => 'MyPayPalClientId', 'secret' => 'MyPayPalSecret', 'testMode' => true, // Or false when you are ready for live transactions ));

// Do a complete subscription transaction on the gateway $transaction = $gateway->completeSubscription(array( 'transactionReference' => $subscription_id, )); $response = $transaction->send(); if ($response->isSuccessful()) { echo "Complete Subscription transaction was successful!\n"; $subscription_id = $response->getTransactionReference(); echo "Subscription reference = " . $subscription_id; }

Note that the subscription_id that you get from calling the response's getTransactionReference() method at the end of the completeSubscription call will be different to the one that you got after calling the response's getTransactionReference() method at the end of the createSubscription call. The one that you get from completeSubscription is the correct one to use going forwards (e.g. for cancelling or updating the subscription).

Request Sample

This is from the PayPal web site:

curl -v POST https://api.sandbox.paypal.com/v1/payments/billing-agreements/EC-0JP008296V451950C/agreement-execute \ -H 'Content-Type:application/json' \ -H 'Authorization: Bearer <Access-Token>' \ -d '{}'

Response Sample

This is from the PayPal web site:

{ "id": "I-0LN988D3JACS", "links": [ { "href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-0LN988D3JACS", "rel": "self", "method": "GET" } ] }

RestCreateSubscriptionRequest Omnipay PayPal REST Complete Subscription Request Use this call to execute an agreement after the buyer approves it. Note: This request is only necessary for PayPal payments. Billing agreements for credit card payments execute automatically at the time of creation and so this request is not necessary for credit card payments. autotoc_md68 Request Data Pass the token in the URI of a POST call to execute the subscription agreement after buyer approval. You can find the token in the execute link returned by the request to create a billing agreement. No other data is required. autotoc_md69 Example To create the agreement, see the code example in RestCreateSubscriptionRequest. At the completion of a createSubscription call, the customer should be redirected to the redirect URL contained in $response->getRedirectUrl(). Once the customer has approved the agreement and be returned to the returnUrl in the call. The returnUrl can contain the following code to complete the agreement: // Create a gateway for the PayPal REST Gateway // (routes to GatewayFactory::create) $gateway = Omnipay::create('PayPal_Rest'); // Initialise the gateway $gateway->initialize(array( 'clientId' => 'MyPayPalClientId', 'secret' => 'MyPayPalSecret', 'testMode' => true, // Or false when you are ready for live transactions )); // Do a complete subscription transaction on the gateway $transaction = $gateway->completeSubscription(array( 'transactionReference' => $subscription_id, )); $response = $transaction->send(); if ($response->isSuccessful()) { echo "Complete Subscription transaction was successful!\n"; $subscription_id = $response->getTransactionReference(); echo "Subscription reference = " . $subscription_id; } Note that the subscription_id that you get from calling the response's getTransactionReference() method at the end of the completeSubscription call will be different to the one that you got after calling the response's getTransactionReference() method at the end of the createSubscription call. The one that you get from completeSubscription is the correct one to use going forwards (e.g. for cancelling or updating the subscription). autotoc_md70 Request Sample This is from the PayPal web site: curl -v POST https://api.sandbox.paypal.com/v1/payments/billing-agreements/EC-0JP008296V451950C/agreement-execute \ -H 'Content-Type:application/json' \ -H 'Authorization: Bearer <Access-Token>' \ -d '{}' autotoc_md71 Response Sample This is from the PayPal web site: { "id": "I-0LN988D3JACS", "links": [ { "href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-0LN988D3JACS", "rel": "self", "method": "GET" } ] } https://developer.paypal.com/docs/api/#execute-an-agreement RestCreateSubscriptionRequest Omnipay

Definition at line 98 of file lib/vendor/omnipay/paypal/src/Message/RestCompleteSubscriptionRequest.php.

Member Function Documentation

◆ getData() [1/2]

Omnipay\PayPal\Message\RestCompleteSubscriptionRequest::getData ( )

Get the raw data array for this message. The format of this varies from gateway to gateway, but will usually be either an associative array, or a SimpleXMLElement.

Returns
mixed

Implements Omnipay\Common\Message\MessageInterface.

Definition at line 100 of file lib/vendor/omnipay/paypal/src/Message/RestCompleteSubscriptionRequest.php.

References Omnipay\Common\Message\AbstractRequest\validate().

◆ getData() [2/2]

Omnipay\PayPal\Message\RestCompleteSubscriptionRequest::getData ( )

Get the raw data array for this message. The format of this varies from gateway to gateway, but will usually be either an associative array, or a SimpleXMLElement.

Returns
mixed

Implements Omnipay\Common\Message\MessageInterface.

Definition at line 100 of file vendor/omnipay/paypal/src/Message/RestCompleteSubscriptionRequest.php.

References Omnipay\Common\Message\AbstractRequest\validate().

◆ getEndpoint() [1/2]

Omnipay\PayPal\Message\RestCompleteSubscriptionRequest::getEndpoint ( )
protected

Get transaction endpoint.

Subscriptions are executed using the /billing-agreements resource.

Returns
string

Reimplemented from Omnipay\PayPal\Message\AbstractRestRequest.

Definition at line 115 of file vendor/omnipay/paypal/src/Message/RestCompleteSubscriptionRequest.php.

References Omnipay\Common\Message\AbstractRequest\getTransactionReference().

◆ getEndpoint() [2/2]

Omnipay\PayPal\Message\RestCompleteSubscriptionRequest::getEndpoint ( )
protected

Get transaction endpoint.

Subscriptions are executed using the /billing-agreements resource.

Returns
string

Reimplemented from Omnipay\PayPal\Message\AbstractRestRequest.

Definition at line 115 of file lib/vendor/omnipay/paypal/src/Message/RestCompleteSubscriptionRequest.php.

References Omnipay\Common\Message\AbstractRequest\getTransactionReference().


The documentation for this class was generated from the following file: