1. Go to this page and download the library: Download coreproc/paymaya-sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
coreproc / paymaya-sdk example snippets
php
$payMayaApi = new \CoreProc\PayMaya\PayMayaApi('<SECRET_API_KEY>',
'<PUBLIC_API_KEY>', \CoreProc\PayMaya\PayMayaApi::ENVIRONMENT_SANDBOX);
$checkout = new \CoreProc\PayMaya\Requests\Checkout();
$checkout->setTotalAmount(
(new \CoreProc\PayMaya\Requests\TotalAmount())
->setCurrency('PHP')
->setValue(6304.90)
->setDetails(
(new \CoreProc\PayMaya\Requests\AmountDetail())
->setDiscount(300.00)
->setServiceCharge(50.00)
->setShippingFee(200.00)
->setTax(691.60)
->setSubtotal(5763.30))
)->setBuyer(
(new \CoreProc\PayMaya\Requests\Buyer())
->setFirstName('Juan')
->setMiddleName('dela')
->setLastName('Cruz')
->setContact(
(new \CoreProc\PayMaya\Requests\Contact())
->setEmail('[email protected]')
->setPhone('+63(2)1234567890')
)->setShippingAddress(
(new \CoreProc\PayMaya\Requests\Address())
->setLine1('9F Robinsons Cybergate 3')
->setLine2('Pioneer Street')
->setCity('Mandaluyong City')
->setState('Metro Manila')
->setZipCode('12345')
->setCountryCode('PH')
)->setBillingAddress(
(new \CoreProc\PayMaya\Requests\Address())
->setLine1('9F Robinsons Cybergate 3')
->setLine2('Pioneer Street')
->setCity('Mandaluyong City')
->setState('Metro Manila')
->setZipCode('12345')
->setCountryCode('PH')
)
->setIpAddress('125.60.148.241')
)->setItems([
(new \CoreProc\PayMaya\Requests\Item())
->setName('Canvas Slip Ons')
->setCode('CVG-096732')
->setDescription('Shoes')
->setQuantity(3)
->setAmount(
(new \CoreProc\PayMaya\Requests\ItemAmount())
->setValue(1621.10)
->setDetails(
(new \CoreProc\PayMaya\Requests\AmountDetail())
->setDiscount(100.00)
->setSubtotal(1721.10)
)
)->setTotalAmount(
(new \CoreProc\PayMaya\Requests\TotalAmount())
->setValue(4863.30)
->setDetails(
(new \CoreProc\PayMaya\Requests\AmountDetail())
->setDiscount(300)
->setSubtotal(5163.30)
)
),
(new \CoreProc\PayMaya\Requests\Item())
->setName('PU Ballerina Flats')
->setCode('CVG-096733')
->setDescription('Shoes')
->setQuantity(1)
->setAmount(
(new \CoreProc\PayMaya\Requests\ItemAmount())
->setValue(600)
)->setTotalAmount(
(new \CoreProc\PayMaya\Requests\TotalAmount())
->setValue(600)
),
])->setRedirectUrl(
(new \CoreProc\PayMaya\Requests\RedirectUrl())
->setSuccess('http://shop.test/success')
->setFailure('http://shop.test/failure')
->setCancel('http://shop.test/cancel')
)->setRequestReferenceNumber('0001');
$checkoutResponse = $payMayaApi->checkout($checkout);
echo $checkoutResponse->getRedirectUrl();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.