Payment.updated webhook not triggered for subscription payment

We have a mobile Application. This mobile application is integrated with In-App Payments SDK . When the user logs into the mobile application, and want to subscribe to the mobile application, they enter the card details using In-App. Card Source (starting with “cnon:”) corresponding to the card information entered is received along with other items as response from In-App. This card source and other related information is passed to an Asp.Net Web API.

The Web API does 2 things:

  1. Calls the CreatePayment API of Square using the Card Source receive above for a customer.
  2. Once the CreatePayment API is successful, a subscription is created for the customer by calling the CreateSubscription API.

We have also configured Webhooks for payment.updated and subscription.updated events. The moment the payment is made (when the Web API calls the CreatePayment API), payment.updated webhook is triggered. But when the subscription is due on a date, the payment.updated is not triggered.

What could be the reason? Am I missing anything?

Right, this is the expected behavior if the subscription payment hasn’t yet been made. Once the customer pays for the subscription will the payment.updated webhook event fire. :slightly_smiling_face:

So, if I pass the value of card source (starting with “cnon”) to the “card-id” in the request of CreateSubscription API, will the payment for the subscription be charged to the card and payment.updated will be triggered for each Cadence?

Passing a card source_id that starts with cnon won’t work. The subscription expects a card_id from the Cards API.

The source_id that’s generated from the Web Payments SDK needs to be passed to CreateCard where we will store the card on file. You’ll get a card_id back from that which you’ll pass to CreateSubscription. :slightly_smiling_face:

Thank you for your prompt response. So may I summarize the steps as below:

  1. Card source_id that starts with “cnon” is received FROM the In-App when the users enters card information.

  2. Call CreateCard API passing the source_id received above along with Customer ID. Do we need also need to pass expiry month, expiry year, card holder’s name, address etc. or they need not be passed?

  3. CreateCard API returns the card-id.

  4. Call CreateSubscription using the card-id that is obtained from CreateCard API.

  5. Once the subscription is created as above, the first payment will be charged from this card for this subscription. Payment.updated webhook will be also be triggered.

  6. Payment will be charged for each subscription cadence.

  7. Payment.updated webhook will also be triggered for each subscription cadence.

Please correct me if I have missed out anything.

You got it! That’s the flow for creating a subscription with a card on file?

For the CreateCard call you don’t need to provide all the information but if you have it the more information you provide the better chance you have for storing the card on file. :slightly_smiling_face:

Thank you. Will try out and get back to you.