Log in

hypeStripePayments

hypeStripePayments

A wrapper for Stripe's PHP SDK

Webhooks

Configure your Stripe application to send webhooks to /payments/stripe/webhooks" data-qualifier="url" rel="nofollow">https:///payments/stripe/webhooks

To digest a webhook, register a plugin hook handler:

elgg_register_plugin_hook_handler('customer.subscription.deleted', 'stripe', HandleExpiredSubscription::class);

class HandleExpiredSubscription {
    public function __invoke(\Elgg\Hook $hook) {
        $stripe_event = $hook->getParam('event');
        /* @var $stripe_event \Stripe\Event */

        $subscription = $stripe_event->data->object;

        // ... do stuff

        return $result; // Result will be reported back to stripe
    }
}

Card Input

To display a card input:

// Card number, expiry and CVC
echo elgg_view_field([
    '#type' => 'stripe/card',
    '#label' => 'Credit or Debit Card',
    'required' => true,
]);

// Cardholder name
echo elgg_view_field([
    '#type' => 'stripe/cardholder',
    '#label' => 'Cardholder',
    'required' => true,
]);

// Billing address
// Requires hypeCountries plugin
echo elgg_view_field([
    '#type' => 'stripe/address',
    '#label' => 'Billing address',
    'required' => true,
]);

You can then retrieve the value of the Stripe token in your action:

$token = get_input('stripe_token');
$address = get_input('address');
$name = get_input('cardholder');

// Use stripe API to create a new card object
// or use the token as the source of the payment

Package Releases

VersionRelease Date
hypeStripePayments 1.3.11.3.1
hypeStripePayments 1.3.01.3.0
hypeStripePayments 1.2.11.2.1
hypeStripePayments 1.2.01.2.0
hypeStripePayments 1.1.11.1.1
hypeStripePayments 1.1.01.1.0
hypeStripePayments 1.0.11.0.1

Changelog

1.1.1 (2018-07-06)

Bug Fixes

  • forms: use ajax Form api to promise stripe token (3128c22)

1.1.0 (2018-06-29)

Features

1.0.1 (2018-03-19)

1.0.0 (2018-03-19)

Features

  • releases: initial commit (d561042)

About

Dependencies

Requires
Elgg version >= 3.0
Plugin: hypePayments Any
Plugin: hypeAjax Any
Suggests
Plugin: hypeCountries Any