Help creating a BBIS ADF *NOT* on a BBIS Page
I've been working on trying to create a gift form that doesn't live on a BBIS page. For now, I'm testing this on my BBIS Server but in a normal HTML file and I have it mostly working.
The example on the BB web site is pretty awful, and uses AngularJS which is a pretty worthless example at this point. It also isn't even remotely "complete" as there's no code in the example for actually submitting and completing a donation.
I feel like I'm pretty close to making this work I think.
This form is in test mode so you can go all the way through it.
Basically, it successfully validates the donation, but then fails to call /WebApi/Payment/Create with a 401 error "Unauthorized"
Now when I use my regular donation form the URL for that c all is exactly the same, and basically the payload is the same as well.
The ADF API Technical Reference doesn't mention the Payment/Create end point (or any Payment/* endpoint, really), so I don't know what the 401 error means.
Just not sure what I'm missing here.
Answers
-
It looks like the issue is the x-token header on the call. On the failing Create request it's the same value as the tokenId in the donate.html page's script with checkoutData. Loading the page in a few fresh incognito sessions returns that same token every time. These tokens are normally generated fresh per session/page load, so a static one won't line up with the current session and the request gets rejected at auth (which is why you see the 401 with an empty body). You'll have to get a working session ID for it to go through.
1 -
Thanks! That led me down the right path. I had copied the "var checkout" line that the ADF creates when the part is embedded on a BBIS page, and that included the token. I also tried randomly generating a token but that didn't work either. It seems that the ADF creates the token and puts it in the BBWEBAUTHENTICATIONTOKEN table, and the /WebAPI/Payment/Create expects the X-Token header to match that.
I can't find any legit way to generate the token though.
I thought maybe the /DonationEditor/{partId} would do the trick because it returns much of the same data, but it returns the data with different field names than defined in the CheckoutModel, and doesn't include the APIControllerName (which I know to be "Payment"), and doesn't include, most importantly, the TokenId.
So, to get it working, here's what I did:
Before loading my regular custom online giving javascript, I'm using a syncrhonous ajax call to retrieve the content of the actual BBIS Donation Form, which causes it to generate the token, and then I strip out the value it sets for checkoutdata using a regular expression and then put that into the checkoutdata variable.
This seems to work reasonably well and the synchronous call is pretty fast, but it's a hack.
The example documentation provides no information on how to do this, even though the example is intended to work on non-BBIS pages.
0 -
Hi @Rick Root
I took a look at what you’re trying to do with running an Advanced Donation Form outside of a BBIS page, and the behavior you’re seeing is expected. The 401 error on /WebApi/Payment/Create is occurring because that endpoint requires a valid authenticated BBIS session and server-side security context (cookies, request validation tokens, etc.). When the form is hosted outside of BBIS, that context isn’t present, so the request is rejected, even if the payload itself looks correct.From a security standpoint, attempting to call internal BBIS endpoints outside of their intended context can also raise concerns. Blackbaud policy requires access to systems only within their intended and authorized use, and specifically prohibits attempts to bypass or circumvent authentication and security controls. Because this approach tries to operate outside the normal BBIS execution model, it could be considered a potential violation of the Acceptable Use Policy.
If the goal is to build a standalone donation form, the supported path is to:
- Use the Blackbaud Payments API for payment processing
- Use the Blackbaud CRM APIs to create and manage the gift
This approach is designed for external form experiences and avoids the dependency on BBIS page/session context.
0 -
@David Seager …. thank you. I'm a bit confused by the wording for the example on the blackbaud web site, I guess.
This last example is meant to show a more realistic real-world example of the Advanced Donation Form API, including all the necessary error handling and styling. This example also incorporates the use of the CountryService, which is the javascript wrapper for the Country REST API endpoint.
Whereas all the other examples are designed to be inserted into an Advanced Donation Form Part, the complete example is designed to be completely standalone - even on a different server than the one serving your BBIS website.
Please note you'll need to update the references in the example below to your BBIS installation.
Your suggested options would basically have nothing to do with the Advanced Donation Form API.
Furthermore, the DonationService has an option to pass in { crossdomain: true } when instantiating the service which would seem to imply that it was intended to work the way I'm expecting.
If there is no ADF functionality that can be embedded on an external web site that interacts with the ADF API, then that example should be removed.
0
Categories
- All Categories
- 7 Blackbaud Agents for Good™
- New Raiser's Edge NXT Community
- 6 Blackbaud Community Help
- 214 bbcon®
- 1.4K Blackbaud Altru®
- 407 Blackbaud Award Management™ and Blackbaud Stewardship Management™
- 1.2K Blackbaud CRM™ and Blackbaud Internet Solutions™
- 16 donorCentrics®
- 361 Blackbaud eTapestry®
- 2.6K Blackbaud Financial Edge NXT®
- 669 Blackbaud Grantmaking™
- 590 Blackbaud Education Management Solutions for Higher Education
- 3.3K Blackbaud Education Management Solutions for K-12 Schools
- 950 Blackbaud Luminate Online® and Blackbaud TeamRaiser®
- 85 JustGiving® from Blackbaud®
- 6.9K Blackbaud Raiser's Edge NXT®
- 3.9K SKY Developer
- 252 ResearchPoint™
- 121 Blackbaud Tuition Management™
- 165 Organizational Best Practices
- 245 Member Lounge (Just for Fun)
- 38 Blackbaud Community Challenges
- 37 PowerUp Challenges
- 3 (Closed) PowerUp Challenge: Grid View Batch
- 3 (Closed) PowerUp Challenge: Chat for Blackbaud AI
- 3 (Closed) PowerUp Challenge: Data Health
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Product Update Briefing
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Standard Reports+
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Email Marketing
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Gift Management
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Event Management
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Home Page
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Standard Reports
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Query
- 811 Community News
- 3K Jobs Board
- 57 Blackbaud SKY® Reporting Announcements
- 47 Blackbaud CRM Higher Ed Product Advisory Group (HE PAG)
- 19 Blackbaud CRM Product Advisory Group (BBCRM PAG)
