How can I integrate a new payment method in the Impulse Theme?

How can I integrate a new payment method in the Impulse Theme?

TBS2022
Trailblazer
243 2 36

Hello

I am using the Impulse Theme and need to add a Payment Implementation with our partner bank here.

I have all the documents for integration but just don't know how to do it.

Is anyone willing to help me

Regards

Replies 7 (7)

Don
Shopify Staff
2787 199 402

Hi there @TBS2022!

 

Thanks for reaching out for advice here in the Shopify Community.

 

Can you tell me a bit more about how your bank integrates with Shopify?

 

Is there a payment gateway integration available for this method, or do you maybe need to set this up as a manual payment method?

 

We would often see merchants adding bank transfer as a manual payment option, but feel free to let me know if this is not the case for your bank.

 

I'm happy to take a look at any instructions you have available to share, to see if that can help us to understand the situation and work together to get this moving forward for you.

 

Would you be setting up a store for a new business, or looking to grow an existing one?

Don | Social Care @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

TBS2022
Trailblazer
243 2 36

I believe it should be a manual payment

It's actually a special key that needs to be added to the code to access the payment app.

Please drop me a private message

Don
Shopify Staff
2787 199 402

Hi again @TBS2022!

 

We're actually not able to provide support via private message here, but I'm happy to take a look at any instructions you can share here to help you to understand what you'd need to be able to do.

 

If you need to add a snippet of code to your theme as per your bank's instructions, you can learn how to do so here on our help site.

 

I would always recommend that you create a duplicate copy of your theme before making any code changes so that you have a safe copy you can fall back on.

 

If instead, this gateway needs a custom API integration with Shopify, you might be best served by hiring a Shopify Expert to help you set that up

 

Let me know as much as you can about what you need to do here so we can get you moving forward with this!

Don | Social Care @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

TBS2022
Trailblazer
243 2 36

This is what i need to do - 

 
1. The customer clicks on the partner app within the my.t money app.
2. The my.t money app loads the partner app and send the headers to the partner app.
3. The partner app calls the doLogin function.
4. The my.t money gateway returns the login info to the partner app.
5. Customer clicks on ‘Pay with my.t money’.
6. The partner app calls the doPayment function.
7. The customer enters his/her PIN to authorise the payment.
8. The payment is processed by my.t money.
9. The customer is notified of the outcome of the transaction on my.t money app.
10.The my.t money gateway triggers the notify URL callback.
In case the notify URL callback cannot reach the merchant server, the retry
mechanism will attempt to deliver it for three more times at specific intervals.
11.The partner server returns product information of the purchase that will be
displayed in the my.t money app and SMS notifications to be pushed.
12.The customer receives payment SMS notifications.
13.The customer receives product details SMS notifications.
14.For the next payment, the partner app calls the reLogin function.
15.The my.t money gateway returns the login info to the partner app.

 
 
<?php
function getRequestHeaders()
{
    $headers = array();
    foreach ($_SERVER as $key => $value)
    {
        if (substr($key, 0, 5) <> 'HTTP_')
        {
            continue;
        }
        $header = str_replace(' ', '-', ucwords(str_replace('_', ' ', strtolower(substr($key, 5)))));
        $headers[$header] = $value;
    }
    return $headers;
}
$headers = getRequestHeaders();
foreach ($headers as $header => $value)
{
    echo "$header:
$value <br />\n";
}
?>
<html>
  <head>
    <title>MiniApp Sample Code - v1</title>
    <script src="https://miniapp.mytmoney.mu/mini-app/v1/miniappcore.min.js"></script>
    <script>
      // 1. Get the headers from the webview
      var authToken = "<?php echo $headers['Authtoken']; ?>";
      var mAppId = "<?php echo $headers['M-App-Id']; ?>";
      var MERCH_KEY = "tRnwXJKJYOMyOZ3OB2XzqhZu13kz/u2BSDmq0RwfOZw="; // my.t money team will provide this key
      var channel = "<?php echo $headers['Channel'];?>";
      var version = "<?php echo $headers['Version'];?>";
      var userId = "<?php echo $headers['X-Userid'];?>";
      var customerUserId = "<?php echo $headers['Customeruserid'];?>";
      var firstPayment = true;
    </script>
  </head>
  <body onload="onLoad()">
    <h1>Sample Code to implement the my.t money miniappcore.js</h1>
    <h2>Kindly note that this page will work only when accessed via the my.t money webview</h2>
    <button id="payBtn">Pay Rs1</button>
    <script>
      // console.log(`MERCH_KEY: ${MERCH_KEY}`);
      // console.log(MERCH_KEY);
      // console.log(firstPayment);
      
      // 2. Get the payment token from the doLogin API
      async function onLoad(){
        console.log("This is loaded!");

        let paymentToken = undefined;

        try {
          paymentToken = await doLogin(authToken, mAppId, userId, "", "", "", channel, MERCH_KEY);
          console.log(`paymentToken: ${paymentToken}`);
        } catch (err) {
          console.error(err);
        }

        // 3. Call the doPayment API
        payBtn.addEventListener("click", async function () {

          // The merchantTradeNo must be unique
          let merchantTradeNo = "merTest" + Date.now();
          console.log(merchantTradeNo);
          
          // NOTE: You can use the paymentToken from the doLogin API only once
          // Example: payment failed for insufficient funds, user pin wrongly entered, etc.
          // For next payment, you need to call the reLogin API to get a new paymentToken
          if (firstPayment) {

            // * will be provided by the my.t money team 
            // % available in the headers
            // # must be provided by the merchant
            // NOTE: merchantTradeNo must be unique for each merchant & each payment

            doPayment(
              1,                // # amount #
              "remarks",        // # remarks #
              merchantTradeNo,  // # merchantTradeNo #
              userId,           // % userId %
              mAppId,           // % appId %
              null,             // # dynamicHeader1 (optional) #
              null,             // # dynamicHeader2 (optional) #
              null,             // # dynamicHeader3 (optional) #
              null,             // # dynamicHeader4 (optional) #
              null,             // # dynamicValue1 (optional) #
              null,             // # dynamicValue2 (optional) #
              null,             // # dynamicValue3 (optional) #
              null,             // # dynamicValue4 (optional) #
              paymentToken,     // from the login api
              'https://myt.mu'  // # notifyURL when payment completed #
            );

            firstPayment = false;

          } else {
            
            try {
              // 4. Get a new paymentToken via the reLogin API
              paymentToken = await reLogin(authToken, mAppId, userId, customerUserId, channel, MERCH_KEY);

              // 5. Then do the payment
              doPayment(
                1,                // # amount #
                "remarks",        // # remarks #
                merchantTradeNo,  // # merchantTradeNo #
                userId,           // % userId %
                mAppId,           // % appId %
                null,             // # dynamicHeader1 (optional) #
                null,             // # dynamicHeader2 (optional) #
                null,             // # dynamicHeader3 (optional) #
                null,             // # dynamicHeader4 (optional) #
                null,             // # dynamicValue1 (optional) #
                null,             // # dynamicValue2 (optional) #
                null,             // # dynamicValue3 (optional) #
                null,             // # dynamicValue4 (optional) #
                paymentToken,     // from the login api
                'https://myt.mu'  // # notifyURL when payment completed #
              );

            } catch (err) {
              console.error(err);
            }
          }
        });
      }

    </script>
  </body>
</html>
 
Displaying 2.index.php.
TBS2022
Trailblazer
243 2 36

@Don any update?

TBS2022
Trailblazer
243 2 36

can anyone help me out for a payment integration?

Don
Shopify Staff
2787 199 402

Hi again @TBS2022!

 

Thanks for getting back to me with that extensive further info, and apologies for my delay in replying here as I have been away from work for some time now.

 

It looks, based on the info you have shared here, as though this type of integration would necessitate the services of an Expert developer to put in place rather than the use of a manual payment method.

 

I'd recommend you spend some time checking our Expert Marketplace here to see who you might consider consulting or hiring for this project.

 

Can you tell me a bit more about what you're selling, and anything else you're working on for your business currently?

Don | Social Care @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog