Integrating Wingback into your Signup Flow
Wingback makes it easy to collect payment and address data from your customers during the signup process and signing them up to a plan in a simple and secure manner.
- Easier and faster to integrate: Wingback and Wingback.js provide a simple and easy-to-use API that abstracts away the complexity of integrating with Stripe and building your own plan management system. This means that you can get up and running much faster than if you were to build your own solution on top of Stripe.
- Handling payment and plan management: With Wingback and Wingback.js, you don’t have to worry about the low-level details of interacting with Stripe’s API and keeping track of all your plans. We take care of all the complex logic for handling payments and managing plans for you, so you don’t have to spend time building and maintaining your own solution.
- Take care of Billing: Wingback handles all billing processes for you, which means you don’t have to worry about implementing and maintaining your own billing system.
Integrating Wingback into Your Signup Flow
In order to integrate Wingback into your signup flow, you’ll need to follow these steps:
1. Create a new Customer in Wingback (Backend)
Before collecting payment and address data from your customer, you’ll need to first create a customer in Wingback. You can do this using the Create Customer endpoint. We recommend you to do this in your signup flow as soon as a customer creates a new account and as early as possible in the account creation process. You will need to store the wingback identifier in your database along your customers account data. Once the customer has validated their account (for example, by confirming their email address), mark them as active
using the Activate endpoint to enable charges on this account.
2. Collect Payment Information
Create a payment method session in Wingback (Backend)
Once you want to sign up a customer to plan, you’ll usually have to collect their payment information first. This is done by creating a payment method session for that customer on your backend and passing it on to your frontend, where it will be used to securely render a form and collect their payment data. You can also use Wingback to collect your customers billing address during this step. The Payment Session endpoint will return a token that you need to pass on to your Frontend.
Add the Wingback.js script (Frontend)
Add the Wingback.js script to your page.
Create a container for the Payment Element (Frontend)
Next, you’ll need to create an HTML element on your website where the Payment Element will be rendered. This should be part of your signup form.
Initialize Payment Session & render Payment Element (Frontend)
In your client side code, initialize the Payment Session and ask Wingback to render the Payment ELement.
This will inject a secure payment form into your signup page where your customer will enter their payment (and address) data.
Validate your Signup Form
To validate the form elements inside the Payment Element, call paymentElement.validate()
inside your form validation function.
Submit the Payment Data
Once you have validated the form data, submit the payment (and address) data using paymentElement.confirm()
. This will add the payment method to your payment processor and, in case of credit cards, perform a credit card authorization on your customers credit card. Once the payment method was successfully validated, it will automatically be stored with your payment processor and added to the linked Wingback Customer Profile.
3. Subscribe the Customer to a Plan (Backend)
Once the User has successfully signed up and added their payment data, you have to assign them to a plan in order to start charging them and granting them access to your product features. This is done through the Contract endpoint. Once you have created a subscription for a customer, you will then be able to retrieve their entitlements through the Entitlement API. That’s it!