Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jo Shum 4 posts 94 karma points
    Apr 16, 2019 @ 04:15
    Jo Shum
    0

    Payment Provider (Stripe - Inline) - Generate payment form error

    Hi there,

    At the moment, I am using TeaCommerce v3.3.0 (I believe this is the latest version?) and I am trying to build a Stripe (inline) payment form. However I get an internal server error when calling TC.generatePaymentForm in javascript:-

    System.InvalidOperationException: Sequence contains no matching element
       at System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate)
       at TeaCommerce.PaymentProviders.Inline.BaseStripeProvider.GenerateHtmlForm(Order order, String teaCommerceContinueUrl, String teaCommerceCancelUrl, String teaCommerceCallBackUrl, String teaCommerceCommunicationUrl, IDictionary`2 settings)
       at TeaCommerce.Api.Web.PaymentProviders.PaymentMethodExtensions.GeneratePaymentForm(PaymentMethod paymentMethod, Order order, String submitInput)
       at TeaCommerce.Api.Web.TeaCommerceHelper.GeneratePaymentForm(Int64 storeId, String submitInput)
       at TeaCommerce.Api.Web.FormPostHandler.GeneratePaymentForm(Int64 storeId)
       at TeaCommerce.Api.Web.FormPostHandler.FormPost()]]
    

    My scenario at the moment (assuming that user has already placed an order and is ready to checkout. There are multiple payment options apart from 'Stripe'):

    1. user ticks "Stripe" payment option and fills in his billing and shipping information (including his contact details)
    2. then user clicks on "Checkout" button which calls TC.generatePaymentForm (which should goes onto the next page that has stripe payment form, am i right for this case?)

    What I've done so far is:

    I'm currently using the example payment form that you've provided - https://github.com/TeaCommerce/Payment-Providers/blob/c859bcfe9830ada3dc52e3f9d4cec0632fd058c8/Source/TeaCommerce.PaymentProviders.UI/Views/StripePaymentForm.cshtml

    And I've modified some of the code in that example form to be hardcoded for testing purpose e.g: Request.Form["billingaddressline1"], and the other Request.Form[] and I've already set up the following settings for Stripe payment provider:

    • form_url,
    • continue_url,
    • cancel_url,
    • billingaddressline1propertyalias,
    • billingcityproperty_alias,
    • billingzipcodepropertyalias,
    • testsecretkey,
    • testpublickey,
    • mode (at the moment the value is set to test for this key),
    • capture,
    • sendstripereceipt

    I may be on the wrong track here but when I went onto the "form_url" page directly without clicking on "Checkout" button as mentioned in my scenario above, I was able to fill in the card details - Name, card number, expiry date and cvc. And when i clicked "Submit Payment" button - it only returns the token but does not call ProcessCallback method or finalized the order. Am i missing out something at this point here? Could you please shed some light on this?

    Many thanks!

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Apr 16, 2019 @ 07:04
    Matt Brailsford
    0

    Hi Jo,

    Looking at the code for the Stripe payment providers GenerateForm method the only places where the First method is called is when populating the billing fields via the property aliases. https://github.com/TeaCommerce/Payment-Providers/blob/master/Source/TeaCommerce.PaymentProviders/Inline/BaseStripeProvider.cs#L65

    My guess then would be that you have a configuration for one of the billing property aliases (which you show above address line 1, city and zip code) but one of those is not actually populated on the order so when the Stripe provider tries to access them, it fails because it doesn't exist.

    I'd double check your aliases in the provider settings and make sure these match exactly with the property aliases you are setting on the order when collecting the users billing information and also make sure that for all aliases defined, there must be a property value on the order.

    Matt

  • Jo Shum 4 posts 94 karma points
    Apr 16, 2019 @ 21:43
    Jo Shum
    0

    Hi Matt

    You're right, it is the aliases in the provider settings that caused the issue. I've changed the aliases and it is now working as it link to the Stripe payment form. However after filling up the card detail and submitting the payment, it does not finalized the order or charge the card. Do I need to call a method or something here?

    Thanks!

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Apr 17, 2019 @ 08:11
    Matt Brailsford
    0

    Hi Jo,

    Hmm, as long as it's set to capture in the settings it should work. Have you looked in the log file for any errors?

  • Jo Shum 4 posts 94 karma points
    Apr 17, 2019 @ 21:32
    Jo Shum
    0

    Yes, the capture is already set to true in the settings and I've looked into the log file but there wasn't any errors at all. On the Stripe's log (in the stripe website), I could see that the status is 200 and the description says "POST /v1/tokens" and that is only returning the token.

  • Jo Shum 4 posts 94 karma points
    Apr 25, 2019 @ 22:20
    Jo Shum
    100

    My colleague had found the solution to this. It's the "magic" url coming from RequestForm["continueurl"] and this will call the TC event which calls the payment process method

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Apr 26, 2019 @ 08:01
    Matt Brailsford
    0

    Ahh, glad you were able to find the solution 👍

Please Sign in or register to post replies

Write your reply to:

Draft