Inhalte aufrufen

Profilbild

How To Post Form Values To A Payment Gateway URL In SmartStore.NET

Payment Gateway Integration

9 Antworten zu diesem Thema

#1 nitware

nitware

    Member

  • Members
  • PunktPunkt
  • 11 Beiträge

Geschrieben: 29 September 2017 - 07:03

Hello team,

 

In SmartStore.NET 3.x, how do I post form values to a payment gateway URL. The sample form below illustrates how the field values are setup and posted to https://paymentgateway/pay (Payment Gateway Url) . Kindly explain the steps that needs to be taken, and pointing out classes, methods etc. that will be needed to achieve this.

 

<formname="form1"action="https://paymentgateway/pay"method="post">

<inputname="product_id"type="hidden"value="XX"/>
<inputname="pay_item_id"type="hidden"value="XX"/>
<inputname="amount"type="hidden"value="XXXXXXX"/>
<inputname="currency"type="hidden"value="566"/>
<inputname="site_redirect_url"type="hidden"value="http://abc.com /getresponse”/>
<inputname="txn_ref"type="hidden"value=" XXXAFTXXX”"/>
<inputname="hash"type="hidden"value="BB292DF9268F05CB9CBBC5E0C13CC1B13ACA34DC"/>
</form>

 

I also need to add more information (payment reference no, transaction reference no, etc.) to Complete.cshtml and Confirm.cshtml page before and after a transaction (for success or failed transaction) completion, without physically modifying the page, because of updates to SmartStore.NET in the future. Do I create my own Confirm.cshtml and Complete.cshtml in my custom plugin? how do I go about it. Thanks in advance for your assistance.

 

Thank you in advance for your assistance.



#2 nitware

nitware

    Member

  • Members
  • PunktPunkt
  • 11 Beiträge

Geschrieben: 29 September 2017 - 09:55

Hello team,

 

I also need to add more information (customer email, transaction reference no, etc.) to Complete.cshtml page after a transaction (for success or failed transaction) without physically modifying the page. Do I create my own Complete.cshtml in my custom plugin? how do I go about it. Thanks in advance for your assistance.



#3 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3018 Beiträge

Geschrieben: 29 September 2017 - 11:45

An example for a server-side payment form post is the AuthorizeNet plugin. See the ProcessPayment method there.
 
Use Widgets to add additional data to certain pages. For example the PayPal PLUS widget zone filter filters the Completed method an injects instructions (from PayPal to the buyer) through the CheckoutCompleted method of the PayPalPlusController.

Schöne Grüße aus Düsseldorf,
Marcus Gesing


#4 nitware

nitware

    Member

  • Members
  • PunktPunkt
  • 11 Beiträge

Geschrieben: 29 September 2017 - 15:02

Thank you very much for this assistance. I will get back to you, when the need arises.



#5 nitware

nitware

    Member

  • Members
  • PunktPunkt
  • 11 Beiträge

Geschrieben: 09 October 2017 - 18:13

Hallo Team,

 

Nochmals vielen Dank für Ihre Unterstützung. Das Payment Plugin wird gerade getestet. Aber ich habe einige graue Bereiche, die dringende Aufmerksamkeit benötigen:

  1. Die Bestellung hat vier Status (Ausstehend = 10, Verarbeitung = 20, Abgeschlossen = 30 und Storniert = 40). Was bedeuten diese Zustände? Und was sollte der Auftragsstatus sein, wenn die Zahlung über das Zahlungs-Gateway erfolgreich ist und wann es fehlschlägt. Standardmäßig setzt SmartStore den Status auf Ausstehend. Soll man es so lassen? Oder sollte es geändert werden? Sollte es geändert werden, worauf sollte es geändert werden? Bitte beraten.
  2. Wenn man die Auftragsabwicklung in einer Transaktion ablegen will, so werden alle Datenbankaktivitäten (Einfügen, Aktualisieren und Löschen) rückgängig gemacht, wenn die Zahlung über das Gateway fehlschlägt. Wie kann eine Transaktion in diesem Szenario (wo PaymentMethodType = PaymentMethodType.Redirection ) ohne Änderung von SmartStore eingeführt werden? Wenn es kann, wie? Bitte führen.
  3. In meinem Fall leite ich zu / Order / Details / id um, wenn die Zahlung erfolgreich ist und / Checkout / Completed, wenn es fehlschlägt. Ist das richtig? Wenn nein, was ist dann für beide Szenarien richtig?
  4. Ist es möglich, den Wert von @T ("Checkout.ThankYou")  in der  Ansicht / Checkout / Abgeschlossen vom Plugin zu ersetzen ? Wenn ja, wie?
  5. Ist es möglich, die Schaltfläche "Bestelldetails" auf / Checkout / Abgeschlossene  Ansicht aus dem Plugin zu deaktivieren oder auszublenden  ? Wenn ja, wie?

Vielen Dank im voraus für Ihre Hilfe



#6 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3018 Beiträge

Geschrieben: 09 October 2017 - 20:31

1. Typically a payment plugin updates the payment status and the .NET core then updates the order status (see OrderProcessingService). Example: PayPal IPN-Handler. It maps the PayPal payment status to a proper .NET payment status and uses OrderProcessingService to update the order. This "if CanMarkOrderAs... then MarkAs..." logic is used in every payment plugin.
 
2. That's not possible. A redirection initiated by PaymentMethodType.Redirection always takes place after the order has been accepted and created. If you can't live with that, you have to choose another PaymentMethodType and prevent the order from being accepted. This is done by adding an error to ProcessPaymentRequest in the ProcessPayment method.
 
3. Always /Checkout/Completed with injected notes/instructions as mentioned above. Note, the order is always created.
 
4. That would change it for all orders and all payment methods. It's better to inject notes/instructions as mentioned in my first post.
 
5. By using a widget and jQuery but that's not recommended because the order has been placed.

Schöne Grüße aus Düsseldorf,
Marcus Gesing


#7 nitware

nitware

    Member

  • Members
  • PunktPunkt
  • 11 Beiträge

Geschrieben: 10 October 2017 - 08:07

Thank you for your response.



#8 nitware

nitware

    Member

  • Members
  • PunktPunkt
  • 11 Beiträge

Geschrieben: 12 October 2017 - 08:37

Hello team,

 

In a scenario where an order is placed by a customer, following the legs below:

  1. Order is inserted into the database
  2. Payment is made via the payment gateway
  3. On successful payment, order and payment status are updated accordingly in the database by the use of "if CanMarkOrderAs... then MarkAs..." logic.

If step 1 & 2 is successful and error occurs in step 3, note that at this point, the customer has successfully paid via the payment gateway, but the order and payment status was not successfully updated to mark a completed transaction due to error in step 3. How does SmartStore handled this situation? Or how do one handle this in SmartStore?

 

Thanks in advance for your assistance



#9 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3018 Beiträge

Geschrieben: 12 October 2017 - 11:00

I've made hundreds of payments against different payment gateways, but I've never watched this case. However, the merchant is able to set payment and order status manually. On the order detail page in backend you can see payment buttons in the row "Payment status". The highlighted (orange) buttons are used for payment operations including calling the payment provider, like capturing the payment amount. Non highlighted (white) buttons are used for offline operations without contacting the payment provider. For example in your case the merchant can use "Mark as paid" to manually set the payment status to paid (without contacting the payment provider).
 
PS: It's a good idea to give the merchant a history of the payment operations and callbacks from the payment provider (like IPNs). It is then easier to understand what happened in the background, especially if problems occur and he wants to contact the payment provider.
You can use order notes to log infos about payment operations. See the attached screenshots.
 
Amazon Payment:
AmazonPayNote.png
 
PayPal:
PayPalNote.png
 
paydirekt:
PaydirectNote.png

Schöne Grüße aus Düsseldorf,
Marcus Gesing


#10 nitware

nitware

    Member

  • Members
  • PunktPunkt
  • 11 Beiträge

Geschrieben: 12 October 2017 - 13:59

Thank you for your assistance.





Auf dieses Thema antworten