Implement the Callback Page
Learn how to implement a callback page to process responses from Zuora’s Payment Pages 2.0, including handling success and error scenarios.
After the Payment Pages 2.0 form has been submitted, your user is redirected to the callback page. Zuora returns the following results to the callback page by appending them to the callback URL.
-
When a payment method is successfully created, the following are returned: Example callback URL: http://s1.hpm.com:8000/thanks?success=true&refId=2c92c0f84979bc700149830f938c7e66&phone=%2B1%28123%29456-7896&email=mickey%40zuora.com&creditCardCountry=NPL&token=L8Zh6xjRyVuXQzg0s29VPSLZHL3nQKkG&refId=2c92c0f84979bc700149830f938c7e66&field\_passthrough1=Residentia
-
success -
refId: Represents the newly created payment method ID in Zuora. -
Any pass-through parameters specified in the client
-
Any form field marked as Returned in Response in the Payment Page configuration. Only the Credit Card type Payment Pages can have fields returned in response.
-
For one-time payment flow, the following additional fields are returned:
paymentIdinvoiceId(if the invoice ID was passed in through the payment flow)
-
-
When a Payment Page submission fails, the following are returned: Example callback URL:
successerrorCodeerrorMessage
You need to code the callback page to process the response back from Zuora and any pass through parameters from Payment Pages 2.0.
See Configure Payment Pages 2.0 for setting the Callback Path for the Payment Pages.
Here is a sample code that implements a callback page. This page parses the response information from the callback and composes a message and display it. Then it calls javascript methods, submitSucceed and submitFail , defined in the parent window for further procedure. For example, if the Payment Page submission failed, it calls submitFail that re-renders the Payment Page, using Z.renderWithErrorHandler, and displays customized error message, using Z.runAfterRender . For more detailed information, see Advanced Integration of Payment Pages 2.0.
See Callback.jsp in the Payment Pages 2.0 sample code suite on Zuora GitHub site for a complete sample implementation designed for all three styles of Payment Pages 2.0, including overlay, inline with button inside, and inline with button outside.