Velo API to detect grace period

I want to detect when a pricing plan renewal goes into a “grace period” due to a payment failure and show information to a logged-in user about this status.

I was finally able to generate this condition for testing (there was no easy way to simulate it despite service providers like Stripe having mechanisms to do this) and the order in the Wix Subscriptions dashboard clearly shows “Grace period”. But retrieving the order from the Velo API wix-pricing-plans-backend orders.getOrder retrieves an order that, incorrectly, has status = “ACTIVE” and lastPaymentStatus = “PAID”.

Per Get Order | Velo, there is a lastPaymentStatus value for “FAILED” which is what should be there but is not.

There is a field in the order called wixPayOrderId but I cannot find any Velo API to use this to retrieve payment information.

I may just hook into the event from a custom automation based on the trigger “Payment fails - grace period starts” to record this information in some custom fields unless anyone has been successful in getting this information from an API call.

retrieving the order from the Velo API wix-pricing-plans-backend orders.getOrder retrieves an order that, incorrectly, has status = “ACTIVE” and lastPaymentStatus = “PAID”.

you are seeing this because a subscription is still in active status during the grace period

I may just hook into the event from a custom automation based on the trigger “Payment fails - grace period starts” to record this information

such a trigger does not exist

the only way to do this is to hook into onOrderCycleStarted and schedule an automation that runs on

order.validUntil - YOUR_DEFINED_GRACE_PERIOD

Correct that the subscription is still ACTIVE. However, the last payment status is not PAID, it should be FAILED, which is what currently shows on the subscription dashboard:

image

(Not to mention that this information is also incorrect: it was the payment on May 25 that failed.)

Here’s the trigger that I have available:

ah, sorry I didn’t see this trigger in my dashboard. This the way to go. Looks like you are all set up.