Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID

Adding coupon handling to the stripe app

edited July 2014 in Apps

How hard would it be? What would the steps be?

Comments

  • This might be better done in the Products app. The app lets you sell individual items (including digital downloads), but doesn't have a full shopping cart yet. A cart was outside of the requirements of the project I wrote it for, but is something I would like to add to it down the road.

  • The site I'm working on sells subscriptions. Does the products app handle them?

  • Ah now I see what you mean. To apply coupons, you would need to extend the Stripe app and duplicate how it manages plans to also manage coupons, which would match the coupons in your Stripe dashboard.

    The API here would also need to be extended to apply the coupon correctly. In terms of API changes, that would probably look like this:

    <?php
    
    echo $this->run ('stripe/payment', array (
        'plan' => 'basic',
        'coupon' => 'specialoffer01',
        'callback' => function ($customer, $payment) {
            info ($customer);
            info ($payment);
        }
    ));
    
    ?>
    

    From there, apps/stripe/handlers/payment.php would need to be updated to look for the coupon parameter and adjust the request accordingly.

    Let me know if that sounds more like what you're trying to do.

  • Thanks, yes, that's the kind of thing I was thinking of. I'm away this week but I'll investigate further when I get back.

Sign In or Register to comment.