I am building a web site where customers can subscribe to products every 3 or 6 months.
This is what we currently have: during the checkout process, we take payment from the customer using their card (including the verifyBuyer function). We then perform the following steps (all through API calls):-
- Create a customer record.
- Create a payment request, including the verification token from verifyBuyer.
- Save the customers card on file.
- Create a subscription plan for each product the customer subscribed to.
- Create a subscription to each plan, for each product the customer subsctribed to. Each subscription is linked to the card saved earlier.
My query relates to how Square deals with taking payment for each of the subscriptions with regard to invoices and webhooks. The reason is that we would like to be notified when a subscription payment is taken so that we can update our records for the customer and stock.
If I understand the documentation, when a subscription payment is due, Square will generate an invoice for the subscription, and attempt to charge the cost to the linked card on file. If the payment succeeds, then it will issue the invoice.payment_made webhook. If the payment fails, for whatever reason, it will issue the invoice.scheduled_charge_failed web hook.
Can anyone confirm if my understanding is correct?