{"id":18318575,"url":"https://github.com/maxmind/webservice-paypal-paymentsadvanced","last_synced_at":"2025-04-05T21:32:56.598Z","repository":{"id":45178070,"uuid":"45072415","full_name":"maxmind/webservice-paypal-paymentsadvanced","owner":"maxmind","description":"A simple wrapper around the PayPal Payments Advanced web service","archived":false,"fork":false,"pushed_at":"2025-03-20T20:33:13.000Z","size":414,"stargazers_count":3,"open_issues_count":2,"forks_count":1,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-03-21T12:12:34.067Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://metacpan.org/release/WebService-PayPal-PaymentsAdvanced/","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maxmind.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-10-27T21:54:28.000Z","updated_at":"2025-02-14T20:27:46.000Z","dependencies_parsed_at":"2025-02-14T21:25:16.215Z","dependency_job_id":"7e4d2823-9552-4573-86f6-177aa3875d26","html_url":"https://github.com/maxmind/webservice-paypal-paymentsadvanced","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxmind%2Fwebservice-paypal-paymentsadvanced","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxmind%2Fwebservice-paypal-paymentsadvanced/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxmind%2Fwebservice-paypal-paymentsadvanced/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxmind%2Fwebservice-paypal-paymentsadvanced/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maxmind","download_url":"https://codeload.github.com/maxmind/webservice-paypal-paymentsadvanced/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247406078,"owners_count":20933803,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T18:10:03.876Z","updated_at":"2025-04-05T21:32:56.330Z","avatar_url":"https://github.com/maxmind.png","language":"Perl","funding_links":["https://developer.paypal.com/docs/classic/payflow/integration-guide/"],"categories":[],"sub_categories":[],"readme":"# NAME\n\nWebService::PayPal::PaymentsAdvanced - A simple wrapper around the PayPal Payments Advanced web service\n\n# VERSION\n\nversion 0.000028\n\n# SYNOPSIS\n\n    use WebService::PayPal::PaymentsAdvanced;\n    my $payments = WebService::PayPal::PaymentsAdvanced-\u003enew(\n        {\n            password =\u003e 'seekrit',\n            user     =\u003e 'username',\n            vendor   =\u003e 'somevendor',\n        }\n    );\n\n    my $response = $payments-\u003ecreate_secure_token(\n        {\n            AMT            =\u003e 100,\n            TRXTYPE        =\u003e 'S',\n            BILLINGTYPE    =\u003e 'MerchantInitiatedBilling',\n            CANCELURL      =\u003e 'https://example.com/cancel',\n            ERRORURL       =\u003e 'https://example.com/error',\n            L_BILLINGTYPE0 =\u003e 'MerchantInitiatedBilling',\n            NAME           =\u003e 'Chuck Norris',\n            RETURNURL      =\u003e 'https://example.com/return',\n        }\n    );\n\n    my $uri = $response-\u003ehosted_form_uri;\n\n    # Store token data for later use.  You'll need to implement this yourself.\n    $foo-\u003efreeze_token_data(\n        token    =\u003e $response-\u003esecure_token,\n        token_id =\u003e $response-\u003esecure_token_id,\n    );\n\n    # Later, when PayPal returns a silent POST or redirects the user to your\n    # return URL:\n\n    my $redirect_response = $payments-\u003eget_response_from_redirect(\n        ip_address =\u003e $ip,\n        params     =\u003e $params,\n    );\n\n    # Fetch the tokens from the original request. You'll need to implement\n    # this yourself.\n\n    my $thawed = $foo-\u003eget_thawed_tokens(...);\n\n    # Don't do anything until you're sure the tokens are ok.\n    if (   $thawed-\u003esecure_token ne $redirect-\u003esecure_token\n        || $thawed-\u003esecure_token_id ne $response-\u003esecure_token_id ) {\n        die 'Fraud!';\n    }\n\n    # Everything looks good.  Carry on!\n\n    print $response-\u003esecure_token;\n\n# DESCRIPTION\n\nThis is a wrapper around the \"PayPal Payments Advanced\" (AKA \"PayPal Payflow\nLink\") hosted forms.  This code does things like facilitating secure token\ncreation, providing an URL which you can use to insert an hosted\\_form into\nyour pages and processing the various kinds of response you can get from\nPayPal.\n\nWe also use various exception classes to make it easier for you to decide how\nto handle the parts that go wrong.\n\n# OBJECT INSTANTIATION\n\nThe following parameters can be supplied to `new()` when creating a new object.\n\n## Required Parameters\n\n### password\n\nThe value of the `password` field you use when logging in to the Payflow\nManager.  (You'll probably want to create a specific user just for API calls).\n\n### user\n\nThe value of the `user` field you use when logging in to the Payflow Manager.\n\n### vendor\n\nThe value of the `vendor` field you use when logging in to the Payflow\nManager.\n\n## Optional Parameters\n\n### nonfatal\\_result\\_codes\n\nAn arrayref of result codes that will be treated as non-fatal (i.e., that will\nnot cause an exception). By default, only 0 is considered non-fatal, but\ndepending on your integration, other codes such as 112 (failed AVS check) may\nbe considered non-fatal.\n\n### partner\n\nThe value of the `partner` field you use when logging in to the Payflow\nManager. Defaults to `PayPal`.\n\n### payflow\\_pro\\_uri\n\nThe hostname for the Payflow Pro API.  This is where token creation requests\nget directed.  This already has a sensible (and correct) default, but it is\nsettable so that you can more easily mock API calls when testing.\n\n### payflow\\_link\\_uri\n\nThe hostname for the Payflow Link website.  This is the hosted service where\nusers will enter their payment information.  This already has a sensible (and\ncorrect) default, but it is settable in case you want to mock it while testing.\n\n### production\\_mode\n\nThis is a `Boolean`.  Set this to `true` if when you are ready to process\nreal transactions.  Defaults to `false`.\n\n### ua\n\nYou may provide your own UserAgent, but it must be of the [LWP::UserAgent](https://metacpan.org/pod/LWP%3A%3AUserAgent)\nfamily.  If you do provide a UserAgent, be sure to set a sensible timeout\nvalue. Requests to the web service frequently run 20-30 seconds.\n\nThis can be useful for debugging.  You'll be able to get detailed information\nabout the network calls which are being made.\n\n    use LWP::ConsoleLogger::Easy qw( debug_ua );\n    use LWP::UserAgent;\n    use WebService::PayPal::PaymentsAdvanced;\n\n    my $ua = LWP::UserAgent;\n    debug_ua($ua);\n\n    my $payments\n        = WebService::PayPal::PaymentsAdvanced-\u003enew( ua =\u003e $ua, ... );\n\n    # Now fire up a console and watch your network activity.\n\nCheck the tests which accompany this distribution for an example of how to mock\nAPI calls using [Test::LWP::UserAgent](https://metacpan.org/pod/Test%3A%3ALWP%3A%3AUserAgent).\n\n### validate\\_hosted\\_form\\_uri\n\n`Boolean`.  If enabled, this module will attempt to GET the uri which you'll\nbe providing to the end user.  This can help you identify issues on the PayPal\nside.  This is helpful because you'll be able to log exceptions thrown by this\nmethod and deal with them accordingly.  If you disable this option, you'll need\nto rely on end users to report issues which may exist within PayPal's hosted\npages.  Defaults to `true`.\n\n### verbose\n\n`Boolean`.  Sets `VERBOSITY=HIGH` on all transactions if enabled.  Defaults\nto `true`.\n\n## Methods\n\n### create\\_secure\\_token\n\nCreate a secure token which you can use to create a hosted form uri.  Returns a\n[WebService::PayPal::PaymentsAdvanced::Response::SecureToken](https://metacpan.org/pod/WebService%3A%3APayPal%3A%3APaymentsAdvanced%3A%3AResponse%3A%3ASecureToken) object.\n\nThe first parameter holds the key/value parameters for the request. The second\nparameter is optional and holds parameters to the underlying\n[WebService::PayPal::PaymentsAdvanced::Response::SecureToken](https://metacpan.org/pod/WebService%3A%3APayPal%3A%3APaymentsAdvanced%3A%3AResponse%3A%3ASecureToken) object, which is\nuseful to set attributes such as `retry_attempts` and `retry_callback`.\n\n    use WebService::PayPal::PaymentsAdvanced;\n    my $payments = WebService::PayPal::PaymentsAdvanced-\u003enew(...);\n\n    my $response = $payments-\u003ecreate_secure_token(\n        {\n            AMT            =\u003e 100,\n            TRXTYPE        =\u003e 'S',\n            BILLINGTYPE    =\u003e 'MerchantInitiatedBilling',\n            CANCELURL      =\u003e 'https://example.com/cancel',\n            ERRORURL       =\u003e 'https://example.com/error',\n            L_BILLINGTYPE0 =\u003e 'MerchantInitiatedBilling',\n            NAME           =\u003e 'Chuck Norris',\n            RETURNURL      =\u003e 'https://example.com/return'\n        }\n    );\n\n    print $response-\u003esecure_token;\n\n### get\\_response\\_from\\_redirect\n\nThis method can be used to parse responses from PayPal to your return URL.\nIt's essentially a wrapper around\n[WebService::PayPal::PaymentsAdvanced::Response::FromRedirect](https://metacpan.org/pod/WebService%3A%3APayPal%3A%3APaymentsAdvanced%3A%3AResponse%3A%3AFromRedirect).  Returns a\n[WebService::PayPal::PaymentsAdvanced::Response](https://metacpan.org/pod/WebService%3A%3APayPal%3A%3APaymentsAdvanced%3A%3AResponse) object.\n\n    my $response = $payments-\u003eget_response_from_redirect(\n        params     =\u003e $params,\n    );\n    print $response-\u003emessage;\n\n### get\\_response\\_from\\_silent\\_post\n\nThis method can be used to validate responses from PayPal to your silent POST\nurl.  If you provide an ip\\_address parameter, it will be validated against a\nlist of known IPs which PayPal provides.  You're encouraged to provide an IP\naddress in order to prevent spoofing of payment responses.  See\n[WebService::PayPal::PaymentsAdvanced::Response::FromSilentPOST](https://metacpan.org/pod/WebService%3A%3APayPal%3A%3APaymentsAdvanced%3A%3AResponse%3A%3AFromSilentPOST) for more\ninformation on this behaviour.\n\nThis method returns a\n[WebService::PayPal::PaymentsAdvanced::Response::FromSilentPost::PayPal](https://metacpan.org/pod/WebService%3A%3APayPal%3A%3APaymentsAdvanced%3A%3AResponse%3A%3AFromSilentPost%3A%3APayPal)\nobject for PayPal transactions.  It returns a\n[WebService::PayPal::PaymentsAdvanced::Response::FromSilentPost::CreditCard](https://metacpan.org/pod/WebService%3A%3APayPal%3A%3APaymentsAdvanced%3A%3AResponse%3A%3AFromSilentPost%3A%3ACreditCard)\nobject for credit card transactions.  You can either inspect the class returned\nto you or use the `is_credit_card_transaction` or `is_paypal_transaction`\nmethods to learn which method the customer paid with.  Both methods return a\n`Boolean`.\n\n    my $response = $payments-\u003eget_response_from_redirect(\n        ip_address =\u003e $ip,\n        params     =\u003e $params,\n    );\n    print $response-\u003emessage. \"\\n\";\n    if ( $response-\u003eis_credit_card_transaction ) {\n        print $response-\u003ecard_type, q{ }, $response-\u003ecard_expiration;\n    }\n\n### post\n\nGeneric method to post arbitrary params to PayPal.  Requires a `HashRef` of\nparameters and returns a [WebService::PayPal::PaymentsAdvanced::Response](https://metacpan.org/pod/WebService%3A%3APayPal%3A%3APaymentsAdvanced%3A%3AResponse)\nobject.  Any lower case keys will be converted to upper case before this\nresponse is sent. The second parameter is an optional `HashRef`. If provided,\nit defines attributes to pass to the\n[WebService::PayPal::PaymentsAdvanced::Response::SecureToken](https://metacpan.org/pod/WebService%3A%3APayPal%3A%3APaymentsAdvanced%3A%3AResponse%3A%3ASecureToken) object.\n\n    use WebService::PayPal::PaymentsAdvanced;\n    my $payments = WebService::PayPal::PaymentsAdvanced-\u003enew(...);\n\n    my $response = $payments-\u003epost( { TRXTYPE =\u003e 'V', ORIGID =\u003e $pnref, } );\n    say $response-\u003emessage;\n\n    # OR\n    my $response = $payments-\u003epost( { trxtype =\u003e 'V', origid =\u003e $pnref, } );\n\n### capture\\_delayed\\_transaction( $ORIGID, \\[$AMT\\] )\n\nCaptures a sale which you have previously authorized.  Requires the ID of the\noriginal transaction.  If you wish to capture an amount which is not equal to\nthe original authorization amount, you'll need to pass an amount as the second\nparameter.  Returns a response object.\n\n### auth\\_from\\_credit\\_card\\_reference\\_transaction( $ORIGID, $amount, $extra )\n\nProcess a authorization based on a reference transaction from a credit card.\nRequires 2 arguments: an ORIGID from a previous credit card transaction and an\namount. Any additional parameters can be passed via a HashRef as an optional\n3rd argument.\n\n    use WebService::PayPal::PaymentsAdvanced;\n    my $payments = WebService::PayPal::PaymentsAdvanced-\u003enew(...);\n\n    my $response = $payments-\u003eauth_from_credit_card_reference_transaction(\n        'BFOOBAR', 1.50', { INVNUM =\u003e 'FOO123' }\n    );\n    say $response-\u003emessage;\n\n### sale\\_from\\_credit\\_card\\_reference\\_transaction( $ORIGID, $amount )\n\nProcess a sale based on a reference transaction from a credit card.  See\nRequires 2 arguments: an ORIGID from a previous credit card transaction and an\namount.  Any additional parameters can be passed via a HashRef as an optional\n3rd argument.\n\n    use WebService::PayPal::PaymentsAdvanced;\n    my $payments = WebService::PayPal::PaymentsAdvanced-\u003enew(...);\n\n    my $response = $payments-\u003esale_from_credit_card_reference_transaction(\n        'BFOOBAR', 1.50', { INVNUM =\u003e 'FOO123' }\n    );\n    say $response-\u003emessage;\n\n### auth\\_from\\_paypal\\_reference\\_transaction( $BAID, $amount, $currency, $extra )\n\nProcess an authorization based on a reference transaction from PayPal.\nRequires 3 arguments: a BAID from a previous PayPal transaction, an amount and\na currency.  Any additional parameters can be passed via a HashRef as the\noptional fourth argument.\n\n    use WebService::PayPal::PaymentsAdvanced;\n    my $payments = WebService::PayPal::PaymentsAdvanced-\u003enew(...);\n\n    my $response = $payments-\u003eauth_from_paypal_reference_transaction(\n        'B-FOOBAR', 1.50, 'USD', { INVNUM =\u003e 'FOO123' }\n    );\n    say $response-\u003emessage;\n\n### sale\\_from\\_paypal\\_reference\\_transaction( $BAID, $amount, $currency, $extra )\n\nProcess a sale based on a reference transaction from PayPal.  Requires 3\narguments: a BAID from a previous PayPal transaction, an amount and a currency.\nAny additional parameters can be passed via a HashRef as an optional fourth\nargument.\n\n    use WebService::PayPal::PaymentsAdvanced;\n    my $payments = WebService::PayPal::PaymentsAdvanced-\u003enew(...);\n\n    my $response = $payments-\u003esale_from_paypal_reference_transaction(\n        'B-FOOBAR', 1.50, 'USD', { INVNUM =\u003e 'FOO123' }\n    );\n    say $response-\u003emessage;\n\n### refund\\_transaction( $origid, \\[$amount\\] )\n\nRefunds (credits) a previous transaction.  Requires the `ORIGID` and an\noptional `AMT`.  If no amount is provided, the entire transaction will be\nrefunded.\n\n### inquiry\\_transaction( $HashRef )\n\nPerforms a transaction inquiry on a previously submitted transaction.  Requires\nthe ID of the original transaction.  Returns a response object.\n\n    use WebService::PayPal::PaymentsAdvanced;\n    my $payments = WebService::PayPal::PaymentsAdvanced-\u003enew(...);\n\n    my $inquiry = $payments-\u003einquiry_transaction(\n        { ORIGID =\u003e 'FOO123', TENDER =\u003e 'C', }\n    );\n    say $response-\u003emessage;\n\n### void\\_transaction( $ORIGID )\n\nVoids a previous transaction.  Requires the ID of the transaction to void.\nReturns a response object.\n\n# SEE ALSO\n\nThe official [Payflow Gateway Developer Guide and\nReference](https://developer.paypal.com/docs/classic/payflow/integration-guide/)\n\n# SUPPORT\n\nBugs may be submitted through [https://github.com/maxmind/webservice-paypal-paymentsadvanced/issues](https://github.com/maxmind/webservice-paypal-paymentsadvanced/issues).\n\n# AUTHOR\n\nOlaf Alders \u003colaf@wundercounter.com\u003e\n\n# CONTRIBUTORS\n\n- Andy Jack \u003cajack@maxmind.com\u003e\n- Dave Rolsky \u003cdrolsky@maxmind.com\u003e\n- Greg Oschwald \u003cgoschwald@maxmind.com\u003e\n- Mark Fowler \u003cmark@twoshortplanks.com\u003e\n- Mateu X Hunter \u003cmhunter@maxmind.com\u003e\n- Narsimham Chelluri \u003cnchelluri@users.noreply.github.com\u003e\n- Nick Logan \u003cnlogan@maxmind.com\u003e\n- Olaf Alders \u003coalders@maxmind.com\u003e\n- William Storey \u003cwstorey@maxmind.com\u003e\n\n# COPYRIGHT AND LICENSE\n\nThis software is copyright (c) 2022 by MaxMind, Inc.\n\nThis is free software; you can redistribute it and/or modify it under\nthe same terms as the Perl 5 programming language system itself.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxmind%2Fwebservice-paypal-paymentsadvanced","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxmind%2Fwebservice-paypal-paymentsadvanced","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxmind%2Fwebservice-paypal-paymentsadvanced/lists"}