Pay.gov Connection
In this section:
The site connects to Pay.gov through an interactive API that is limited to requests coming from Pay.gov.
Connection Steps
When a user initiates a transaction:
- They first provide some initial information (Name, Address, Amount to Contribute) on a form (example).
- Upon hitting
CONTINUE TO PAY.GOV, Django issues aPOSTrequest to pay.gov with the submitted data and receives a uniqueagency_tracking_idto identify the transaction. - Django then sends the user directly to pay.gov to finish the transaction. If the user has javascript enabled, this is invisible (they are redirected automatically after submitting the initial form). If the user does not have javascript enabled, they must click an additional button to be redirected.
- The user enters their payment information and confirms on pay.gov.
- pay.gov sends a
POSTrequest to Django with theagency_tracking_idand eitherSUCCESSorFAILURE. - pay.gov redirects the user back to Django, where Django displays either a SUCCESS or FAILURE message.
Referenced Code
On pay.gov servers, the environmental variable USE_PAYGOV=True enables pay.gov functionality in Django. This installes the paygov django app. In production settings:
if os.environ.get('USE_PAYGOV', ''):
INSTALLED_APPS += ('paygov',)
Code and tests around paygov intergration can be found on GitHub.
Debugging
Check debugging failures for resources on further debugging pay.gov failures.