How send api data and return user back to the form for submission

By: Michael Boadi Nkansah | Asked: 04/29/2023
ForumsCategory: General questionsHow send api data and return user back to the form for submission
Michael Boadi Nkansah asked 12 months ago
How send api data and return user back to the form for submission
2 Answers
Victor Font answered 12 months ago
If you trigger an API call with AJAX, the user will never leave the form.
Michael Boadi Nkansah replied 12 months ago

thank you, what i want to accomplish is for the user to go make payment to another website through an APIand then afterwards redirect the user back to form to submit it

Michael Boadi Nkansah answered 12 months ago
thank you Victor. how do i do that. below is the API (json) that i need to process before the user can submit the form   {   "request": "create",   "api_key": "key",   "mda_branch_code": "PHAR001",   "firstname": "Jane",   "lastname": "",   "phonenumber": "2233668589",   "email": "email",   "application_id": "5452",   "invoice_items": [     {       "service_code": "PC0001",       "amount": "300",       "currency": "$",       "memo": "Final Permit",       "account_number": "009202022"     },     {       "service_code": "PC0001",       "amount": "4.00",       "currency": "$",       "memo": "Provisional Permit",       "account_number": "00191011"     }   ],   "redirect_url": "url here",   "post_url": "url here" }
Victor Font replied 12 months ago

You need to follow the directions supplied by your API documentation. API's require an endpoint. The AJAX you build requires jQuery to monitor your form fields and trigger the call to the API server. The API server is connected through a custom PHP function you need to build. To make the actual callback, you use the WordPres HTTP Curl class. https://developer.wordpress.org/reference/classes/wp_http_curl/. If you need to consult a developer, please see https://formidable-masterminds.com/developers-directory/

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right