iqnection-modules / paypalpayment
SilverStripe PayPal Payment
Installs: 6
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Type:silverstripe-vendormodule
Requires
- iqnection-modules/payment: ^2.0
- silverstripe/framework: ^4.0
This package is auto-updated.
Last update: 2024-09-29 04:19:48 UTC
README
#IQnection PayPal Payment
extends IQnection\Payment\Payment
When using PayPal Payment, you must implement a page and controller
in your model page file, declare the extension
class MyPayPalPage extends Page
{
private static $extensions = [
IQnection\PayPalPayment\PayPalPage\PageExtension::class
];
}
in your page controller file, declare the handler as an extension
class MyPayPalPageController extends PageController
{
private static $extensions = [
IQnection\PayPalPayment\Controller\PaymentHandler::class
];
}
the handler methods are now a part of your page controller
In your template, create your PayPal form and specify your IPN add some JavaScript to auto-submit the form
when PayPal sends the IPN response, it will be send to the same page the payment was submitted from you can implement OnSuccessfulPayment method in your page controller to handle the payment upon success eg:
public function OnSuccessfulPayment($Payment,$data)
{
if ( (isset($data['item_number'])) && ($submission = MyPageSubmission()->byID($data['item_number'])) )
{
$submission->PaymentID = $Payment->ID;
$submission->write();
}
}
upon successful payment from PayPal, the user will be redirected back to your page calling action /thanks