Wallogit.com
2017 © Pedro Peláez
to create paypal recurring profile and to manage it
To create paypal recurring profile, make transactions, and get the profile details, (*1)
in composer.json, write, (*2)
"saurabh-bond/recurring-payment": "dev-master"
and then update the composer, (*3)
add the location to psr-4 in your composer.json, (*4)
"SaurabhBond\\RecurringPayment\\":"vendor/saurabh-bond/recurring-payment/src"
In your controller, add this line, (*5)
use SaurabhBond\RecurringPayment\PaymentController as Bond;
then in your function or method , create the Instance of PaymentController, (*6)
$paypalObj = Bond::createObject();
(1) to create recurring profile, (*7)
call createRecurringProfile() with params as below, (*8)
$description ====> Description of goods or services associated with the billing agreement. This field is required for each recurring payment billing agreement. For ex- Recurring Profile for Viralgram Package of $ 7, (*9)
$cancelUrl ====> (Required) URL to which the buyer is returned, if something went wrong., (*10)
$returnUrl ====> (Required) URL to which the buyer is returned, after successfully payment., (*11)
$ipnUrl ====> mention IPN url to which IPN response will be send, For recurring Payment IPN handling is must., (*12)
(2) to confirm payment, (*13)
In your success function ,call confirmPayment() with parmas as below, (*14)
$token ====> generated in first step, (*15)
$description ====> give the description same given for the createRecurringProfile(), (*16)
$amount ====> amount for what the recurring profiles is created., (*17)
$initialAmount ====> If you want to charge user at the very first time., (*18)
$billingPeriod ====> (Required) Unit for billing during this subscription period. Value is: Day/Week/SemiMonth/Month/Year, (*19)
$billingFrequency ====> (Required) Number of billing periods that make up one billing cycle., (*20)
for example,, (*21)
$recurringProfileDetails = json_decode(Bond::getPaymentDetails($request['token'],$description,$amount,$billingPeriod,$billingFrequency), true);
if ($recurringProfileDetails['status'] == 200) {
// store the profile details in database with the unique recurring profile id.
} else {
echo json_encode(['status' => 400, 'message' => $recurringProfileDetails['message']]);
}