Integration of Paypal Pay in 4 code in Hikashop eCommerce system

  • Posts: 39
  • Thank you received: 0
3 years 2 months ago #335641

-- HikaShop version -- : 4.4.3
-- Joomla version -- : 3.8.13
-- PHP version -- : 5.6.40
-- Browser(s) name and version -- : Google Chrome

Hi Nicolas and the community,

I am wondering if it is possible to integrate Paypal's latest Buy Now Pay Later feature that pay in 4 instalments into Hikashop system?

PayPal Australia provided code and instructions to add into the Hikashop system.

Can anyone able to assist to see if this implementation can be feasible and done with the "Display Views" where we can put the following paypal code into the cart price" and dynamically add value on the price in the single item/cart view?

<!-- In your code, dynamically update
data-pp-amount with the price or cart amount.
For example, data-pp-amount=“89.99”
for $89.99 product
-->
<div
    data-pp-message
    data-pp-style-layout="text"
    data-pp-style-logo-type="inline"
    data-pp-style-text-color="black"
    data-pp-amount="ENTER_VALUE_HERE">
</div>

Thank you

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 2 months ago #335650

Hi,

It sure can be done.
Note that as per developer.paypal.com/ppdevdocs/docs/busi...es/credit-messaging/ you also need the line:

<script src="https://www.paypal.com/sdk/js?client-id=YOUR-CLIENT-ID&components=messages"></script>
where you replace YOUR-CLIENT-ID by the client ID provided to you by PayPal.
Then, where to put it depends a bit on the situation.
You could place the code on the product page, so that instead of adding the product to the cart, the customer could click on that button to directly be redirected to PayPal for the payment of that one product. In that case, you could edit product / show_default.php and and the amount would be available with:
<?php echo round($this->element->prices[0]->price_value_with_tax, 2); ?>
Or you could edit checkout / show_block_cart.php to add the code on the cart view of the checkout. There, you could add such code:
<?php echo round($cart->full_total->prices[0]->price_value_with_tax, 2); ?>[/code]
Note that you can't put your code before the line:
$cart = $this->checkoutHelper->getCart();
since that line initializes $cart which you need for the amount.

Please Log in or Create an account to join the conversation.

  • Posts: 39
  • Thank you received: 0
3 years 2 months ago #335801

Hi Nicolas,

Thanks for your reply and information provided.

I followed your suggestion and advice by inserting pieces of code to "show_block_cart.php" view under Checkout (under Display config) as shown in the attachments

1) Paypal messaging

<div
    data-pp-message
    data-pp-style-layout="text"
    data-pp-style-logo-type="inline"
    data-pp-style-text-color="black"
    data-pp-amount="<?php echo round($cart->full_total->prices[0]->price_value_with_tax, 2); ?>">
</div>

in Line 469 after hikashop_checkout_cart_final_total container

2) Paypal SDK head tag placed in the same show-block-cart view file in line 11.

After placing items on checkout and testing checkout, the final step of checkout did not show the Paypal Messaging that shows available to pay in 4 instalments.

I am not sure what went wrong as it did not work.

Our template framework uses Gantry5.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 2 months ago #335809

Hi,

So I had a look on the link you gave in your first message, and I can see you're using HikaShop 4.0.0 there and not the 4.4.3 as you said in your first message.
Also, because of that, you have the setting "checkout legacy" in the HikaShop configuration. That setting has been removed since HikaShop 4.4.0.
And since you activated that setting, you are using the old checkout system of HikaShop, from HikaShop 1.x and 2.x.
The old checkout system of HikaShop doesn't use show_block_cart.php so that's normal that you didn't see any changes.

With the legacy checkout, you need to edit instead checkout / cart.php and instead of

<?php echo round($cart->full_total->prices[0]->price_value_with_tax, 2); ?>
you need to use:
<?php echo round($this->full_total->prices[0]->price_value_with_tax, 2); ?>

Please Log in or Create an account to join the conversation.

  • Posts: 39
  • Thank you received: 0
3 years 1 month ago #335928

Hi Nicolas.

Thank you for your advice and information provided, muchly appreciated.
I tried putting the messaging code in legacy checkout cart file and it seems worked displaying (refer to attached screenshot)
However when I log in Paypal to view pay in 4 options and pay in 4 agreement, it didn't show in Paypal.

Any suggestions on how to get the data successfully passed to Paypal?

Thanks

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 1 month ago #335940

Hi,

Reading a bit online, it seems that for the "pay in 4" to be available to the customer, PayPal needs to deem them qualified to be able to use that capability.
So maybe it thought you didn't qualify for some reason when you tried ?
I would recommend you to check with PayPal tech / merchant support about the situation as I'm not familiar with all that.

Please Log in or Create an account to join the conversation.

  • Posts: 39
  • Thank you received: 0
3 years 1 month ago #336022

Hi Nicholas.

Thank you for your reply.

I have had a look at PayPal documentation about creating button to display "Pay Later" as attached screenshot

I am not sure whether the value of total amount and items generated by Hikashop can be passed through as parameter values to PayPal and subsequently create order in Hikashop same time as PayPal order.

On other side I was thinking maybe using PayPal REST api plugin to install? www.hikashop.com/marketplace/product/236-paypal-rest.html to enable data to go through PayPal ?

Regards

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 1 month ago #336024

Hi,

Well, I didn't see any information about being able to pass that in the documentation I read about your pay in 4 link.
So I'm not sure.
Did you provide a copy of the generated HTML (and maybe the link to the shop with the instructions to reproduce the issue) to the tech support of PayPal as he asks you in his message ?
He will be able to tell you if you're missing things with what you added.

PayPal REST can be used to process payments with PayPal. However, that won't help with your pay in 4 integration.

Please Log in or Create an account to join the conversation.

  • Posts: 39
  • Thank you received: 0
3 years 1 month ago #336197

Thank you Nicolas.
Apparently PayPal said that we must disable WPS (Website Payment Standard) processing in our account.
I had a look at Hikashop plugin integrations and could not find any reference relating to Website Payment Standard.
Only Paypal Pro and Paypal Checkout were listed in plugins, as per attached screenshot.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 1 month ago #336207

Hi,

From what I understand it means that a setting in your PayPal merchant account has to be changed. So nothing you can do in HikaShop itself.

Please Log in or Create an account to join the conversation.

  • Posts: 39
  • Thank you received: 0
3 years 3 weeks ago #336574

Hi Nicholas

Thanks for your reply.
I had a quick research and found this article wordpress.org/plugins/wp-express-checkout/ which seems generating paypal checkout and also pay in 4 option.

Just wondering if I install this will it affect Hikashop in terms of checkout page?

Thank you

Please Log in or Create an account to join the conversation.

  • Posts: 4747
  • Thank you received: 644
  • MODERATOR
3 years 3 weeks ago #336585

Hello,

You have the HikaShop Paypal Express Checkout payment plugin will work approximately as in the video of your link.
Learn more about this payment plugin, here .

Hope this will fit your needs.
Regards

Last edit: 3 years 3 weeks ago by Philip.

Please Log in or Create an account to join the conversation.

  • Posts: 39
  • Thank you received: 0
2 years 2 months ago #344968

Hi Nicolas or Phillipe.

I tried to put the Pay in 4 messaging using Paypal SDK script in the checkout legacy view page (checkout -> cart) but for some reason it doesn't show the rendered message at all, despite successfully passing total cart value with tax and shipping from hikashop cart?
Please refer to the screenshot attached for reference.

Attachments:
Last edit: 2 years 2 months ago by Handychef.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 2 months ago #344973

Hi,

We actually released yesterday HikaShop 4.6.2 which contains a new PayPal Checkout payment plugin. This plugin uses the latest PayPal Checkout API.
And if I read correctly on this page about PayPal Pay Later ( which includes "Pay in 4" www.paypal.com/us/business/accept-payments/installments ) it says that this is possible with PayPal Checkout:

Included with PayPal Checkout
Once you create a PayPal account and integrate PayPal Checkout, it’s easy to set up Pay Later messaging.


However, this would require updating to the latest version of HikaShop and thus switching to the new checkout system of HikaShop, as the legacy one has been removed a while back.

Integrating Pay in 4 in the legacy checkout of an old HikaShop is probably possible but complex. I rather recommend updating. It will be easier to do and you'll get all the new things and fixes we've added in HikaShop since then.

Please Log in or Create an account to join the conversation.

  • Posts: 39
  • Thank you received: 0
2 years 1 month ago #345067

Hi Nicolas,

Thank you for your reply.
We have made a clone of the website and purchased Essential in the latest version to upload to Joomla via Plugin manager so that new plugin for Paypal Checkout is added and enabled. I have several plugins that relate to Paypal as shown in the screenshot, would these variations of Paypal plugins affect the display of Pay in 4 Messaging?
I have enabled Paypal Check out plugin which is part of the latest version of HIkashop and tried to check out on the website to go to check out page to see if the Pay in 4 messaging "Pay in 4 interest-free payments of $X.00 with PayPal" appears however unfortunately it did not.

Any suggestions on how we can get the Pay in 4 messaging to appear correctly?

I used this Paypal messaging code as follows:
<scriptsrc=" www.paypal.com/sdk/js?client-id=XXXXXXXX...&components=messages "></script>
<font color="black"><div data-pp-message data-pp-style-layout="text" data-pp-style-logo-type="inline" data-pp-style-text-color="black" data-pp-amount="<?php echo round($this->full_total->prices[0]->price_value_with_tax, 2); ?>"></div></font>

Thank you.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 1 month ago #345092

Hi,

Your HTML code is only to display an information message about the "Pay in 4" capability. It won't allow your customers to use the "Pay in 4" capability.

To use PayPal Checkout, you need to go in the menu System>Payment methods and create a new payment method and select the "PayPal Checkout payment plugin". Then, configure it with the API credentials of your merchant PayPal account.
When you select that payment method during your checkout, PayPal will display automatically the available payment modes to you, and if the merchant PayPal account has access to "Pay in 4", and PayPal allowed the customer to "Pay in 4", it will display that possibility to him.

Please Log in or Create an account to join the conversation.

  • Posts: 39
  • Thank you received: 0
2 years 1 month ago #345163

Hi Nicolas,

Thanks, I managed to disable the old plugins created in Payment Methods list in Hikashop, and created new payment method using Paypal Checkout and enable it (refer to the screenshot attached)

Then in the checkout page, the message showing pay in 4 still not showing. but when I clicked "Finish" it goes to next screen/page which is "confirm" showing the 2 buttons (paypal and pay by debit card) - refer to screenshot attached. I believe this page is 3rd page in checkout flow "checkout/confirm in suffix url".

Any suggestions on how we can add Paypal in 4 messaging code in this 3rd page (confirmation page) view template in Hikashop display config?
Previously I added the messaging code in checkout ("Checkout > cart") page, but now I wanted to know if we can also put the pay in 4 message in the confirmation page (checkout->confirm)?

Thanks.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 1 month ago #345170

Hi,

Normally, it should display the "pay in 4" option automatically on that 3rd page.

In that case,
add the line:

'enable-funding' => 'paylater',
after the line:
'client-id' => $this->payment_params->client_id,
in the file plugins/hikashoppayment/paypalcheckout/paypalcheckout.php
It should force the pay in 4 choice to appear there, provided that both the merchant and the client are eligible.

The following user(s) said Thank You: Handychef

Please Log in or Create an account to join the conversation.

  • Posts: 39
  • Thank you received: 0
2 years 1 month ago #345192

This actually worked, so this means we don't need to use Paypal's Messaging code as the Paypal checkout plugin does the rest of job showing "Pay in 4" button (refer to the screenshot attached)



I wonder if there is additional settings that displays the cart total value and each instalment? Like the screenshot below:

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 1 month ago #345202

No, you can't add this in the same way. That needs to be displayed with the code you were trying to add before ( www.hikashop.com/forum/payment-methods/9...e-system.html#335801 ).
It would be possible, but it cause issues because HikaShop dinamically refreshes parts of the checkout and the JS of PayPal doesn't like this which resulted in the errors you had in ( www.hikashop.com/forum/checkout/905073-c...pty-page.html#345193 )

Please Log in or Create an account to join the conversation.

Time to create page: 0.095 seconds
Powered by Kunena Forum