Busine...ayments(3pm)
π Business::PayPal::API::DirectPayments β the 3pm manual, but make it cute β¨
okay so bestie, you found the Business::PayPal::API::DirectPayments page β it's one of the user-contributed Perl docs, and it's literally the β¨PayPal DirectPayments APIβ¨ wrapper. Yeah. We're doing payments. In Perl. In 2006 energy. But it still slaps, so let's go π
π VERSION
version 0.77 β that's the one, no cap.
β¨ SYNOPSIS
okay so here's the whole vibe. First you use it (and grab DirectPayments in the import list, don't forget that part, it's giving necessary):
use Business::PayPal::API qw(DirectPayments);
## see Business::PayPal::API documentation for parameters
my $pp = Business::PayPal::API->new(
Username => 'name_api1.example.org',
Password => 'somepass',
CertFile => '/path/to/tester1.cert_key_pem.txt',
KeyFile => '/path/to/tester1.cert_key_pem.txt',
sandbox => 1,
);
my %response = $pp->DoDirectPaymentRequest (
PaymentAction => 'Sale',
OrderTotal => 13.59,
TaxTotal => 0.0,
ShippingTotal => 0.0,
ItemTotal => 0.0,
HandlingTotal => 0.0,
InvoiceID => 'your-tracking-number',
CreditCardType => 'Visa',
CreditCardNumber => '4561435600988217',
ExpMonth => '01',
ExpYear => '2007',
CVV2 => '123',
FirstName => 'James',
LastName => 'PuffDaddy',
Street1 => '1st Street LaCausa',
Street2 => '',
CityName => 'La',
StateOrProvince => 'Ca',
PostalCode => '90210',
Country => 'US',
Payer => 'Joe@Example.org',
ShipToName => 'Jane Doe',
ShipToStreet1 => '1234 S. Pleasant St.',
ShipToStreet2 => 'Suite #992',
ShipToCityName => 'Vacation Town',
ShipToStateOrProvince => 'FL',
ShipToCountry => 'US',
ShipToPostalCode => '12345',
CurrencyID => 'USD',
IPAddress => '10.0.0.1',
MerchantSessionID => '10113301',
);
the way that LastName => 'PuffDaddy' is just sitting there in the official docs?? iconic. we love a legacy codebase π«Ά
πΈ DESCRIPTION
so like, Business::PayPal::API::DirectPayments implements PayPal's DirectPayments API using SOAP::Lite to make direct API calls to PayPal's SOAP API server. It also implements support for testing via PayPal's sandbox π§ β and if you want the details on using that PayPal sandbox, go read Business::PayPal::API, that's where the tea is.
π³ DoDirectPaymentRequest
This bad boy implements PayPal's DoDirectPaymentRequest API call. Supported parameters include:
PaymentActionβ (Sale|Authorize,Saleis default)OrderTotalTaxTotalShippingTotalItemTotalHandlingTotalInvoiceIDCreditCardTypeCreditCardNumberExpMonthβ (two digits, leading zero)ExpYearβ (four digits,20XX)CVV2FirstNameLastNameStreet1Street2CityNameStateOrProvincePostalCodeCountryPayerShipToNameShipToStreet1ShipToStreet2ShipToCityNameShipToStateOrProvinceShipToCountryShipToPostalCodeCurrencyIDβ (USDis default)IPAddressMerchantSessionID
β¦and these are all, like, described in the PayPal "Web Services API Reference" document. That's where you go for the deep lore π
It returns a hash containing the results of the transaction. And the two most useful return values? The Ack element and TransactionID. Those are the main characters of your return hash, fr fr π
Example β here's how it actually looks in the wild:
my %resp = $pp->DoDirectPaymentRequest(
PaymentAction => 'Sale',
OrderTotal => '10.99',
...
);
unless( $resp{Ack} !~ /Success/ ) {
for my $error ( @{$response{Errors}} ) {
warn "Error: " . $error->{LongMessage} . "\n";
}
}
π ERROR HANDLING
stuff went wrong? don't spiral, bestie. Go see the ERROR HANDLING section of Business::PayPal::API for all the info on handling errors. that's the whole assignment.
π¦ EXPORT
None by default. yeah. nothing. zero. nada. you have to ask for what you want, which honestly? boundaries. we respect it π
π SEE ALSO
π AUTHORS
- Scott Wiersdorf <scott@perlcode.org>
- Danny Hembree <danny@dynamical.org>
- Bradley M. Kuhn <bkuhn@ebb.org>
three absolute legends, honestly π
π COPYRIGHT AND LICENSE
This software is copyright (c) 2006-2017 by Scott Wiersdorf, Danny Hembree, Bradley M. Kuhn.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
okay so like β that's the legal bit, and it's genuinely permissive, so rest easy π
and that's the whole page, bestie! this one shipped with perl v5.36.0, dated 2022-08-28, under the title Busine...ayments(3pm) π slay, go charge some credit cards responsibly, and remember: Sale is the default but Authorize is always an option πβ¨
π¦ where this page comes from
- ubuntu noble: libbusiness-paypal-api-perl 0.77-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libbusiness-paypal-api-perl 0.77-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libbusiness-paypal-api-perl 0.77-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms