fourello-devs / paymaya-wrapper
This package is abandoned and no longer maintained.
The author suggests using the fourello-devs/paymaya package instead.
Laravel-flavored Wrapper for Paymaya SDK
dev-master
2021-05-06 22:23 UTC
Requires
- illuminate/support: ~7|~8
- paymaya/paymaya-sdk: ^0.0.2
Requires (Dev)
- orchestra/testbench: ~5|~6
- phpunit/phpunit: ~9.0
This package is auto-updated.
Last update: 2023-03-22 02:41:36 UTC
README
This is where your description should go. Take a look at contributing.md to see a to do list.
Installation
Via Composer
$ composer require fourello-devs/paymayawrapper
Usage
This package offers two convenient way to directly use PaymayaSDK.
- PaymayaWrapper facade
- paymaya() helper function
Setup Environment Variables
PAYMAYA_CHECKOUT_PUBLIC_KEY= PAYMAYA_CHECKOUT_SECRET_KEY= PAYMAYA_CHECKOUT_ENVIRONMENT=SANDBOX PAYMAYA_PAYMENT_PUBLIC_KEY= PAYMAYA_PAYMENT_SECRET_KEY= PAYMAYA_PAYMENT_ENVIRONMENT=SANDBOX PAYMAYA_LOGO_URL= PAYMAYA_ICON_URL= PAYMAYA_APPLE_TOUCH_ICON_URL= PAYMAYA_CUSTOM_TITLE=AppName PAYMAYA_COLOR_SCHEME='#368d5c'
Demonstration
use PayMaya\API\Checkout; use PayMaya\Model\Checkout\Address; use PayMaya\Model\Checkout\Buyer; use PayMaya\Model\Checkout\Contact; use PayMaya\Model\Checkout\Item; use PayMaya\Model\Checkout\ItemAmount; use PayMaya\Model\Checkout\ItemAmountDetails; public function checkoutTest(): array { // Initialize PaymayaSDK paymaya(); // Create Checkout $itemCheckout = new Checkout(); // Checkout Address $address = new Address(); $address->line1 = "9F Robinsons Cybergate 3"; $address->line2 = "Pioneer Street"; $address->city = "Mandaluyong City"; $address->state = "Metro Manila"; $address->zipCode = "12345"; $address->countryCode = "PH"; // Checkout Buyer $buyer = new Buyer(); $buyer->firstName = 'James Carlo'; $buyer->middleName = 'Sebial'; $buyer->lastName = 'Luchavez'; // Contact $contact = new Contact(); $contact->phone = "09061886959"; $contact->email = "carlo.luchavez@fourello.com"; $buyer->contact = $contact; $buyer->shippingAddress = $address; $buyer->billingAddress = $address; $itemCheckout->buyer = $buyer; // Item $itemAmountDetails = new ItemAmountDetails(); $itemAmountDetails->shippingFee = "14.00"; $itemAmountDetails->tax = "5.00"; $itemAmountDetails->subtotal = "50.00"; $itemAmount = new ItemAmount(); $itemAmount->currency = "PHP"; $itemAmount->value = "100.00"; $itemAmount->details = $itemAmountDetails; $item = new Item(); $item->name = "Leather Belt"; $item->code = "pm_belt"; $item->description = "Medium-sized belt made from authentic leather"; $item->quantity = "1"; $item->amount = $itemAmount; $item->totalAmount = $itemAmount; $itemCheckout->items = array($item); $itemCheckout->totalAmount = $itemAmount; $itemCheckout->requestReferenceNumber = "123456789"; $itemCheckout->redirectUrl = array( "success" => url()->to('/api/paymaya/success'), "failure" => url()->to('/api/paymaya/failure'), "cancel" => url()->to('/api/paymaya/cancel') ); $itemCheckout->execute(); return [ 'id' => $itemCheckout->id, 'url' => $itemCheckout->url, ]; }
Change log
Please see the changelog for more information on what has changed recently.
Testing
$ composer test
Contributing
Please see contributing.md for details and a todolist.
Security
If you discover any security related issues, please email carlo.luchavez@fourello.com instead of using the issue tracker.
Credits
License
MIT. Please see the license file for more information.