ggsoftwarellc/nitropay-sponsor-php

2.2.0 2022-07-11 21:35 UTC

This package is auto-updated.

Last update: 2024-12-06 21:15:28 UTC


README

Description

Creates a signed token for passing user identity to the sponsor client library.

Usage

We recommend using this as a composer package.

composer require ggsoftwarellc/nitropay-sponsor-php

You can then sign tokens for your users like so:

require __DIR__ . '/vendor/autoload.php';

$signer = new NitroPaySponsor\Signer('YOUR_PRIVATE_KEY');

$token = $signer->sign([
    'siteId' => '109', // required
    'userId' => '39281', // required
    'email '=> 'example@example.com', // optional
    'avatar' => 'https://s.gravatar.com/avatar/0d3964876826ac9554d88d5a51ea87a2?s=80', // optional
    'name' => 'John Doe', // optional
]);

Follow the instructions in the sponsor documentation for what to do with the token from there.

You can use $signer->getUserSubscription($userID) to look up subscription info for a user.