Modesy Help Center
Modesy Help Center
Modesy Help Center
KNOWLEDGE BASE
License System
Adding a New Payment Gateway
Can I use the script on There are 3 steps for adding a payment gateway:
multiple domains?
Payment systems generally work with API keys ( "public_key" and "secret_key" ). These key names may
How can I change my
be different for some systems, but logically work the same way.
license code
(domain)? To add a new payment system, open the "payment_gateways" table in your database via
phpMyAdmin and click the "Insert" link from the menu above to add your payment system.
Shipping System id Leave this field blank because the id is automatically generated.
How can I change logo name Enter your payment system name.
size?
Example: Modesy Pay
Can I use the script on secret_key Enter the secret_key value you created in your payment account.
Windows Server(IIS)? Example: EL6tE3pLtJ13JebQI5n3Fy57xL7...
How can I update my environment This is the payment mode option offered by your payment system. If you
site to a new version?
want to add test API keys for your payment system and perform payment
tests, you must enter "sandbox" here. If you want to enter your live API keys
How can I change a
and receive payments after tests, you must enter "production".
text in the script?
Example: sandbox
How can I prevent status 1 or 0. If you do not want the payment system to appear on your site, you
content on my site need to enter 0. Otherwise, you need to enter 1.
from being copied? Example: 1
Content Adding logos Our script displays logos for each payment system on the payment
Problem
methods page. These logos are located in the "assets / img / payment"
folder. For the payment system you add, you can add the logo names you
Adding Static Pages
want to show by putting commas between them. You can upload your own
SVG logos to this folder.
Adding a New Payment
Example: visa,mastercard,amex,discover
Gateway
https://codingest.net/knowledge-base?content=197 1/7
02/08/2023 12:10 Modesy | Help Center
KNOWLEDGE BASE
License System
Shipping System
B. Web Redirect Integration: This method allows you to accept payments on an external web page.
How can I update my After the payment is completed, the payment system sends the payment result to the server side.
site to a new version?
You need to read the documentation of the payment gateway you want to add, learn how it works, and
How can I change a
decide which method you want to add. Payment methods usually have several integration methods.
text in the script?
After reading the API documentation of the payment gateway and understanding the working logic, you
can start the integration process.
Image Upload Problem
First you need to add a "view" for the payment method. All HTML, CSS and JavaScript codes of the
PayPal is not working
on my site payment method should be added to this file. To do this, open the
"app/Views/cart/payment_methods" folder and create a PHP file for your payment method. Your
How can I prevent "name_key" value that in your database and your file name must be the same. For example, if your
content on my site "name_key" value is "modesy_pay", you must create a file named "_modesy_pay.php".
from being copied?
You need to add a function to the "app/Controllers/CartController.php" file to verify the payment and
Adding Static Pages add the order to the database after the payment is made. Open this file and create your function. For
example, if your "name_key" is "modesy_pay", you can create this fuction like this:
Adding a New Payment
Gateway
https://codingest.net/knowledge-base?content=197 2/7
02/08/2023 12:10 Modesy | Help Center
/**
* Payment with Modesy Pay
*/
KNOWLEDGE BASE public function modesyPayPaymentPost()
{
License System
}
Shipping System
Modesy has CSRF protection. When this protection is active, a request cannot be sent to your site
How can I change logo
size? from any external source via POST method. If your payment system sends the payment result to
your site with POST method, this request may not reach your site. To solve this problem, you can
How can I see the exclude the requests coming from the route you created. To do this, open the
changes after "app/Config/Filters.php" file and add the route you created as in the example below.
changing the codes?
Example:
How can I use the
script on the NGINX public array $globals = [
server? 'before' => [
'csrf' => ['except' => ['modesy-pay-payment-post']],
Can I use the script on ],
Windows Server(IIS)? ...
After following these steps, you can add your payment gateway codes to the "_modesy_pay.php" file.
Image Upload Problem The following PHP variables are available in this file and you need to use them for payment process:
PayPal is not working integer number. In this case, you can multiply the total amount by 100.
on my site $currency: The currency of the payment. (Example: USD)
$mdsPaymentType: There are 3 types of payments in the Modesy. There are "sale", "membership"
How can I prevent and "promote" payments. You can use this variable if you need to make some differences
content on my site according to payment type.
from being copied?
$mdsPaymentToken: This variable has a unique token created for the payment. This token can be
used to verify the payment.
Content Adding
$paymentGateway: This variable is the payment method object chosen by the user. This variable
Problem
contains all the values for the payment method you have added to the database. For example, if
you want to access the "name_key" value for the selected payment method, you can access it
Adding Static Pages
with "$paymentGateway->name_key" code.
https://codingest.net/knowledge-base?content=197 3/7
02/08/2023 12:10 Modesy | Help Center
We will use PayPal JavaScript integration codes as an example to show how the payment gateway
codes can be added to the "_modesy_pay.php" file.
KNOWLEDGE BASE
License System The codes below are PayPal JavaScript integration codes. If you add these codes to the
"_modesy_pay.php" file, you will see the PayPal payment button in the payment section. After the
Can I use the script on payment approved, you can send the paymet details to the function you created with AJAX POST
multiple domains? method.
_modesy_pay.php
Invalid License Code
Adding Static Pages to the database. Each payment system has a different payment verification system. You can find the
necessary codes in the API documentation of your payment system. You need to add these codes to
the "modesyPayPaymentPost" function that you created in the "app/Controllers/CartController.php"
Adding a New Payment
Gateway file.
https://codingest.net/knowledge-base?content=197 4/7
02/08/2023 12:10 Modesy | Help Center
You can get the variables you send with AJAX POST with inputPost() and inputGet() functions in the
function you created. Also, if your payment system accepts the payments on an external web page and
then returns the necessary variables, you can receive these variables in the same way.
KNOWLEDGE BASE * First you need to check the payment method. If the payment method is not exist or enabled, you
need to return an error.
License System
$paypal = getPaymentGateway('paypal');
Can I use the script on
multiple domains?
if (empty($paypal)) {
setErrorMessage("Payment method not found!");
echo json_encode([
Invalid License Code
'result' => 0
]);
How can I change my exit();
license code }
(domain)?
$paymentId = inputPost('payment_id');
How can I change logo loadLibrary('Paypal');
size? $paypalLib = new \Paypal($paypal);
//validate the order
How can I see the if ($paypalLib->getOrder($paymentId)) {
changes after //payment is valid
changing the codes? }
if ($paypalLib->getOrder($paymentId)) {
How can I update my $dataTransaction = [
site to a new version? 'payment_method' => 'PayPal',
'payment_id' => $paymentId,
How can I change a 'currency' => inputPost('currency'),
text in the script? 'payment_amount' => inputPost('payment_amount'),
'payment_status' => inputPost('payment_status'),
];
Image Upload Problem
$mdsPaymentType = inputPost('mds_payment_type');
//add order
Why are digital files $response = $this->executePayment($dataTransaction, $mdsPaymentType,
stored locally? langBaseUrl());
if ($response->result == 1) {
PayPal is not working setSuccessMessage($response->message);
on my site echo json_encode([
'result' => 1,
How can I prevent
'redirectUrl' => $response->redirectUrl
content on my site ]);
from being copied? } else {
setErrorMessage($response->message);
echo json_encode([
Content Adding
'result' => 0
Problem
]);
}
Adding Static Pages }
https://codingest.net/knowledge-base?content=197 5/7
02/08/2023 12:10 Modesy | Help Center
/**
* Payment with Paypal
KNOWLEDGE BASE
*/
License System
public function paypalPaymentPost()
{
$paypal = getPaymentGateway('paypal');
Can I use the script on
if (empty($paypal)) {
multiple domains?
setErrorMessage("Payment method not found!");
echo json_encode([
Invalid License Code 'result' => 0
]);
How can I change my exit();
license code }
(domain)? $paymentId = inputPost('payment_id');
loadLibrary('Paypal');
$paypalLib = new \Paypal($paypal);
How can I move my
site to a new domain //validate the order
or server? if ($paypalLib->getOrder($paymentId)) {
$dataTransaction = [
'payment_method' => 'PayPal',
Shipping System
'payment_id' => $paymentId,
'currency' => inputPost('currency'),
How can I change logo 'payment_amount' => inputPost('payment_amount'),
size? 'payment_status' => inputPost('payment_status'),
];
How can I see the $mdsPaymentType = inputPost('mds_payment_type');
changes after //add order
changing the codes? $response = $this->executePayment($dataTransaction, $mdsPaymentType,
langBaseUrl());
How can I use the if ($response->result == 1) {
script on the NGINX setSuccessMessage($response->message);
server? echo json_encode([
'result' => 1,
'redirectUrl' => $response->redirectUrl
Can I use the script on
]);
Windows Server(IIS)?
} else {
setErrorMessage($response->message);
How can I update my echo json_encode([
site to a new version?
'result' => 0
]);
How can I change a }
text in the script? } else {
setErrorMessage(trans("msg_error"));
Image Upload Problem echo json_encode([
'result' => 0
]);
Why are digital files
}
stored locally?
}
Content Adding
Problem
database, so you do not need to add the same record to the database again.
Also, if you've made an addition to the "csrf" array in the "app/Config/Filters.php" file for your
payment system, don't forget to add it again for the new version as well.
KNOWLEDGE BASE
License System
Important: We have prepared this documentation to show you how you can add a payment
system to our script. We have explained all the details you need to know about our codes.
Can I use the script on
However, adding a payment system can be difficult because almost all payment systems
multiple domains?
work differently and have different codes. If you are unable to add your payment system by
following these steps, or if you encounter errors while adding your payment system, we
Invalid License Code
recommend that you to work with a developer. As we do not have a support or customization
service, we will not be able to help you to add your payment system or solve the problems you
How can I change my
license code
see.
(domain)?
Shipping System
Copyright © 2022 Codingest - All Rights Reserved.
Content Adding
Problem
https://codingest.net/knowledge-base?content=197 7/7