1. Go to this page and download the library: Download shaz3e/peach-payment 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/ */
shaz3e / peach-payment example snippets
use Shaz3e\PeachPayment\Helpers\PeachPayment;
// Use the following code within your controller method
/**
* Update in .env previously and get it from config
*/
$entityId = config('peach-payment.entity_id');
/**
* Dynamic amount should be float
* It can be passed via request
*/
$amount = (float) $request->amount;
/**
* Return URL is optional
* If you want user to redirect to another URL of your approved domain you can use the following
* Do not use / at the beginnig of the $return_url as it will generate URL i.e. config('peach-payment.domain').'/'.$return_url.'/?PeachPaymentOrder='.$order_number
*/
$return_url = 'after-main-domain/route/sub-route/?PeachPaymentOrder=OID123456789'; // Optional
/**
* Create new request for PeachPayment helper
*/
$peachPayment = new PeachPayment();
/**
* Generate token and initiate the request
*/
$checkoutData = $peachPayment->createCheckout($amount);
/**
* Optional
* Get Order Number if you want to update record in database
* suggest me this is just for reconcile purpose
* $checkoutData['order_number'] = OID.time()
*/
$order_number = $checkoutData['order_number'];
/**
* CheckoutId is unique id generated by PeachPayment
* This should be passed to render the form in blade template
*/
$checkoutId = $checkoutData['checkoutId'];
return view('your.view', compact('entityId', 'checkoutId'));