Best way to have auto-renewal recurring payments

Based on your requirements, using the Subscriptions API seems to be the most suitable approach. Here’s how you can handle the different scenarios:

  1. If the user checks the auto-renewal and saves, you can create a subscription using the CreatePaymentLink endpoint with the subscription_plan_id and price_money parameters. The price_money should match the current monthly rate.

  2. If the user unchecks the auto-renewal and saves, you can cancel the current subscription using the CancelSubscription endpoint.

  3. If the user adds another email referral, you can update the subscription amount by first cancelling the current subscription and then creating a new one with the updated price.

  4. If the user changes the payment type and saves, you can follow a similar approach as in point 3: cancel the current subscription and create a new one with the new payment type.

Remember, when a subscription plan is updated or cancelled, the changes are effective immediately on any existing subscriptions for the plan. Also, note that the Subscriptions API requires customers to have a profile in the seller’s Customer Directory to enroll them in a plan. The customer profiles must also include a valid email address because Square sends the subscription invoices and receipts to this email address.

This answer was reviewed by @Bryan-Square.