Open Journal Systems  3.3.0
Omnipay\PayPal\Message\RestCreatePlanRequest Class Reference
Inheritance diagram for Omnipay\PayPal\Message\RestCreatePlanRequest:
Omnipay\PayPal\Message\AbstractRestRequest Omnipay\Common\Message\AbstractRequest Omnipay\Common\Message\RequestInterface Omnipay\Common\Message\MessageInterface

Public Member Functions

 getData ()
 
 getData ()
 
 getMerchantPreferences ()
 
 getMerchantPreferences ()
 
 getName ()
 
 getName ()
 
 getPaymentDefinitions ()
 
 getPaymentDefinitions ()
 
 getType ()
 
 getType ()
 
 setMerchantPreferences (array $value)
 
 setMerchantPreferences (array $value)
 
 setName ($value)
 
 setName ($value)
 
 setPaymentDefinitions (array $value)
 
 setPaymentDefinitions (array $value)
 
 setType ($value)
 
 setType ($value)
 
- 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 Create Plan Request

PayPal offers merchants a /billing-plans resource for providing billing plans to users for recurring payments.

After the billing plan is created, the /billing-agreements resource provides billing agreements so that users can agree to be billed for the plans.

You can create an empty billing plan and add a trial period and/or regular billing. Alternatively, you can create a fully loaded plan that includes both a trial period and regular billing. Note: By default, a created billing plan is in a CREATED state. A user cannot subscribe to the billing plan unless it has been set to the ACTIVE state.

Request Data

In order to create a new billing plan you must submit the following details:

  • name (string). Required.
  • description (string). Required.
  • type (string). Allowed values: FIXED, INFINITE. Required.
  • payment_definitions (array)
  • merchant_preferences (object)

Example

// 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 create plan transaction on the gateway $transaction = $gateway->createPlan(array( 'name' => 'Test Plan', 'description' => 'A plan created for testing', 'type' => $gateway::BILLING_PLAN_TYPE_FIXED, 'paymentDefinitions' => [ [ 'name' => 'Monthly Payments for 12 months', 'type' => $gateway::PAYMENT_TRIAL, 'frequency' => $gateway::BILLING_PLAN_FREQUENCY_MONTH, 'frequency_interval' => 1, 'cycles' => 12, 'amount' => ['value' => 10.00, 'currency' => 'USD'], ], ], )); $response = $transaction->send(); if ($response->isSuccessful()) { echo "Create Plan transaction was successful!\n"; $plan_id = $response->getTransactionReference(); echo "Plan reference = " . $plan_id . "\n"; }

Request Sample

This is from the PayPal web site:

curl -v POST https://api.sandbox.paypal.com/v1/payments/billing-plans \ -H 'Content-Type:application/json' \ -H 'Authorization: Bearer <Access-Token>' \ -d '{ "name": "T-Shirt of the Month Club Plan", "description": "Template creation.", "type": "fixed", "payment_definitions": [ { "name": "Regular Payments", "type": "REGULAR", "frequency": "MONTH", "frequency_interval": "2", "amount": { "value": "100", "currency": "USD" }, "cycles": "12", "charge_models": [ { "type": "SHIPPING", "amount": { "value": "10", "currency": "USD" } }, { "type": "TAX", "amount": { "value": "12", "currency": "USD" } } ] } ], "merchant_preferences": { "setup_fee": { "value": "1", "currency": "USD" }, "return_url": "http://www.return.com", "cancel_url": "http://www.cancel.com", "auto_bill_amount": "YES", "initial_fail_amount_action": "CONTINUE", "max_fail_attempts": "0" } }'

Response Sample

This is from the PayPal web site:

{ "id": "P-94458432VR012762KRWBZEUA", "state": "CREATED", "name": "T-Shirt of the Month Club Plan", "description": "Template creation.", "type": "FIXED", "payment_definitions": [ { "id": "PD-50606817NF8063316RWBZEUA", "name": "Regular Payments", "type": "REGULAR", "frequency": "Month", "amount": { "currency": "USD", "value": "100" }, "charge_models": [ { "id": "CHM-55M5618301871492MRWBZEUA", "type": "SHIPPING", "amount": { "currency": "USD", "value": "10" } }, { "id": "CHM-92S85978TN737850VRWBZEUA", "type": "TAX", "amount": { "currency": "USD", "value": "12" } } ], "cycles": "12", "frequency_interval": "2" } ], "merchant_preferences": { "setup_fee": { "currency": "USD", "value": "1" }, "max_fail_attempts": "0", "return_url": "http://www.return.com", "cancel_url": "http://www.cancel.com", "auto_bill_amount": "YES", "initial_fail_amount_action": "CONTINUE" }, "create_time": "2014-07-31T17:41:55.920Z", "update_time": "2014-07-31T17:41:55.920Z", "links": [ { "href": "https://api.sandbox.paypal.com/v1/payments/billing-plans/P-94458432VR012762KRWBZEUA", "rel": "self", "method": "GET" } ] }

Omnipay PayPal REST Create Plan Request PayPal offers merchants a /billing-plans resource for providing billing plans to users for recurring payments. After the billing plan is created, the /billing-agreements resource provides billing agreements so that users can agree to be billed for the plans. You can create an empty billing plan and add a trial period and/or regular billing. Alternatively, you can create a fully loaded plan that includes both a trial period and regular billing. Note: By default, a created billing plan is in a CREATED state. A user cannot subscribe to the billing plan unless it has been set to the ACTIVE state. autotoc_md81 Request Data In order to create a new billing plan you must submit the following details: name (string). Required.description (string). Required.type (string). Allowed values: FIXED, INFINITE. Required.payment_definitions (array)merchant_preferences (object) autotoc_md82 Example // 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 create plan transaction on the gateway $transaction = $gateway->createPlan(array( 'name' => 'Test Plan', 'description' => 'A plan created for testing', 'type' => $gateway::BILLING_PLAN_TYPE_FIXED, 'paymentDefinitions' => [ [ 'name' => 'Monthly Payments for 12 months', 'type' => $gateway::PAYMENT_TRIAL, 'frequency' => $gateway::BILLING_PLAN_FREQUENCY_MONTH, 'frequency_interval' => 1, 'cycles' => 12, 'amount' => ['value' => 10.00, 'currency' => 'USD'], ], ], )); $response = $transaction->send(); if ($response->isSuccessful()) { echo "Create Plan transaction was successful!\n"; $plan_id = $response->getTransactionReference(); echo "Plan reference = " . $plan_id . "\n"; } autotoc_md83 Request Sample This is from the PayPal web site: curl -v POST https://api.sandbox.paypal.com/v1/payments/billing-plans \ -H 'Content-Type:application/json' \ -H 'Authorization: Bearer <Access-Token>' \ -d '{ "name": "T-Shirt of the Month Club Plan", "description": "Template creation.", "type": "fixed", "payment_definitions": [ { "name": "Regular Payments", "type": "REGULAR", "frequency": "MONTH", "frequency_interval": "2", "amount": { "value": "100", "currency": "USD" }, "cycles": "12", "charge_models": [ { "type": "SHIPPING", "amount": { "value": "10", "currency": "USD" } }, { "type": "TAX", "amount": { "value": "12", "currency": "USD" } } ] } ], "merchant_preferences": { "setup_fee": { "value": "1", "currency": "USD" }, "return_url": "http://www.return.com", "cancel_url": "http://www.cancel.com", "auto_bill_amount": "YES", "initial_fail_amount_action": "CONTINUE", "max_fail_attempts": "0" } }' autotoc_md84 Response Sample This is from the PayPal web site: { "id": "P-94458432VR012762KRWBZEUA", "state": "CREATED", "name": "T-Shirt of the Month Club Plan", "description": "Template creation.", "type": "FIXED", "payment_definitions": [ { "id": "PD-50606817NF8063316RWBZEUA", "name": "Regular Payments", "type": "REGULAR", "frequency": "Month", "amount": { "currency": "USD", "value": "100" }, "charge_models": [ { "id": "CHM-55M5618301871492MRWBZEUA", "type": "SHIPPING", "amount": { "currency": "USD", "value": "10" } }, { "id": "CHM-92S85978TN737850VRWBZEUA", "type": "TAX", "amount": { "currency": "USD", "value": "12" } } ], "cycles": "12", "frequency_interval": "2" } ], "merchant_preferences": { "setup_fee": { "currency": "USD", "value": "1" }, "max_fail_attempts": "0", "return_url": "http://www.return.com", "cancel_url": "http://www.cancel.com", "auto_bill_amount": "YES", "initial_fail_amount_action": "CONTINUE" }, "create_time": "2014-07-31T17:41:55.920Z", "update_time": "2014-07-31T17:41:55.920Z", "links": [ { "href": "https://api.sandbox.paypal.com/v1/payments/billing-plans/P-94458432VR012762KRWBZEUA", "rel": "self", "method": "GET" } ] } https://developer.paypal.com/docs/api/#create-a-plan Omnipay

Definition at line 195 of file lib/vendor/omnipay/paypal/src/Message/RestCreatePlanRequest.php.

Member Function Documentation

◆ getData() [1/2]

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

◆ getData() [2/2]

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

◆ getEndpoint() [1/2]

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

Get transaction endpoint.

Billing plans are created using the /billing-plans resource.

Returns
string

Reimplemented from Omnipay\PayPal\Message\AbstractRestRequest.

Definition at line 319 of file lib/vendor/omnipay/paypal/src/Message/RestCreatePlanRequest.php.

◆ getEndpoint() [2/2]

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

Get transaction endpoint.

Billing plans are created using the /billing-plans resource.

Returns
string

Reimplemented from Omnipay\PayPal\Message\AbstractRestRequest.

Definition at line 319 of file vendor/omnipay/paypal/src/Message/RestCreatePlanRequest.php.

◆ getMerchantPreferences() [1/2]

Omnipay\PayPal\Message\RestCreatePlanRequest::getMerchantPreferences ( )

Get the plan merchant preferences

See the class documentation and the PayPal REST API documentation for a description of the array elements.

Returns
array https://developer.paypal.com/docs/api/#merchantpreferences-object

Definition at line 278 of file vendor/omnipay/paypal/src/Message/RestCreatePlanRequest.php.

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

◆ getMerchantPreferences() [2/2]

Omnipay\PayPal\Message\RestCreatePlanRequest::getMerchantPreferences ( )

Get the plan merchant preferences

See the class documentation and the PayPal REST API documentation for a description of the array elements.

Returns
array https://developer.paypal.com/docs/api/#merchantpreferences-object

Definition at line 278 of file lib/vendor/omnipay/paypal/src/Message/RestCreatePlanRequest.php.

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

Referenced by Omnipay\PayPal\Message\RestCreatePlanRequest\getData().

◆ getName() [1/2]

Omnipay\PayPal\Message\RestCreatePlanRequest::getName ( )

◆ getName() [2/2]

Omnipay\PayPal\Message\RestCreatePlanRequest::getName ( )

◆ getPaymentDefinitions() [1/2]

Omnipay\PayPal\Message\RestCreatePlanRequest::getPaymentDefinitions ( )

Get the plan payment definitions

See the class documentation and the PayPal REST API documentation for a description of the array elements.

Returns
array https://developer.paypal.com/docs/api/#paymentdefinition-object

Definition at line 249 of file lib/vendor/omnipay/paypal/src/Message/RestCreatePlanRequest.php.

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

Referenced by Omnipay\PayPal\Message\RestCreatePlanRequest\getData().

◆ getPaymentDefinitions() [2/2]

Omnipay\PayPal\Message\RestCreatePlanRequest::getPaymentDefinitions ( )

Get the plan payment definitions

See the class documentation and the PayPal REST API documentation for a description of the array elements.

Returns
array https://developer.paypal.com/docs/api/#paymentdefinition-object

Definition at line 249 of file vendor/omnipay/paypal/src/Message/RestCreatePlanRequest.php.

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

◆ getType() [1/2]

Omnipay\PayPal\Message\RestCreatePlanRequest::getType ( )

◆ getType() [2/2]

Omnipay\PayPal\Message\RestCreatePlanRequest::getType ( )

◆ setMerchantPreferences() [1/2]

Omnipay\PayPal\Message\RestCreatePlanRequest::setMerchantPreferences ( array  $value)

Set the plan merchant preferences

See the class documentation and the PayPal REST API documentation for a description of the array elements.

Parameters
array$value
Returns
RestCreatePlanRequest provides a fluent interface. https://developer.paypal.com/docs/api/#merchantpreferences-object

Definition at line 293 of file vendor/omnipay/paypal/src/Message/RestCreatePlanRequest.php.

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

◆ setMerchantPreferences() [2/2]

Omnipay\PayPal\Message\RestCreatePlanRequest::setMerchantPreferences ( array  $value)

Set the plan merchant preferences

See the class documentation and the PayPal REST API documentation for a description of the array elements.

Parameters
array$value
Returns
RestCreatePlanRequest provides a fluent interface. https://developer.paypal.com/docs/api/#merchantpreferences-object

Definition at line 293 of file lib/vendor/omnipay/paypal/src/Message/RestCreatePlanRequest.php.

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

◆ setName() [1/2]

Omnipay\PayPal\Message\RestCreatePlanRequest::setName (   $value)

Set the plan name

Parameters
string$value
Returns
RestCreatePlanRequest provides a fluent interface.

Definition at line 213 of file lib/vendor/omnipay/paypal/src/Message/RestCreatePlanRequest.php.

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

◆ setName() [2/2]

Omnipay\PayPal\Message\RestCreatePlanRequest::setName (   $value)

Set the plan name

Parameters
string$value
Returns
RestCreatePlanRequest provides a fluent interface.

Definition at line 213 of file vendor/omnipay/paypal/src/Message/RestCreatePlanRequest.php.

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

◆ setPaymentDefinitions() [1/2]

Omnipay\PayPal\Message\RestCreatePlanRequest::setPaymentDefinitions ( array  $value)

Set the plan payment definitions

See the class documentation and the PayPal REST API documentation for a description of the array elements.

Parameters
array$value
Returns
RestCreatePlanRequest provides a fluent interface. https://developer.paypal.com/docs/api/#paymentdefinition-object

Definition at line 264 of file vendor/omnipay/paypal/src/Message/RestCreatePlanRequest.php.

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

◆ setPaymentDefinitions() [2/2]

Omnipay\PayPal\Message\RestCreatePlanRequest::setPaymentDefinitions ( array  $value)

Set the plan payment definitions

See the class documentation and the PayPal REST API documentation for a description of the array elements.

Parameters
array$value
Returns
RestCreatePlanRequest provides a fluent interface. https://developer.paypal.com/docs/api/#paymentdefinition-object

Definition at line 264 of file lib/vendor/omnipay/paypal/src/Message/RestCreatePlanRequest.php.

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

◆ setType() [1/2]

Omnipay\PayPal\Message\RestCreatePlanRequest::setType (   $value)

◆ setType() [2/2]

Omnipay\PayPal\Message\RestCreatePlanRequest::setType (   $value)

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