Midtrans Subscription Migration from WooCommerce to Node.js

Ever wondered how subscriptions in WooCommerce actually work? Honestly, I was already relieved when I could just install the plugin and have it run without errors :). But I had an interesting experience when I had to migrate Midtrans subscription data that previously ran on WooCommerce to a new donation system built with Node.js.

Difference in Subscription Mechanisms

At first, I thought subscription flows worked the same way everywhere. Turns out, they don’t:

  • WooCommerce: Uses WooCommerce’s internal cronjob to determine when to charge. When the billing period arrives, WooCommerce triggers the Midtrans charge endpoint.
  • Node.js (custom system): No internal cronjob. The entire subscription process is handled directly by Midtrans through the subscription endpoint.

So, in WooCommerce, the charge logic lives within the application, while in Node.js we rely more on the Midtrans API.

Challenges and Solutions

Although the flow is different, it wasn’t a major issue. The key lies in the card_token. As long as we store the user’s payment token, the new system can continue processing automatic charges. WooCommerce itself stores this token in its database as the saved card identity, so users don’t have to re-enter payment details for future charges.

This means that recurring donations previously managed in WooCommerce can continue seamlessly on the new Node.js-based platform without disrupting the user experience.

Conclusion

In short, the secret is the card_token — as long as it’s secure, subscription migration can run smoothly, even across different platforms.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *