MySLP_PayPal_Payments
extends MySLP_Payment_Processor
in package
Class MySLP_PayPal_Payments
PayPal NVP Recurring Payment Methods
BAUpdate BillOutstandingAmount CreateBillingAgreement CreateRecurringPaymentsProfile DoReferenceTransaction GetBillingAgreementCustomerDetails — Deprecated after version 54.0 GetRecurringPaymentsProfileDetails ManageRecurringPaymentsProfileStatus SetCustomerBillingAgreement — Deprecated after version 54.0 UpdateRecurringPaymentsProfile
An example return after a successful payment agreement was created: $result = {array} [71] TOKEN = "EC-2B956808BL176770H" BILLINGAGREEMENTACCEPTEDSTATUS = "1" CHECKOUTSTATUS = "PaymentActionNotInitiated" TIMESTAMP = "2017-03-23T16:58:19Z" CORRELATIONID = "d1c5975547ca8" ACK = "SUCCESS" VERSION = "93" BUILD = "31426570" EMAIL = "syntax@slp.guru" PAYERID = "BJFZUJEP27HK6" PAYERSTATUS = "verified" FIRSTNAME = "Syntax" LASTNAME = "Conf" COUNTRYCODE = "US" SHIPTONAME = "Syntax Conf" SHIPTOSTREET = "1 Main St" SHIPTOCITY = "San Jose" SHIPTOSTATE = "CA" SHIPTOZIP = "95131" SHIPTOCOUNTRYCODE = "US" SHIPTOCOUNTRYNAME = "United States" ADDRESSSTATUS = "Confirmed" CURRENCYCODE = "USD" AMT = "1.00" ITEMAMT = "1.00" SHIPPINGAMT = "0.00" HANDLINGAMT = "0.00" TAXAMT = "0.00" CUSTOM = "MySLP Advanced plan is billed at $1.00 / month until cancelled." INSURANCEAMT = "0.00" SHIPDISCAMT = "0.00" L_NAME0 = "Advanced" L_QTY0 = "1" L_TAXAMT0 = "0.00" L_AMT0 = "1.00" L_DESC0 = "MySLP Advanced plan is billed at $1.00 / month until cancelled." L_ITEMWEIGHTVALUE0 = " 0.00000" L_ITEMLENGTHVALUE0 = " 0.00000" L_ITEMWIDTHVALUE0 = " 0.00000" L_ITEMHEIGHTVALUE0 = " 0.00000" L_ITEMCATEGORY0 = "Digital" PAYMENTREQUEST_0_CURRENCYCODE = "USD" PAYMENTREQUEST_0_AMT = "1.00" PAYMENTREQUEST_0_ITEMAMT = "1.00" PAYMENTREQUEST_0_SHIPPINGAMT = "0.00" PAYMENTREQUEST_0_HANDLINGAMT = "0.00" PAYMENTREQUEST_0_TAXAMT = "0.00" PAYMENTREQUEST_0_CUSTOM = "MySLP Advanced plan is billed at $1.00 / month until cancelled." PAYMENTREQUEST_0_INSURANCEAMT = "0.00" PAYMENTREQUEST_0_SHIPDISCAMT = "0.00" PAYMENTREQUEST_0_INSURANCEOPTIONOFFERED = "false" PAYMENTREQUEST_0_SHIPTONAME = "Syntax Conf" PAYMENTREQUEST_0_SHIPTOSTREET = "1 Main St" PAYMENTREQUEST_0_SHIPTOCITY = "San Jose" PAYMENTREQUEST_0_SHIPTOSTATE = "CA" PAYMENTREQUEST_0_SHIPTOZIP = "95131" PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE = "US" PAYMENTREQUEST_0_SHIPTOCOUNTRYNAME = "United States" PAYMENTREQUEST_0_ADDRESSSTATUS = "Confirmed" L_PAYMENTREQUEST_0_NAME0 = "Advanced" L_PAYMENTREQUEST_0_QTY0 = "1" L_PAYMENTREQUEST_0_TAXAMT0 = "0.00" L_PAYMENTREQUEST_0_AMT0 = "1.00" L_PAYMENTREQUEST_0_DESC0 = "MySLP Advanced plan is billed at $1.00 / month until cancelled." L_PAYMENTREQUEST_0_ITEMWEIGHTVALUE0 = " 0.00000" L_PAYMENTREQUEST_0_ITEMLENGTHVALUE0 = " 0.00000" L_PAYMENTREQUEST_0_ITEMWIDTHVALUE0 = " 0.00000" L_PAYMENTREQUEST_0_ITEMHEIGHTVALUE0 = " 0.00000" L_PAYMENTREQUEST_0_ITEMCATEGORY0 = "Digital" PAYMENTREQUESTINFO_0_ERRORCODE = "0" IS_GOOD = true
Table of Contents
Properties
- $addon : object
- $myslp : MySLP
- $name : mixed
- $slplus : SLPlus
- $uses_myslp : bool
- $uses_slplus : bool
- $slug : mixed
- $api_endpoint : mixed
- $options : mixed
- $paypal_url : mixed
Methods
- __construct() : mixed
- __get() : SLPlus_BaseClass_Object
- __isset() : bool
- call_paypal_api() : array<string|int, mixed>
- Call the PayPal subscription API for the given method.
- cancel_subscription() : mixed
- Cancel an existing subscription.
- change_subscription() : mixed
- Change an existing subscription.
- create_subscription() : mixed
- Create a subscription for a user.
- get_api_options() : mixed
- Get the paypal options.
- get_api_version() : string
- Return the PayPal API version.
- get_customer_details() : null
- Stub for get customer details.
- get_instance() : static
- Return an instance of the object which is also registered to the slplus global less the SLP_ part.
- get_recurring_payment_token() : string
- Get a token from PayPal for setting up a recurring payment.
- get_subscription_details() : mixed
- Get the subscription details direct from the payment processor.
- is_ready() : bool
- Is this processor ready? Check base settings and return true if it is ready to go.
- set_billing_desc() : mixed|void
- Set the billing desc. Must match in SetExpressCheckout and CreateRecurringPaymentsProfile
- set_properties() : mixed
- Set our properties.
- initialize() : mixed
- Do these things when this object is invoked. Override in your class.
- get_api_request_options() : array<string|int, mixed>
- Get the API request options
Properties
$addon
public
object
$addon
$myslp
public
MySLP
$myslp
$name
public
mixed
$name
= 'paypal'
$slplus
public
SLPlus
$slplus
$uses_myslp
public
bool
$uses_myslp
Set to true to add a $myslp property pointing to global $myslp
$uses_slplus
public
bool
$uses_slplus
Set to true (default) if the object needs access to the SLPlus plugin object.
$slug
protected
mixed
$slug
$api_endpoint
private
mixed
$api_endpoint
$options
private
mixed
$options
$paypal_url
private
mixed
$paypal_url
Methods
__construct()
public
__construct([array<string|int, mixed> $options = array() ]) : mixed
Parameters
- $options : array<string|int, mixed> = array()
__get()
public
__get(string $property) : SLPlus_BaseClass_Object
Parameters
- $property : string
Return values
SLPlus_BaseClass_Object__isset()
public
__isset(string $property) : bool
Parameters
- $property : string
Return values
boolcall_paypal_api()
Call the PayPal subscription API for the given method.
public
call_paypal_api([array<string|int, mixed> $body = array() ]) : array<string|int, mixed>
Parameters
- $body : array<string|int, mixed> = array()
Return values
array<string|int, mixed>cancel_subscription()
Cancel an existing subscription.
public
cancel_subscription() : mixed
It should return a WP_Error if there are any problems.
change_subscription()
Change an existing subscription.
public
change_subscription(string $new_plan) : mixed
For PayPal we only get a PayPal token (which associates a new plan) and go away to PayPal. The return from their checkout process will have the same token.
It should return a WP_Error if there are any problems.
Parameters
- $new_plan : string
create_subscription()
Create a subscription for a user.
public
create_subscription(WP_REST_Request $request) : mixed
This method should talk to the payment processor to setup a recurring billing agreement.
It should return an array with the details of the billing agreement that came back from the processor.
It should return a WP_Error if there are any problems.
Parameters
- $request : WP_REST_Request
get_api_options()
Get the paypal options.
public
get_api_options() : mixed
get_api_version()
Return the PayPal API version.
public
get_api_version() : string
Return values
stringget_customer_details()
Stub for get customer details.
public
get_customer_details(string $customer_id) : null
Parameters
- $customer_id : string
Return values
nullget_instance()
Return an instance of the object which is also registered to the slplus global less the SLP_ part.
public
static get_instance([bool $no_global = false ][, mixed $params = array() ]) : static
Parameters
- $no_global : bool = false
-
set to true to skip assigning object to SLP global as a property.
- $params : mixed = array()
-
object init params
Return values
staticget_recurring_payment_token()
Get a token from PayPal for setting up a recurring payment.
public
get_recurring_payment_token(string $plan, string $return_url, string $cancel_url[, string $email = '' ]) : string
Parameters
- $plan : string
- $return_url : string
- $cancel_url : string
- $email : string = ''
Tags
Return values
string —the token if OK, empty string if not.
get_subscription_details()
Get the subscription details direct from the payment processor.
public
get_subscription_details(string $subscription_id) : mixed
Parameters
- $subscription_id : string
is_ready()
Is this processor ready? Check base settings and return true if it is ready to go.
public
is_ready() : bool
Return values
boolset_billing_desc()
Set the billing desc. Must match in SetExpressCheckout and CreateRecurringPaymentsProfile
public
set_billing_desc(mixed $plan, mixed $price) : mixed|void
Parameters
- $plan : mixed
- $price : mixed
Return values
mixed|voidset_properties()
Set our properties.
public
set_properties([array<string|int, mixed> $options = array() ]) : mixed
Parameters
- $options : array<string|int, mixed> = array()
initialize()
Do these things when this object is invoked. Override in your class.
protected
initialize() : mixed
get_api_request_options()
Get the API request options
private
get_api_request_options() : array<string|int, mixed>