This PHP class library for PayPal makes it easy to integrate PayPal APIs, including the Payments Standard Button Manager, Adaptive Accounts, Adaptive Payments, Invoicing, General Merchant APIs, and Permissions.
- PHP version 5.3.0 or newer.
- cURL
Create a composer.json file with the following section and run composer update.
"require": {
"php": ">=5.3.0",
"ext-curl": "*",
"angelleye/paypal-php-library": "2.0.*"
}
- Download the class library and extract the contents do a directory in your project structure.
- Upload the files to your web server.
Open /samples/config/config-sample.php, fill out your details accordingly, and save-as config.php to a location of your choice.
To use the library in your project, include the following into your file(s).
- /path/to/config.php (It is recommended that you move this to a directory outside your site root on the web server and use an absolute path to include it.)
- autoload.php
-
Open the template file that corresponds to the API call you'd like to make.
- Example: If we want to make a call to the RefundTransaction API we open up /templates/RefundTransaction.php
-
You may leave the file here, or save this file to the location on your web server where you'd like this call to be made.
- I like to save the files to a separate location and keep the ones included with the library as empty templates.
- Note that you can also copy/paste the template code into your own file(s).
-
Each template file prepares the PayPal class object for you and includes PHP arrays for every parameter available to that particular API. Simply fill in the array parameters with your own dynamic (or static) data. This data may come from:
- Session Variables
- General Variables
- Database Recordsets
- Static Values
- Etc.
-
When you run the file you will get a $PayPalResult array that consists of all the response parameters from PayPal, original request parameters sent to PayPal, and raw request/response info for troubleshooting.
- You may refer to the PayPal API Reference Guide for details about what response parameters you can expect to get back from any successful API request.
- Example: When working with RefundTransaction, I can see that PayPal will return a REFUNDTRANSACTIONID, FEEREFUNDAMT, etc. As such, I know that those values will be included in $PayPalResult['REFUNDTRANSACTIONID'] and $PayPalResult['FEEREFUNDAMT'] respectively.
- You may refer to the PayPal API Reference Guide for details about what response parameters you can expect to get back from any successful API request.
-
If errors occur they will be available in $PayPalResult['ERRORS']
You may refer to this overview video of how to use the library, and there are also samples provided in the /samples directory as well as blank templates ready to use under /templates.
If you need additional help you may place an order for premium support.
- BMButtonSearch
- BMCreateButton
- BMGetButtonDetails
- BMGetInventory
- BMManageButtonStatus
- BMSetInventory
- BMUpdateButton
- CancelPreapproval
- ConvertCurrency
- ExecutePayment
- GetFundingPlans
- GetPaymentOptions
- GetShippingAddresses
- Pay
- PayWithOptions
- PaymentDetails
- Preapproval
- PreapprovalDetails
- Refund
- SetPaymentOptions
- CancelInvoice
- CreateAndSendInvoice
- CreateInvoice
- DeleteInvoice
- GenerateInvoiceNumber
- GetInvoiceDetails
- MarkInvoiceAsPaid
- MarkInvoiceAsRefunded
- MarkInvoiceAsUnpaid
- RemindInvoice
- SearchInvoices
- SendInvoice
- UpdateInvoice
- AddressVerify
- BAUpdate
- BillOutstandingAmount
- Callback (Express Checkout)
- CreateBillingAgreement
- CreateRecurringPaymentsProfile
- DoAuthorization
- DoCapture
- DoDirectPayment
- DoExpressCheckoutPayment
- DoNonReferencedCredit
- DoReauthorization
- DoReferenceTransaction
- DoVoid
- GetBalance
- GetBillingAgreementCustomerDetails
- GetExpressCheckoutDetails
- GetPalDetails
- GetRecurringPaymentsProfileDetails
- GetRecurringPaymentsProfileStatus
- GetTransactionDetails
- ManagePendingTransactionStatus
- ManageRecurringPaymentsProfileStatus
- MassPay
- RefundTransaction
- SetCustomerBillingAgreement
- SetExpressCheckout
- TransactionSearch
- UpdateRecurringPaymentsProfile
- CancelPermissions
- GetAccessToken
- GetAdvancedPersonalData
- GetBasicPersonalData
- GetPermissions
- RequestPermissions
- FinancingBannerEnrollment
- DoMobileCheckoutPayment
- GetAccessPermissionsDetails
- GetAuthDetails
- SetAccessPermissions
- SetAuthFlowParam
- SetMobileCheckout
- UpdateAccessPermissions
- Payments Standard Button Manager Guide
- Adaptive Accounts Developer Guide
- Adaptive Payments Developer Guide
- Express Checkout Integration Guide
- Invoice Service API Guide
- Mass Payments User Guide
- PayPal Merchant Setup and Administration Guide
- PayPal Payments Pro Documentation
- PayPal Recurring Billing / Recurring Payments Guide