What happens when a subscription payment fails at later date

Hi, I am building and application that uses the subscription API to create subscriptions for users with pre attached cards. Im struggling to find in the documentation what happens if at some later date the payment fails. This could happen because the user cancels the card, or the card reaches its expiration date, or any other host of reasons. If this happens what is the best way to find out, and what is the workflow on squares side, will you start sending them invoices, or send them an email prompting them for a new card?

Hi, yes if a subscription that has a card on file fails we will send an invoice so the customer can pay the invoice. If you are also subscribed to Invoices webhooks you will be notified of the failed card on file payment and can work with your customer to update the information. :slightly_smiling_face:

What would be the webhook event and what would be the sample payload in case of subscription get failed aby any card issue.

If a subscription fails to be paid it will trigger invoice webhook events. It will also trigger payment webhook events. :slightly_smiling_face:

Is there any way to turn off the email invoice to the customer when subscription
fails?

No, there isn’t currently a way to stop the emails that get sent to a customer when an invoice payment fails. :slightly_smiling_face:

@Bryan-Square
What would be the event name from which(reaponse payload) I can get the subscription Id in case of subscription get failed by any card issue?
please give me the exact event name with sample payload
I checked both you said above but not able to find subscriptionId in them and I want the exact reason for that subscription got failed.

Here is an example invoice.updated webhook that has the subscription_id of the scheduled payment that failed.

{
  "merchant_id": "ML2441RQ9YTF2",
  "location_id": "LQ3DWCDPFT0DT",
  "type": "invoice.updated",
  "event_id": "e91d45ca-b0f0-53af-8af5-94a3581b04b9",
  "created_at": "2024-06-11T23:37:57Z",
  "data": {
    "type": "invoice",
    "id": "inv:0-ChCLE77GjVB3FSRq1F0ppZI5EOAO",
    "object": {
      "invoice": {
        "accepted_payment_methods": {
          "bank_account": false,
          "buy_now_pay_later": false,
          "card": true,
          "cash_app_pay": false,
          "square_gift_card": false
        },
        "created_at": "2024-06-11T23:37:55Z",
        "delivery_method": "EMAIL",
        "description": "We were unable to charge your card on file (MASTERCARD 0005) for this subscription.",
        "id": "inv:0-ChCLE77GjVB3FSRq1F0ppZI5EOAO",
        "invoice_number": "000514",
        "location_id": "LQ3DWCDPFT0DT",
        "order_id": "TrNR60dRDAtsuKfqOCZ9sxJdYU7YY",
        "payment_requests": [
          {
            "automatic_payment_source": "NONE",
            "computed_amount_money": {
              "amount": 6000,
              "currency": "GBP"
            },
            "due_date": "2024-06-12",
            "request_type": "BALANCE",
            "tipping_enabled": false,
            "total_completed_amount_money": {
              "amount": 0,
              "currency": "GDP"
            },
            "uid": "db43101f-9cb2-4b06-8bee-561150cb68f2"
          }
        ],
        "primary_recipient": {
          "company_name": "Square",
          "customer_id": "88D2Z96G24YNB1AD0S8MJCMRY8",
          "email_address": "[email protected]",
          "family_name": "Name",
          "given_name": "Customer"
        },
        "status": "DRAFT",
        "store_payment_method_enabled": true,
        "subscription_id": "51f8a469-d0fe-40f0-a43a-a0d15ef4a84f",
        "timezone": "Europe/London",
        "title": "Multiphase Gym Membership Subscription",
        "updated_at": "2024-06-11T23:37:57Z",
        "version": 2
      }
    }
  }
}

:slightly_smiling_face:

Hi,
I think you should try If a payment for a subscription fails in Square due to issues like card cancellation or expiration, Square handles this by automatically retrying the payment a few times over several days. If the payment still fails, Square will send an email to the user prompting them to update their payment information. To monitor these events, you can use Square’s Webhooks to receive real-time notifications about subscription payment failures. Additionally, you can regularly check the subscription status via the Subscriptions API to stay informed about any issues.

Thanks

Depending on a customers situation and the card they use on file, attempting the payment several times before sending an invoice could have a negative impact on there bank account. We want the customer to be aware of any failed payment so they can manage there situation appropriately. :slightly_smiling_face: