Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Skrill IPN by Md. Obydullah - Extension for LaraSkrill (https://github.com/mdobydullah/laraskrill)
<?php
/**
* Created by: Md. Obydullah
* File: skrill-ipn.php
* Date: March 18, 2019
* Description: If you want to receive and store data from 'status_url' instead of receiving email, then use this code to your to your IPN listener.
*/
// routes - web
Route::post('skrill-ipn', 'SkrillController@ipn');
// receive data from status_url (SkrillController)
public function ipn(Request $request)
{
// skrill data - get more fields from Skrill Quick Checkout Integration Guide 7.9 (page 23)
$transaction_id = $request->input('transaction_id');
$mb_transaction_id = $request->input('mb_transaction_id');
$invoice_id = $request->input('invoice_id'); // custom field
$order_from = $request->input('order_from'); // custom field
$biller_email = $request->input('pay_from_email');
$customer_email = $request->input('customer_email'); // custom field
$payer_id = $request->input('customer_id');
$currency = $request->input('currency');
$amount = $request->input('amount');
$status = $request->input('status');
$order_products = $request->input('order_products'); // custom field
// status message
if ($status == '-2') {
$status_message = 'Failed';
} else if ($status == '2') {
$status_message = 'Processed';
} else if ($status == '0') {
$status_message = 'Pending';
} else if ($status == '-1') {
$status_message = 'Cancelled';
}
// now store data to database
$order_id = DB::table('orders')->insertGetId([
'customer_id' => $customer_id,
'transaction_id' => $mb_transaction_id,
'invoice_id' => $invoice_id,
'payer_id' => $payer_id,
'method' => "Skrill",
'status' => $status_message,
'email_to' => $customer_email,
'currency' => $currency,
'total' => $amount,
'order_from' => $order_from,
'type' => 'New'
]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.