Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A Laravel package to encapsulate global PayU requests.

License

NotificationsYou must be signed in to change notification settings

somosgad/laravel-payu

Repository files navigation

A Laravel package to encapsulate global PayU requests. More info atPaymentsOS Docs.

Total Downloads

Currently in development

Installation

ViaComposer

composer require somosgad/laravel-payu:dev-master

Configuration

Set API variables

Set your PayU configs at.env file

PAYU_APP_ID=PAYU_ENV=PAYU_PUBLIC_KEY=PAYU_PRIVATE_KEY=PAYU_PROVIDER=

Your.env file must end up looking like:

PAYU_APP_ID=com.foo.barPAYU_ENV=testPAYU_PUBLIC_KEY=g6l2g4yn-nvgp-uiil-6fm7-d2337cegunmzPAYU_PRIVATE_KEY=68lhkww3-lkgw-4mcc-r21m-cf8nnnx3wj2kPAYU_PROVIDER="PayU Argentina"

Export Config

php artisan vendor:publish --provider="SomosGAD_\LaravelPayU\LaravelPayUServiceProvider"

Usage

useSomosGAD_\LaravelPayU\LaravelPayU;$payu =newLaravelPayU;

Payment

Create

$amount =2000;$currency ='USD';$payment =$payu->createPayment($amount,$currency);

Create Token

$card_number ='4111111111111111';$credit_card_cvv ='123';$expiration_date ='10/29';$holder_name ='John Doe';$token_type ='credit_card';$token =$payu->createToken($card_number,$credit_card_cvv,$expiration_date,$holder_name,$token_type);

Create Authorization

$authorization =$payu->createAuthorization($payment['id'],$encrypted_cvv,$token);

Create Capture

$capture =$payu->createCapture($payment['id'],$payment['amount']);

Charge

Create Card Charge

$charge =$payu->createCharge($payment['id'],$token);

Create Cash Charge

$charge =$payu->createCharge2($payment['id'], ['payment_method' => ['source_type' =>'cash','type' =>'untokenized','vendor' =>'COBRO_EXPRESS','additional_details' => ['order_language' =>'en','cash_payment_method_vendor' =>'COBRO_EXPRESS','payment_method' =>'PSE','payment_country' =>'ARG',        ],    ],'reconciliation_id' =>time(),];

* Notes:

  1. order_language is always uppercased for you;
  2. Omittedreconciliation_id gets created;
  3. OnlyARGpayment_country are able to create cash charges for Argentina;
  4. Payments for cash charges must be created withcustomer_id set and customer must haveshipping_address set with at least one field, otherwise, the receipt won't be printable or downloadable.

Customer

Create Customer

Required Props
$customer =$payu->createCustomer(['customer_reference' =>'johntravolta18021954',]);

* Notes:

  1. customer_references are unique, API won't create customers for same references. Choose something like an ID, document or anything else unique and immutable to set ascustomer_reference.
  2. PayU Argentina won't print or download PDF if you haven't set customer'sshipping_address with at least one info (likecountry or any other field).
Customer Sample from PayU API Docs
$customer =$payu->createCustomer(['customer_reference' =>'johntravolta18021954','email' =>'john@travolta.com',]);
Optional Props
$customer =$payu->createCustomer(['customer_reference' =>'johntravolta18021954','email' =>'john@travolta.com','first_name' =>'John','last_name' =>'Travolta','additional_details' => ['extra1' =>'Info Extra 1','extra2' =>'Info Extra 2',    ],'shipping_address' => ['country' =>'ARG','state' =>'TX','city' =>'Customer Shipping City','line1' =>'10705 Old Mill Rd','line2' =>'10706 Young Mill Rd','zip_code' =>'75402-3435','title' =>'Dr.','first_name' =>'John','last_name' =>'Travolta','phone' =>'23645963','email' =>'john@travolta.com',    ],]);

Delete Customer

$customer_id ='0ab5511c-3a62-4b4b-8682-cb3c15172965';$delete =$payu->deleteCustomer($customer_id);

Get Customer by ID

$customer_id ='0ab5511c-3a62-4b4b-8682-cb3c15172965';$customer =$payu->getCustomerById($customer_id);

Get Customers by Reference

$customer_reference ='johntravolta18021954';$customers =$payu->getCustomerByReference($customer_reference);

* Note:getCustomerByReference returns anarray not a single record likegetCustomerById;


Create Payment Method

$payment_method =$payu->createPaymentMethod($customer['id'],$token);

Testing

phpunit

Contributing

Feel free to contribute with anything on this package or contact us about it.

Security

If you discover any security related issues, please emailgiovanni@somosgad.com instead of using the issue tracker.

Credits

License

MIT. Please see thelicense file for more information.


[8]ページ先頭

©2009-2025 Movatter.jp