Overview

Namespaces

  • mcfedr
    • Paypal
      • Exceptions
      • Notifications
      • Products
  • PHP

Classes

  • Authentication
  • Buyer
  • Paypal
  • Settings
  • Overview
  • Namespace
  • Class
  • Tree

Class Paypal

This class is used for generation of buttons and handling of paypal responses

Namespace: mcfedr\Paypal
Located at mcfedr/Paypal/Paypal.php
Methods summary
public
# __construct( mcfedr\Paypal\Authentication $authentication, mcfedr\Paypal\Settings $settings = null )

Create a new paypal object

Create a new paypal object

Parameters

$authentication
mcfedr\Paypal\Authentication
$authentication
$settings
mcfedr\Paypal\Settings
$settings
public string
# getButton( mcfedr\Paypal\Products\Subscription|mcfedr\Paypal\Products\CartProduct|mcfedr\Paypal\Products\CartProduct[] $products, string $paidURL, string $cancelURL, string $notifyURL = null, integer $invoiceId = null, string $custom = null, mcfedr\Paypal\Buyer $buyer = null, string $label = "Checkout" )

Get a button as html Use getButtonParams and getButtonAction if you need to customise

Get a button as html Use getButtonParams and getButtonAction if you need to customise

Parameters

$products
mcfedr\Paypal\Products\Subscription|mcfedr\Paypal\Products\CartProduct|mcfedr\Paypal\Products\CartProduct[]
$products
$paidURL
string
$paidURL URL paypal returns user to when completed
$cancelURL
string
$cancelURL URL to return to if user cancels payment
$notifyURL
string
$notifyURL URL for instant notifications
$invoiceId
integer
$invoiceId Your id for this payment, must be unique
$custom
string
$custom Custom data that will be in any notifications
$buyer
mcfedr\Paypal\Buyer
$buyer Info about the buyer to autofill in
$label
string
$label Label for the button

Returns

string
html form with a button
public array
# getButtonParams( mcfedr\Paypal\Products\Subscription|mcfedr\Paypal\Products\CartProduct|mcfedr\Paypal\Products\CartProduct[] $products, string $paidURL, string $cancelURL, string $notifyURL = null, integer $invoiceId = null, string $custom = null, mcfedr\Paypal\Buyer $buyer = null )

Get paypal button params for this payment Should be posted to url getButtonAction use <input type="hidden" name="$key" value="$value" /> for each element of the array returned

Get paypal button params for this payment Should be posted to url getButtonAction use <input type="hidden" name="$key" value="$value" /> for each element of the array returned

Parameters

$products
mcfedr\Paypal\Products\Subscription|mcfedr\Paypal\Products\CartProduct|mcfedr\Paypal\Products\CartProduct[]
$products
$paidURL
string
$paidURL URL paypal returns user to when completed
$cancelURL
string
$cancelURL URL to return to if user cancels payment
$notifyURL
string
$notifyURL URL for instant notifications
$invoiceId
integer
$invoiceId Your id for this payment, must be unique
$custom
string
$custom Custom data that will be in any notifications
$buyer
mcfedr\Paypal\Buyer
$buyer Info about the buyer to autofill in

Returns

array
of string
public string
# getButtonAction( )

Get form action to go with the params from getButtonParams

Get form action to go with the params from getButtonParams

Returns

string
public mcfedr\Paypal\Notifications\Notification
# handleNotification( array $vars = null )

Call this function on your instant notification url (IN) And success url to use payment data transfer (PDT)

Call this function on your instant notification url (IN) And success url to use payment data transfer (PDT)

Parameters

$vars
array
$vars variables to use, normally $_POST

Returns

mcfedr\Paypal\Notifications\Notification

Throws

mcfedr\Paypal\Exceptions\CurlException
mcfedr\Paypal\Exceptions\NotificationVerificationException
mcfedr\Paypal\Exceptions\NotificationInvalidException
public boolean
# sendPayment( string|string[] $email, float|double[] $amount, string|string[] $id = '', string|string[] $note = '', string $subject = null )

Send a payment to an email address Users MassPayments API Warning, this works straight away, no confirming or anything Money is sent instantly

Send a payment to an email address Users MassPayments API Warning, this works straight away, no confirming or anything Money is sent instantly

Parameters

$email
string|string[]
$email one or more email addresses to send payment to
$amount
float|double[]
$amount amount(s) to send to each address
$id
string|string[]
$id unique id for the payment(s)
$note
string|string[]
$note note to the user(s)
$subject
string
$subject subject for email

Returns

boolean
whether succesful or not

Throws

mcfedr\Paypal\Exceptions\CurlException
mcfedr\Paypal\Exceptions\MasspayException
public boolean
# refundPayment( string $transactionId, string $invoiceId = null, string $type = 'Full' )

Refund the payment

Refund the payment

Parameters

$transactionId
string
$transactionId id
$invoiceId
string
$invoiceId optional internal payment id
$type
string
$type currently only Full is supported

Returns

boolean
successful

Throws

mcfedr\Paypal\Exceptions\RefundException
mcfedr\Paypal\Exceptions\UnsupportedRefundException
Paypal API documentation generated by ApiGen 2.8.0