Redirect
Another way to make card charges without the need to implement a payment form is through the use of the virtual terminal that Openpay provides.
Steps:
- Create a charge that contains the attribute confirm in false and a url to which to address once the payment is completed.
- Based on the response of the created charge, redirect the user to the url contained in the object payment_method returned.
- That the client fill in the requested information and make the payment in the form.
- If the payment was successful click on the continue button.
- Payment is made.
Creation of the charge
Example of creating a charge using the Openpay payment form.
Redirect to the Openpay form
If the call is correct then a response will be returned with a transaction object. in the pending state represented in the language used.
Response:
Redirect the user to the url contained in the url attribute that is inside the payment_method object.
Fill payment data
That the user fill in the requested information and click on Make payment
Click on Continue
If the payment was successful the user clicked on Continue
This redirects to the url that was provided when creating the charge (in the case of the Openpay page example), terminating the payment flow.
Notes:
- You can simulate different results using the test cards
- Implement Notifications to know the status of payments in real time