In the first part of this article, we talked about how to start using the WePay Payment Gateway by integrating the authentication process. In this article, will cover how to process payments.
Let’s code
To process a payment you need to follow these steps:
- Create the credit card using the /credit_card/create endpoint
- Process the payment using the /checkout/create endpoint
We add these endpoints to the Refit interface:
In our ViewModel we will do the requests, by calling the create credit card endpoint first and then with the credit card id returned we call the checkout endpoint.
Note: Before doing this you need to do the authentication process, since the WePay Access Token and Account Id are required here.
In our view we will have a simple UI for requesting the Card name, Card number, Zip code, CVV and email.
You can test using one of these credit cards.
The result:
Check the full source code here.
Happy WePay integration!