I am working on integrating the Accept.js hosted payment form with my existing application. It is written in C# using webforms. The button brings up the lightbox and I get a token back on submit. My problem is it's not triggering the onClick event to send everything to the aspx.cs file. Their instructions say you can add your onclick event to the button so it will do both. I am collecting some other basic info on my form and want to write that data to my database and use my existing API calls to send the payment request with the nonce. I suspect the issue is with the action atribute in the form tag (action="https://YourServer/PathToExistingPaymentProcessingScript">). I currently have it set to http://localhost:11111/Payment.aspx which is the page with the button for the lightbox and I'm testing on my local machine. I would like it to process like a regular webforms page does by sending the form data (and opaquedata) to the payment.aspx.cs page. I'm not getting any error, it just drops my back on my payment.aspx page instead of triggering the actions in the onClick event.
The code for the button is below...
<asp:Button ID="btnPayCC" OnClick="btnPayCC_Click" runat="server" Text="Pay Now" class="AcceptUI"
data-billingAddressOptions='{"show":true, "required":false}'
data-apiLoginID="xxxx"
data-clientKey="xxxx"
data-acceptUIFormBtnTxt="Submit"
data-acceptUIFormHeaderTxt="Card Information"
data-paymentOptions='{"showCreditCard": true, "showBankAccount": true}'
data-responseHandler="responseHandler" />
I have had a lot of trouble finding a c# webforms example for using accept.js so any help would be greatly appreciated.
โ11-01-2024 12:44 PM
Hello vgtucker,
I see you have onClick event on your button , are you submitting the form or you have the code behind event for btnPayCC_Click ? Could you please add debug point or logging on your code behind and see whether your call go through code behind ?
โ11-21-2024 05:59 PM