1. Go to this page and download the library: Download obydul/laraskrill 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/ */
/**
* Construct.
*/
private $skrilRequest;
public function __construct()
{
// skrill config
$this->skrilRequest = new SkrillRequest();
$this->skrilRequest->pay_to_email = '[email protected]'; // your merchant email
$this->skrilRequest->return_url = 'RETURN URL';
$this->skrilRequest->cancel_url = 'CANCEL URL';
$this->skrilRequest->logo_url = 'https://cdn.shouts.dev/images/shoutsdev.png'; // optional
$this->skrilRequest->status_url = 'IPN URL or Email'; // you can use https://webhook.site webhook url as test IPN
$this->skrilRequest->status_url2 = 'IPN URL or Email'; // optional
}
// Import the class namespaces first, before using it directly
use Obydul\LaraSkrill\SkrillClient;
use Obydul\LaraSkrill\SkrillRequest;
// Create object instance
$request = new SkrillRequest();
$client = new SkrillClient($request);
// Methods
$sid = $client->generateSID();
$client->paymentRedirectUrl($sid);
$refund_prepare_response = $client->prepareRefund();
$do_refund = $client->doRefund();
// create object instance of SkrillRequest
$this->skrilRequest->amount = '10.26';
$this->skrilRequest->currency = 'USD';
$this->skrilRequest->language = 'EN';
$this->skrilRequest->prepare_only = '1';
// custom fields (optional)
$this->skrilRequest->merchant_fields = 'site_name, invoice_id, customer_id, customer_email';
$this->skrilRequest->site_name = 'Shout.dev';
$this->skrilRequest->invoice_id = 'INV_' . strtoupper(str()->random(10));
$this->skrilRequest->customer_id = 1001;
$this->skrilRequest->customer_email = '[email protected]';
$this->skrilRequest->detail1_description = 'Product ID:';
$this->skrilRequest->detail1_text = '101';
// you can also pass your unique transaction id (optional)
// $this->skrilRequest->transaction_id = 'SHOUTSTX0001';
// create object instance of SkrillClient
$client = new SkrillClient($this->skrilRequest);
$sid = $client->generateSID(); //return SESSION ID
// handle error
$jsonSID = json_decode($sid);
if ($jsonSID != null && $jsonSID->code == "BAD_REQUEST")
return $jsonSID->message;
// do the payment
$redirectUrl = $client->paymentRedirectUrl($sid); //return redirect url
return redirect()->to($redirectUrl); // redirect user to Skrill payment page
// Create object instance of SkrillRequest
$prepare_refund_request = new SkrillRequest();
// config
$prepare_refund_request->email = 'merchant_email';
$prepare_refund_request->password = 'api_password';
$prepare_refund_request->refund_status_url = 'refund_status_url';
// request
$prepare_refund_request->transaction_id = 'MNPTTX0001';
$prepare_refund_request->amount = '5.56';
$prepare_refund_request->refund_note = 'Product no longer in stock';
$prepare_refund_request->merchant_fields = 'site_name, customer_email';
$prepare_refund_request->site_name = 'Your Website';
$prepare_refund_request->customer_email = '[email protected]';
// do prepare refund request
$client_prepare_refund = new SkrillClient($prepare_refund_request);
$refund_prepare_response = $client_prepare_refund->prepareRefund(); // sid or error code
// refund requests
$refund_request = new SkrillRequest();
$refund_request->sid = $refund_prepare_response;
// do refund
$client_refund = new SkrillClient($refund_request);
$do_refund = $client_refund->doRefund();
dd($do_refund); // response
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.