itelmenko/php-paddle-client

Paddle.com API 客户端 PHP 库

1.0.3 2022-04-25 08:10 UTC

This package is auto-updated.

Last update: 2024-09-18 20:04:34 UTC


README

此库提供了一种方便的方法,从 PHP 代码中查询 Paddle API。

要求

PHP 7.2 或更高版本。

通过 Composer 安装

composer require itelmenko/php-paddle-client

用法

$client = new \Paddle\Client();
$client->setVendorId(111);
$client->setVendorAuthCode('dlkegvke3klge3mg3...');
$price = new \Paddle\Price($order->amount, new \Paddle\Currency('USD'));
$invoice = new \Paddle\Invoice();

$invoice->addPrice(5.95)
    ->setPassthrough('order-id-2464')
    ->setReturnUrl('https://yourdomain.com/return')
    ->setQuantity(1, FALSE)
    ->setExpires(time())
    ->setCustomerEmail('user@mail.com');

$invoice->setProductId(111111);

$url = $client->createPaymentUrl($invoice);