Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Contains helper class to work with PayPal REST API.

Copyright: 2020 Shamim Rezaie <shamim@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 196 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

paypal_helper:: (5 methods):
  __construct()
  capture_authorization()
  capture_order()
  get_order_details()
  get_token()


Class: paypal_helper  - X-Ref

__construct(string $clientid, string $secret, bool $sandbox)   X-Ref
helper constructor.

param: string $clientid The client id.
param: string $secret PayPal secret.
param: bool $sandbox Whether we are working with the sandbox environment or not.

capture_authorization(string $authorizationid, float $amount, string $currency, bool $final = true)   X-Ref
Captures an authorized payment, by ID.

param: string $authorizationid The PayPal-generated ID for the authorized payment to capture.
param: float $amount The amount to capture.
param: string $currency The currency code for the amount.
param: bool $final Indicates whether this is the final captures against the authorized payment.
return: array|null Formatted API response.

capture_order(string $orderid)   X-Ref
Captures order details from PayPal.

param: string $orderid The order we want to capture.
return: array|null Formatted API response.

get_order_details(string $orderid)   X-Ref
No description

get_token()   X-Ref
Request for PayPal REST oath bearer token.

return: string