-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Notification replay now calls correct endpoint
- Loading branch information
1 parent
d3807a1
commit 7397f33
Showing
4 changed files
with
40 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Paddle\SDK\Exceptions\ApiError; | ||
use Paddle\SDK\Exceptions\SdkExceptions\MalformedResponse; | ||
|
||
require __DIR__ . '/../vendor/autoload.php'; | ||
|
||
$environment = Paddle\SDK\Environment::tryFrom(getenv('PADDLE_ENVIRONMENT') ?: '') ?? Paddle\SDK\Environment::SANDBOX; | ||
$apiKey = getenv('PADDLE_API_KEY') ?: null; | ||
$notificationId = getenv('PADDLE_NOTIFICATION_ID') ?: null; | ||
|
||
if (is_null($apiKey)) { | ||
echo "You must provide the PADDLE_API_KEY in the environment:\n"; | ||
echo "PADDLE_API_KEY=your-key php examples/basic_usage.php\n"; | ||
exit(1); | ||
} | ||
|
||
$paddle = new Paddle\SDK\Client($apiKey, options: new Paddle\SDK\Options($environment)); | ||
|
||
// ┌─── | ||
// │ Replay Notification │ | ||
// └─────────────────────┘ | ||
try { | ||
$replayedNotificationId = $paddle->notifications->replay($notificationId); | ||
} catch (ApiError|MalformedResponse $e) { | ||
var_dump($e); | ||
exit; | ||
} | ||
|
||
echo sprintf("Replayed Notification ID: %s\n", $replayedNotificationId); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters