Get cart total price on payment gateway and after payment continue to last step

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
3 года назад
Hello,
I am trying to implement a payment plugin and I am facing two issues.
I have managed to add a button on payment info section, and redirect to my bank gateway, but I don't know how to get the cart total price from paymentinfo in order to pass it on the gateway. Is there a method I could call?
Also, after I complete the payment, I get redirected on the checkout page, but I am asked to do all the checkout steps all over. I get the response parameter (https://www.example.com/checkout.html?amount=5000&paymentId=ddg4M6bG&paymentDate=1420552883439&paymentStatus=APPROVED&authCode=5e6LRN&currency=USD&signature=CE7851CA4C6F4FB23F07F4A155324229&reference=REF123), but I don't know how to handle it from paymentinfo.
Can you please help me?
Thank you.
3 года назад
I managed to get redirection working, it seems that i had to set After checkout mark payment as Authorize and Capture.
But i still cannot pass the price to the payment info script.
The script is:
<button data-sc-key="sbpb_ZTU3YWIyMjQtZjEyZS00NWU3LTllZGItM2U1ODA2YTJkY2Ix"
        data-name="Love your home"
        data-description="Loveyourhome.gr"
        data-reference="99999"
        data-amount= "3000"
        data-color="#12B830"
        data-redirect-url="http://example.com/checkout/confirm">
    Pay now
</button>
I have to set data-amount to get the total cart price.
Thank you
3 года назад
I'm not sure exactly what you mean, but maybe you can do similar to what PayPal standard plugin  does if you need to save the total to be accessed later:

            //save order total that actually sent to PayPal (used for PDT order total validation)
            _genericAttributeService.SaveAttribute(postProcessPaymentRequest.Order, PayPalHelper.OrderTotalSentToPayPal, roundedCartTotal);
3 года назад
Thank you for your response. what i need to do, is to take the cart total amount in euros and put it in data-amount. Could you tell me where do i have to put the code you posted?
Thank you.
3 года назад
You can perform an ajax call to get the car total amount and using jQuery you can set data-amount attribute
3 года назад
Thank you for your response. The thing is, I don't have experience so I do not know how to do this.
3 года назад
Hi,

In order total component you can store the order total in local storage using JavaScript and the use it in your page to set data-amount attribute of you button.

OrderTotal component can be found here "Presentation\Nop.Web\Views\Shared\Components\OrderTotals\Default.cshtml".

just write a script to store @Model.OrderTotal in local storage in use it later in your page/view
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.