Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Merchant additional information in payment initialize #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,18 @@ public function pay()
//otherwise don't do anything
//config(['nagad.callback_url' => env('NAGAD_CALLBACK_URL')]);

$response = NagadPayment::create($amount, $trx_id); // 1st parameter is amount and 2nd is unique invoice number

//$response = NagadPayment::create($amount, $trx_id,1); // additional last parameter for manage difference account
// if you have additional information you can use below block, all fields are optional
$additionalMerchantInfo = [
'serviceName' => 'T Shirt',
'serviceLogoURL' => 'https://w7.pngwing.com/pngs/941/692/png-transparent-black-small-apple-logo-logo-material-apple-logo-black-thumbnail.png', // must be valid public URL
'additionalFieldNameEN' => 'Color',
'additionalFieldNameBN' => 'রং',
'additionalFieldValue' => 'White' // must be in English
];

$response = NagadPayment::create($amount, $trx_id, 0, $additionalMerchantInfo); // 1st parameter is amount and 2nd is unique invoice number

//$response = NagadPayment::create($amount, $trx_id, 1, $additionalMerchantInfo); // additional last parameter for manage difference account

if (isset($response) && $response->status == "Success"){
return redirect()->away($response->callBackUrl);
Expand Down
3 changes: 2 additions & 1 deletion src/Payment/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private function initPayment($invoice, $account=null)
* @throws InvalidPublicKey
* @throws NagadException
*/
public function create($amount, $invoice, $account=1)
public function create($amount, $invoice, $account=1, $additionalMerchantInfo = null)
{
if ($account == 1) $account=null;
else $account="_$account";
Expand All @@ -74,6 +74,7 @@ public function create($amount, $invoice, $account=1)
'sensitiveData' => $this->encryptWithPublicKey(json_encode($sensitiveOrderData),$account),
'signature' => $this->signatureGenerate(json_encode($sensitiveOrderData),$account),
'merchantCallbackURL' => config("nagad.callback_url$account"),
'additionalMerchantInfo' => $additionalMerchantInfo
]);
$response = json_decode($response->body());
if (isset($response->reason)) {
Expand Down