How to test subscription recurring charge

Hi,

My question is about testing already created subscription to see what information would be coming down webhook.
How do I renew a subscription created via API(if that matters), I could not find any actions in the UI to renew subscription so I can see information in webhook. Are they in test mode as I am working in production mode (test gives me issues with locationId, applicationID and such but it is a different conversation)
any idea how to do that. I am working in production mode.
Thank you
Denys

:wave: Does your subscription have a cancelation date? If they don’t then the subscription will continue till you update it to cancel. If it does have a cancelation date and the customer wants to continue or renew the subscription you can UpdateSubscription canceled_date to the new cancellation date. :slightly_smiling_face:

Just to clarify my question. It is a monthly subscription and I am looking for a way to trigger that monthly event when the charge happens. I would like to trigger the payment.

thanks.

How does your customer resubscribe today? Do they have to do it monthly or is it an indefinite subscription till they cancel? If it’s an indefinite subscription you can listen for invoice.payment_made webhook events. :slightly_smiling_face:

Thank you for responding.
Yes, they subscribe and it is supposed to charge them monthly for a year.
Is there any way to trigger that manually so I can test it? Or is it the same as when a subscription is created and paid for the first time?
thanks.

Currently there isn’t a way to trigger it manually. It would be bill on the cadence it’s set for. :slightly_smiling_face:

Thank you.
Last question since I can’t find any relevant information in the webhook docs. I am understanding that API is only creating subscription, which triggers invoice and payment already in Square realm, which in turn sends the payment or failed info down the webhook. How can I trigger an automatic receipt to a customer via API or otherwise. I am find if it is done by Square (will be easier). When I created a test subscription yesterday I did not get a receipt. I could not find any relevant fields in the webhook response.
thank you very much

If you’re creating a subscription that’s charging a saved card on file it will send the customer paid invoice receipt. If the customer is entering their card information in the invoice payment page they will be given a confirmation.

Additionally if you’d like to send a receipt to the customer the receipt_url is in the payment response. You can GetPayment with the payment_id and send the receipt_url to the customer. :slightly_smiling_face:

Thanks, I got everything working. Last question. When invoice payment on recurring subscription fails, does Square sends an email to the customer with the invoice to pay?
thanks.

Yes, Square will send an invoice to the customer to be paid. :slightly_smiling_face:

Thank you appreciate all your help!

Hi @Bryan-Square,

I’m confusing on recurring payment, I’m not able to find relevant docs on recurring. I’ve already made customer subscription (currently on sandbox) but it is not provide me next due date and how can I update subscription expire date when recurring payment will charge. invoice.payment_made webhook event not providing any customer, subscription or plan id. Is there any way so I can track user subscription and recurring payment on my server.

Thanks

Are you trying to update the subscription in the Dashboard or with the API? If the subscription has been created the information should be available in the Dashboard. What’s your application ID and the subscription_id of the subscription you’re not seeing the info for? :slightly_smiling_face:

Hi @Bryan-Square,

Thankyou for response, I’m using PHP sdk and creating customer and their card even already created some plans, I’ve created subscription by the APIs for each user when they make payment. Now I want recurring payment based upon plan duration for example: MONTHLY, QUARDLY. But I’m not seeing any whebhook if the payment generates automatically by the Square. If do so how can I update expiry date in my server.

App ID: sandbox-sq0idb-CZeLSQLmkoNDG0kKbvDwPQ
Some subscription information:

"id": "66eb072e-7310-4ef8-863d-d2532535a2ec",
    "location_id": "LZPKJBD66CHEA",
    "plan_id": "X7IODXMZBLD334LJBUMIW44Y",
    "customer_id": "KDW7VEATDB8EMS321VJHFZQ35M",

Thanks

That subscription was created yesterday and is on a quarterly cadence. The next time an invoice/payment webhook event will be generated will be the next billing date. The events you’ll want to listen to are the invoices and or payments webhooks. :slightly_smiling_face:

So how can I update my customer data when there a payment will be charge on cadence.
I’m storing customer_id, card_id, subscription_id and event_id.

I can not see any subscription ID in the response, and I’m not sure event id will changed on every webhook. Please suggest me appropriate solution so I can update customer subscription date on automatic charge.
invoice.payment_made

{
  "merchant_id": "031FEV2Q6VMPK",
  "location_id": "ES0RJRZYEC39A",
  "type": "invoice.payment_made",
  "event_id": "891e3589-462f-4215-9b61-f6df2d4432b7",
  "created_at": "2020-06-18T18:23:11Z",
  "data": {
    "type": "invoice",
    "id": "inv:0-ChCHu2mZEabLeeHahQnXDjZQECY",
    "object": {
      "invoice": {
        "id": "inv:0-ChCHu2mZEabLeeHahQnXDjZQECY",
        "version": 3,
        "location_id": "ES0RJRZYEC39A",
        "order_id": "CAISENgvlJ6jLWAzERDzjyHVybY",
        "payment_requests": [
          {
            "uid": "2da7964f-f3d2-4f43-81e8-5aa220bf3355",
            "request_type": "BALANCE",
            "due_date": "2030-01-24",
            "tipping_enabled": false,
            "automatic_payment_source": "NONE",
            "computed_amount_money": {
              "amount": 10000,
              "currency": "USD"
            },
            "total_completed_amount_money": {
              "amount": 10000,
              "currency": "USD"
            }
          }
        ],
        "invoice_number": "inv-100",
        "title": "Event Planning Services",
        "description": "We appreciate your business!",
        "delivery_method": "EMAIL",
        "status": "PAID",
        "timezone": "America/Los_Angeles",
        "created_at": "2020-06-18T17:45:13Z",
        "updated_at": "2020-06-18T18:23:11Z",
        "primary_recipient": {
          "customer_id": "JDKYHBWT1D4F8MFH63DBMEN8Y4",
          "given_name": "Amelia",
          "family_name": "Earhart",
          "email_address": "[email protected]",
          "phone_number": "1-212-555-4240"
        },
        "accepted_payment_methods": {
          "card": true,
          "square_gift_card": false,
          "bank_account": false,
          "buy_now_pay_later": false
        },
        "custom_fields": [
          {
            "label": "Event Reference Number",
            "value": "Ref. #1234",
            "placement": "ABOVE_LINE_ITEMS"
          },
          {
            "label": "Terms of Service",
            "value": "The terms of service are...",
            "placement": "BELOW_LINE_ITEMS"
          }
        ],
        "sale_or_service_date": "2030-01-24",
        "store_payment_method_enabled": false
      }
    }
  }
}

The subscription_id isn’t in the webhook but if you take the invoice_id and call GetInvoice the subscription_id will be in the response. :slightly_smiling_face:

Yeah now I’m able to retrieve the subscription on recurring charge, There should be another webhook for automatic payment.

Thank you for saving my day

Happy to hear you got the info you needed. As for a webhook for the recurring payment, what were you expecting? An event is triggered when the recurring payment takes place. Were you looking for something before the date of the recurring payment? :slightly_smiling_face: