Last active
August 2, 2017 07:50
-
-
Save coetry/a768e3e0cc226531cfd7e7a5d92ab9bb to your computer and use it in GitHub Desktop.
following synopsis of Net::Stripe CPAN module hoping to get some 200s from stripe, but get an error instead :(
This file contains hidden or 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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Net::Stripe; | |
my $stripe = Net::Stripe->new(api_key => $ENV{STRIPE_SECRET}); | |
my $card_token = 'a token'; | |
my $charge = $stripe->post_charge( | |
amount => 12500, | |
currency => 'usd', | |
card => $card_token, | |
description => 'dolla dolla bill yall', | |
); | |
print "Charge was not paid!\n" unless $charge->paid; | |
my $card = $charge->card; | |
my $same_charge = $stripe->get_charge(charge_id => $charge->id); | |
print "paid: $same_charge\n"; |
This file contains hidden or 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
Allens-MacBook-Pro:Hacks coetry$ perl stripe.pl | |
Use of uninitialized value $e in die at /Users/coetry/perl5/perlbrew/perls/perl-5.26.0/lib/site_perl/5.26.0/Net/Stripe.pm line 680. | |
malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "LWP will support htt...") at /Users/coetry/perl5/perlbrew/perls/perl-5.26.0/lib/site_perl/5.26.0/Net/Stripe.pm line 669. | |
...propagated at /Users/coetry/perl5/perlbrew/perls/perl-5.26.0/lib/site_perl/5.26.0/Net/Stripe.pm line 680. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment