PHP code example of protonemedia / laravel-paddle
1. Go to this page and download the library: Download protonemedia/laravel-paddle library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
protonemedia / laravel-paddle example snippets
// alerts
Paddle::alert()->getWebhookHistory();
// checkouts
Paddle::checkout()->getOrderDetails();
Paddle::checkout()->getUserHistory();
Paddle::checkout()->getPrices();
// products
Paddle::product()->listCoupons();
Paddle::product()->createCoupon();
Paddle::product()->updateCoupon();
Paddle::product()->deleteCoupon();
Paddle::product()->listProducts();
Paddle::product()->generateLicense();
Paddle::product()->generatePayLink();
Paddle::product()->listTransactions($entity, $id);
// subscriptions
Paddle::subscription()->listPlans();
Paddle::subscription()->createPlan();
Paddle::subscription()->listUsers();
Paddle::subscription()->updateUser();
Paddle::subscription()->previewUpdate();
Paddle::subscription()->cancelUser();
Paddle::subscription()->listModifiers();
Paddle::subscription()->createModifier();
Paddle::subscription()->deleteModifier();
Paddle::subscription()->listPayments();
Paddle::subscription()->reschedulePayment();
Paddle::subscription()->createOneOffCharge($subscriptionId);
namespace App\Listeners;
use ProtoneMedia\LaravelPaddle\Events\SubscriptionCreated;
class CreateSubscriptionModel
{
public function handle(SubscriptionCreated $event)
{
$status = $event->status;
$nextBillDate = $event->next_bill_date;
// or
$webhookData = $event->all();
//
$request = $event->getRequest();
}
}
<body>
{{-- your app --}}
@paddle
</body>
bash
php artisan vendor:publish --provider="ProtoneMedia\LaravelPaddle\PaddleServiceProvider" --tag=config
bash
php artisan vendor:publish --provider="ProtoneMedia\LaravelPaddle\PaddleServiceProvider" --tag=views
php
// Fluent:
$paddleResponse = Paddle::product()
->generatePayLink()
->productId($paddlePlanId)
->customerEmail($team->owner->email)
->passthrough(['team_id' => $team->id])
->send();
// Array with payload:
$payload = [
'product_id' => $paddlePlanId,
'customer_email' => $team->owner->email,
'passthrough' => ['team_id' => $team->id],
];
$paddleResponse = Paddle::product()
->generatePayLink($payload)
->send();
return Redirect::to($paddleResponse['url']);