Business-Stripe-WebCheckout
view release on metacpan or search on metacpan
lib/Business/Stripe/WebCheckout.pm view on Meta::CPAN
'api-public' => 'pk_test_00000000000000000000000000',
'api-secret' => 'sk_test_00000000000000000000000000',
'success-url' => 'https://www.example.com/yippee.html',
'cancel-url' => 'https://www.example.com/ohdear.html',
'reference' => 'My Payment',
);
$stripe->add_product(
'id' => 'test',
'name' => 'Expensive Thingy',
'description' => 'Special edition version',
'qty' => 1,
'price' => 50000,
);
print "Content-Type: text/text\n\n";
print $stripe->get_ids;
=head2 3 - Simpest method (no Javascript required)
=head3 HTML
<html>
<head>
<title>Simple Checkout</title>
</head>
<body>
<form method="post" action="https://www.example.com/cgi-bin/trolley.pl">
<input type="submit" value="Buy Now!">
</form>
</body>
</html>
=head3 Perl - trolley.pl
use Business::Stripe::WebCheckout;
use strict;
my $stripe = Business::Stripe::WebCheckout->new(
'api-public' => 'pk_test_00000000000000000000000000',
'api-secret' => 'sk_test_00000000000000000000000000',
'success-url' => 'https://www.example.com/yippee.html',
'cancel-url' => 'https://www.example.com/ohdear.html',
'reference' => 'My Payment',
);
$stripe->add_product(
'id' => 'test',
'name' => 'Expensive Thingy',
'description' => 'Special edition version',
'qty' => 1,
'price' => 50000,
);
if ($stripe->success) {
print $stripe->checkout;
} else {
# handle errors...
}
This last example prints out a fully formed HTML document to the browser containing only the C<head> section. The HTML contains the Javascript necessary to pass the use to the Stripe hosted checkout. The HTML is complete with Content-Type header. ...
print "Set-cookie: MyCookie=$order_number; path=/\n";
$stripe->checkout;
=head1 SEE ALSO
L<Net::Stripe>, L<Net::Stripe::Simple>, L<Business::Stripe>
=head1 AUTHOR
=over 4
=item *
Ian Boddison <ian@boddison.com>
=back
=head1 BUGS
Please report any bugs or feature requests to C<bug-business-stripe-webcheckout at rt.cpan.org>, or through
the web interface at L<https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Business-Stripe-WebCheckout>. I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.
=head1 SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Business::Stripe::WebCheckout
You can also look for information at:
=over 4
=item * RT: CPAN's request tracker (report bugs here)
L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Business-Stripe-WebCheckout>
=item * CPAN Ratings
L<https://cpanratings.perl.org/d/Business-Stripe-WebCheckout>
=item * Search CPAN
L<https://metacpan.org/release/Business-Stripe-WebCheckout>
=back
=head1 ACKNOWLEDGEMENTS
Thanks to the help and support provided by members of Perl Monks L<https://perlmonks.org/>
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2021 by Ian Boddison.
This is free software; you can redistribute it and/or modify it under
( run in 1.152 second using v1.01-cache-2.11-cpan-39bf76dae61 )