You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I manage to Successfully make a Recurring payment...
With a Little Tweak from your Code example ....
Here i Plan to Create 1 Week Free Trial Then Do Monthly Subscription Until Cancelled
This is How i Do it...
As shown ... That my Code Example Below will work...
This is How i Do it...
I Imported Sync ,CreateRecurringPaymentProfile ,Api From Payum\Paypal\ExpressCheckout\Nvp
<?php
namespace App\Http\Controllers\Gateway;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Payum\Core\GatewayInterface;
use Payum\Core\Model\PaymentInterface;
use Payum\Core\Payum;
use Payum\Core\Request\GetHumanStatus;
use Payum\Core\Security\TokenInterface;
use Payum\Core\Storage\StorageInterface;
use Recca0120\LaravelPayum\Service\Payment;
use Payum\Paypal\ExpressCheckout\Nvp\Api;
use Payum\Core\Request\Sync;
use Payum\Paypal\ExpressCheckout\Nvp\Request\Api\CreateRecurringPaymentProfile;
prepare method ( Added Here All Needed Properties for Recurring)
public function prepare(Payment $payment)
{
return $payment->prepare('paypal_express_checkout', function (PaymentInterface $payment, $gatewayName, StorageInterface $storage, Payum $payum) {
$payment->setNumber(uniqid());
$payment->setCurrencyCode('PHP');// Needed For Payum to Work
$payment->setClientId('customer-001'); // Auth User ID
$payment->setClientEmail('[email protected]'); // Auth User Email
$payment->setDetails([
'BRANDNAME' => 'My Company', // Provide name for cancel and return url
'LOGOIMG' => 'https://profugo.org/wp-content/uploads/2013/08/logo-190x60.png', // Show at Top
'SOLUTIONTYPE' => 'Mark', //Buyer must have a PayPal account to check out
'LANDINGPAGE' => 'Login', // Billing(Credit Card) or Login Type Pages
'CARTBORDERCOLOR' => '009688', // Border Color
'CHANNELTYPE' => 'Merchant',
'L_BILLINGTYPE0' => Api::BILLINGTYPE_RECURRING_PAYMENTS, // Enables Recurring
'L_BILLINGAGREEMENTDESCRIPTION0' => '1 Week Free Trial then PREMIUM Membership ₱500 PHP Per Month', // Billing Agreement
'PAYMENTREQUEST_0_AMT' => 0, // Zero Transaction
'NOSHIPPING' => 1, // Enable no Shipping Fee for Digital Products
]);
});
}
done method ( with CreateRecurringPaymentProfile)
public function done(Payment $payment, Request $request, $payumToken)
{
return $payment->done($request, $payumToken, function (GetHumanStatus $status, PaymentInterface $payment, GatewayInterface $gateway, TokenInterface $token) {
$agreement = $status->getModel();
$payment->setClientEmail($agreement['EMAIL']);
$payment->setDetails([
'TOKEN' => $agreement['TOKEN'], // EC_SOMERANDOMESTRING
'SUBSCRIBERNAME' => $agreement['SUBSCRIBERNAME'], // Paypal Name Used for Payment
'DESC' => '1 Week Free Trial then PREMIUM Membership ₱500 PHP Per Month', // MUST BE THE SAME AS L_BILLINGAGREEMENTDESCRIPTION0
'EMAIL' => $agreement['EMAIL'], // Paypal Email used for payment Useful if user uses different Email for Subscription
'AMT' => 500, // The Amount they Will pay per month
'TAXAMT' => 60,
'CURRENCYCODE' => 'PHP',
'BILLINGFREQUENCY' => 1, // 1 per month
'PROFILESTARTDATE' => date(DATE_ATOM), // Current Date
'BILLINGPERIOD' => Api::BILLINGPERIOD_MONTH, // Per Month
'MAXFAILEDPAYMENTS' => 3,
'PROFILEREFERENCE' => 'order#1', // My Reference For That Order No#
'TRIALBILLINGPERIOD' => Api::BILLINGPERIOD_WEEK, // Per Week
'TRIALBILLINGFREQUENCY' => 1, // 1 Week
'TRIALTOTALBILLINGCYCLES' => 1, // x1 Week
'TRIALAMT' => 0 // FREE TRIAL at 0
]);
$gateway->execute(new CreateRecurringPaymentProfile($payment));
$gateway->execute(new Sync($payment));
// Add Role or permission
// Return RedirectTo Dashboard.
// Check if Active, Pending, Cancelled , Suspended ,Expired
return response()->json([
'status' => $status->getValue(),
'client' => [
'id' => $payment->getClientId(),
'email' => $payment->getClientEmail(),
],
'number' => $payment->getNumber(),
'description' => $payment->getCurrencyCode(),
'total_amount' => $payment->getTotalAmount(),
'currency_code' => $payment->getCurrencyCode(),
'details' => $payment->getDetails(),
]);
});
}
Your Code is Great But Lacks Sample...
I manage to Successfully make a Recurring payment...
With a Little Tweak from your Code example ....
Here i Plan to Create 1 Week Free Trial Then Do Monthly Subscription Until Cancelled
This is How i Do it...
As shown ... That my Code Example Below will work...
This is How i Do it...
I Imported Sync ,CreateRecurringPaymentProfile ,Api From Payum\Paypal\ExpressCheckout\Nvp
prepare method ( Added Here All Needed Properties for Recurring)
done method ( with CreateRecurringPaymentProfile)
In My Routes File
This Code Works to make Recuring Payment...
My Problem Now is
1.) How Can I Catch if a User Cancel it From Inside Paypal Site....?
2.) How Can a User Reactivate a Recurring Payment in Dashboard?
3.) How Can a User Cancel Recurring Payment In Dashboard...?
Can You Show me or Point me to the Right Path thanks
Also Please Also Make A Wiki For Examples, U can use mine for Recurring thanks
The text was updated successfully, but these errors were encountered: