Copied to clipboard

Flag this post as spam?

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


  • Warren Harding 132 posts 275 karma points
    Apr 19, 2022 @ 06:04
    Warren Harding
    0

    Custom API Payment Gateway

    Is it possible to create a custom payment gateway that handles transactions in the background without redirecting through a shared payment page?

    Ideally, we don't want to bounce the user off to the payment gateway.

    If so, are there any basic examples of this in Github?

    Thanks so much, Warren

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Apr 19, 2022 @ 07:49
    Matt Brailsford
    0

    Hey Warren,

    Do you mean displaying the payment capture fields on your site vs redirecting? or, just handling transactions in the background and skipping the payment detail collection process entirely?

    Matt

  • Warren Harding 132 posts 275 karma points
    Apr 19, 2022 @ 08:08
    Warren Harding
    0

    Yes, displaying the credit card input fields on the site as part of the checkout process. Cheers

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Apr 19, 2022 @ 08:50
    Matt Brailsford
    0

    Hey Warren,

    Sure it's possible. You can create a payment provider that rather than redirecting to a 3rd party instead redirects you to a page on your site and on that page run whatever code you need to in order to setup the payment. Then you can redirect to Vendr's continue URL to continue once payment is successful.

    Depending on how your payment gateway finalized orders (either at the point of detail capture / via webhook) you'll want to use the payment providers callback handler for this. If a webhook handler, it'll be like all other providers that use webhooks, but if it's instant, you'll either need to communicate back to it yourself (probably over a JS AJAX request) or enable FinalizeOnContinue and pass some kind of token through to the continue URL to handle this.

    See this post regarding FinalizeOnContinue https://our.umbraco.com/packages/website-utilities/vendr/vendr-support/108325-using-the-callback-url-and-other-urls-in-a-paymentprovider#comment-336471

    Hope this helps

    Matt

  • Warren Harding 132 posts 275 karma points
    Apr 20, 2022 @ 08:39
    Warren Harding
    0

    Thanks for that - on the page on our site, is it possible to fire off the callback url instead? As the ProcessCallback we previously wrote for the shared page is working well.

    Also, how can we lookup the callback variable from the payment gateway page we have created on the site? In the GenerateForm function call I can't seem to figure out how to either add this as a property to the order or just save it in a session variable.

    The callback url does seem to be formed using currentOrder.Id / currentOrder.OrderNumber / random number - is it possible to lookup this last random number?

    Thanks again.

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Apr 20, 2022 @ 10:19
    Matt Brailsford
    0

    Sure, Id' probably pass it down to the generated form as potentially a data attribute.

    I'm not quite sure what you mean in terms of "lookup the callback variable"?

  • Warren Harding 132 posts 275 karma points
    Apr 21, 2022 @ 06:16
    Warren Harding
    0

    Ignore that, as I think I was going mad last night - as for passing it down to the generated form, how can I do that?

    Thank you

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Apr 21, 2022 @ 08:19
    Matt Brailsford
    0

    Hey Warren,

    Use the WithAttribute of the form result to pass a data attribute to render on the form (See the stripe provider for an example where it sets an onsubmit attribute https://github.com/vendrhub/vendr-payment-provider-stripe/blob/v2/dev/src/Vendr.PaymentProviders.Stripe/StripeCheckoutPaymentProvider.cs#L315)

    Hope this helps

    Matt

Please Sign in or register to post replies

Write your reply to:

Draft